User:Eleanorg/2.1/Prototypes/transcription
< User:Eleanorg | 2.1/Prototypes
Revision as of 16:12, 21 September 2012 by Eleanorg (talk | contribs) (→make db of imgs waiting to be transcribed)
Asking people to transcribe text and submit it to a central document. Will they transcribe verbatim?
make db of imgs waiting to be transcribed
#!/usr/bin/python
#-*- coding:utf-8 -*-
import pymongo
from pymongo import Connection
#======== create db with img files
connection = Connection()
myDB = connection['consentTexts1']
collection = myDB.collection
for x in range(0,11):
title = "text" + str(x)
fileName = "img" + str(x) + ".jpg"
sentence = {'title': title, 'file': fileName, 'status': "waiting", 'text':" " }
collection.insert(sentence)
input form
Show an img waiting to be transcribed, with input form for transcription.
proces input form
Change status of that img in db to 'finished'.
(this version just prints the text submitted)
#!/usr/bin/python
#-*- coding:utf-8 -*-
import cgi
import cgitb; cgitb.enable()
#import pymongo
#from pymongo import Connection
#======== get text from input form
form = cgi.FieldStorage() # Grabs whatever input comes from form
text = form.getvalue("text", "//this part was transcribed blank//")
title = form.getvalue("title")
#========= put it in the db
#connection = Connection()
#myDB = connection['consentTexts1']
#collection = myDB.collection
#if title:
# collection.update( {'title': title}, {"$set":{'status': 'done', 'text': text}} )
#========= print thank you
print """
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>""" + title + "<br />" + text + """
</body>
</html>
"""
display transcribed texts
CGI displays an html doc of all transcribed db entries.