\n'
113 | s += '
QuillPad allows users to type freely without having to follow any strict typing rules. While QuillPad predicts most words correctly, there may be a few cases where the desired word may not appear in the predicted options. Such words can be composed by entering the words in an ITRANS like scheme.
\n'
114 | s += '
The following examples demonstrate how to write words using the ITRANS like scheme
\n'
115 | s += '
\n'
116 | s += '\nInput | Output | | \n'
117 | for (input,output,note) in examples:
118 | outLine = '%s | %s | %s | '%(input,output.encode('utf-8'),note.encode('utf-8'))
119 | s += '' + outLine + '
'
120 | s += "
\n"
121 |
122 | def processTR(l):
123 | if len(l) < 1:
124 | return
125 |
126 | return "
\n%s
\n" % (reduce(lambda x, y: x + '
' +
127 | y[0].encode('utf-8') + " (" +
128 | y[1].encode('utf-8') + ") | ", l, ""))
129 |
130 | def processTable(t):
131 | if len(t) < 1:
132 | return
133 |
134 | out = '
\n'
135 | # If list of lists
136 | if type(t[0]) == type([]):
137 | for i in t:
138 | out += processTR(i)
139 | else:
140 | out += processTR(t)
141 | return out + '
\n'
142 |
143 | def processEx(e):
144 | if len(e) < 1:
145 | return
146 |
147 | return "Examples
\n" % (reduce(lambda x, y: x + "
" +
148 | y.encode('utf-8') + "", e, ""))
149 |
150 | s += '
Scheme Table
\n'
151 | for (label,noteex,eachList) in help:
152 | s += '
%s
\n'%label.encode('utf-8')
153 | for i in noteex:
154 | if type(i) == type("") or type(i) is unicode:
155 | s += '
%s
' % (i.encode('utf-8'))
156 | else:
157 | s += processEx(i)
158 |
159 | s += processTable(eachList)
160 |
161 | s += "
\n"
162 | print "done"
163 |
164 | ts = open('help_template.html').read()
165 | f = open(outfile, "w")
166 | lang = lang[0].upper() + lang[1:]
167 | f.write(string.Template(ts).substitute(lang = lang, content = s))
168 | f.close()
169 |
170 | def processLang(lang, q, outfile):
171 | print "Attempting to generate", outfile, "... ",
172 | f = open(outfile, "w")
173 | f.write(lang + "_interfacemap = " +
174 | json.encode(q.virtualInterfaceMap).encode('utf-8') + ";\n")
175 | f.write(lang + "_keymap = " +
176 | json.encode({"map": q.getVirtualKB()}).encode('utf-8') + ";\n")
177 | f.write(lang + "_pattern = /" +
178 | repr(q.dumpAksharaPattern())[2:-1] + "/g ;\n")
179 | f.write(lang + "_zwnjmap = " + json.encode({
180 | "zwjSignificant": q.zwjSignificant,
181 | "zwnjSignificant": q.zwnjSignificant,
182 | "zwjCode": repr(q.zwjCode)[2:-1],
183 | "zwnjCode": repr(q.zwnjCode)[2:-1],
184 | "halanth": repr(q.halanth)[2:-1],
185 | "nukta": repr(q.nukta)[2:-1]
186 | }) + ";")
187 | f.close()
188 |
189 | print "done"
190 |
191 | def getLangFile(lang):
192 | # Check if lang is valid, otherwise return empty string
193 | if loadedMaps.has_key(lang):
194 | return loadedMaps[lang]
195 | else:
196 | return ""
197 |
198 | def isDictWord(lang, word):
199 | try:
200 | return loadedUniqueWords[lang].has_key(word)
201 | except KeyError, e:
202 | return False
203 |
204 | def init():
205 | """ Load the dump files into memory """
206 | for i in config.langMap:
207 | try:
208 | #f = codecs.open("dump/" + i + "_map.js", "r", "utf-8")
209 | #loadedMaps[i] = f.read()
210 | #f.close()
211 |
212 | # Load the unique_lang_words.txt files as well
213 | loadedUniqueWords[i] = dict([(line.split('\t')[0].decode('utf-8'), 1) for line in open(config.langMap[i][1],'r').readlines()])
214 |
215 | except IOError, e:
216 | print "Failed to load keyboard map file for %s. Exception %s" % (i, e)
217 | else:
218 | print "Loaded keyboard map for", i
219 |
220 | # Load the hindi dictionary
221 | d = loadedUniqueWords['hindi']
222 | print "Loading hindi dictionary...",
223 | for line in open('HindiDictionary.txt').readlines():
224 | d[line.strip().decode('utf-8')] = 1
225 | print "Done (%d words)" % (len(d.keys()),)
226 |
227 | init()
228 |
--------------------------------------------------------------------------------
/punjabi.tar.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teamtachyon/Quillpad-Server/938671f65cdc02004c4bcf934e7085e1e0e13f72/punjabi.tar.bz2
--------------------------------------------------------------------------------
/quill_cherry8088.conf:
--------------------------------------------------------------------------------
1 | [global]
2 | server.socket_host = "0.0.0.0"
3 | server.socket_port = 8090
4 | server.thread_pool= 10
5 | environment = 'production'
6 | server.show_tracebacks = False
7 | request.show_tracebacks = False
8 | #decoding_filter.on = True
9 | #decoding_filter.encoding = 'utf-8'
10 | log.screen = True
11 | encoding_filter.on = True
12 | encoding_filter.encoding = 'utf-8'
13 | engine.autoreload.on = False
14 |
--------------------------------------------------------------------------------
/quilljson.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # @Date : Nov 22 2012
3 | # @Author : Ram Prakash
4 | # @Version : 1
5 |
6 | def dictToJSON(d):
7 | str = "{"
8 | for i in d:
9 | str += jsonmap[type(i)](i) + ": "
10 | str += jsonmap[type(d[i])](d[i]) + ", "
11 | if len(d.keys()) > 0:
12 | str = str[:-2]
13 | str += "}"
14 | return str
15 |
16 | def boolToJSON(b):
17 | if b:
18 | return "true"
19 | else:
20 | return "false"
21 |
22 | def listToJSON(b):
23 | str = "["
24 | for i in b:
25 | str += jsonmap[type(i)](i) + ", "
26 | if len(b) > 0:
27 | str = str[:-2]
28 | str += "]"
29 | return str
30 |
31 | jsonmap = {
32 | type([]): listToJSON,
33 | type(()): listToJSON,
34 | type({}): dictToJSON,
35 | type(""): lambda x: '"%s"' % (x),
36 | type(0): lambda x: str(x),
37 | type(u""): lambda x: '"' + x + '"',
38 | type(0.1): lambda x: str(x),
39 | type(True): boolToJSON,
40 | type(None): lambda x: "null"
41 | }
42 |
43 | def encode(dict):
44 | if type(dict) != type({}):
45 | raise Exception("Expected a dictionary")
46 |
47 | return dictToJSON(dict)
48 |
--------------------------------------------------------------------------------
/startquill_manual.py:
--------------------------------------------------------------------------------
1 | from aifc import Error
2 | import cherrypy
3 | from QuillManual import QuillManual
4 |
5 | class QuillManualCherry:
6 |
7 | @cherrypy.expose
8 | def primaryToUnicodeCherry(self, literal ) :
9 | try:
10 | print "Invoking primaryToUnicode on QuillManual..."
11 | return literal + "\n" + self.quillManual.primaryToUnicode( literal )
12 | except Exception:
13 | print Exception
14 | return "-------------";
15 |
16 | @cherrypy.expose
17 | def unicodeToPrimaryCherry(self, uStr ) :
18 | try:
19 | return uStr.decode('utf-8') + "\n" + self.quillManual.unicodeToPrimary( uStr.decode('utf-8') )
20 | except Exception:
21 | print Exception
22 | return "-------------";
23 |
24 | @cherrypy.expose
25 | def unicodeToHelperStrCherry(self, uStr ) :
26 | try:
27 | return uStr.decode('utf-8') + "\n" + self.quillManual.unicodeToHelperStr( uStr.decode('utf-8') )
28 | except Exception:
29 | print Exception
30 | return "-------------";
31 |
32 | @cherrypy.expose
33 | def getOptionsAtCherry(self, currHelper, currUStr, pos ) :
34 | try:
35 | return currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getOptionsAt( currHelper, currUStr.decode('utf-8'), int(pos) ))
36 | except Exception:
37 | print Exception
38 | return "-------------";
39 |
40 | @cherrypy.expose
41 | def getInsertCorrectionsCherry(self, currHelper, currUStr, pos, delta ) :
42 | try:
43 | corrections = currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getInsertCorrections( currHelper, currUStr.decode('utf-8'), int(pos), delta ));
44 | return corrections
45 | except Exception:
46 | print Exception
47 | return "-------------";
48 |
49 | @cherrypy.expose
50 | def getDeleteCorrectionsCherry(self, currHelper, currUStr, pos, delLen ) :
51 | try:
52 | return currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getDeleteCorrections( currHelper, currUStr.decode('utf-8'), int(pos), int(delLen) ))
53 | except Exception:
54 | print Exception
55 | return "-------------";
56 |
57 | def __init__(self):
58 | self.quillManual = QuillManual()
59 | self.quillManual.loadPrimaryDef()
60 |
61 | def main() :
62 | cherrypy.root = QuillManualCherry()
63 | cherrypy.config.update( file='quill_manual.conf' )
64 | cherrypy.server.start()
65 |
66 | if __name__ == '__main__' :
67 | main()
68 |
--------------------------------------------------------------------------------
/tamil.tar.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teamtachyon/Quillpad-Server/938671f65cdc02004c4bcf934e7085e1e0e13f72/tamil.tar.bz2
--------------------------------------------------------------------------------
/telugu.tar.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teamtachyon/Quillpad-Server/938671f65cdc02004c4bcf934e7085e1e0e13f72/telugu.tar.bz2
--------------------------------------------------------------------------------
/unique_word_files.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teamtachyon/Quillpad-Server/938671f65cdc02004c4bcf934e7085e1e0e13f72/unique_word_files.zip
--------------------------------------------------------------------------------
/wordCounter.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, request, render_template, redirect, url_for
2 | import itertools, threading, json
3 | import time
4 |
5 | from RingBuffers import RingBuffer, RingBufferFull
6 |
7 | app = Flask(__name__)
8 |
9 | lock = threading.Lock()
10 | prevTime = time.time()
11 | wordCount = itertools.count(int(open('wordcount').read()))
12 | timerRingBuffer = RingBuffer(10, wordCount.next())
13 |
14 | @app.route("/processInput")
15 | def processInput():
16 | action = request.args.get('action')
17 | if action <> 'addWord':
18 | return
19 | count = wordCount.next()
20 |
21 | if count % 100 == 0:
22 | updateCount(count)
23 | #print 'wordcount is: ', wordCount
24 |
25 | currTime = int(time.time())
26 | global prevTime
27 | global timerRingBuffer
28 | if currTime <> prevTime:
29 | timerRingBuffer.append(wordCount)
30 | prevTime = currTime
31 | else:
32 | timerRingBuffer.data[timerRingBuffer.get_curr()] = count
33 |
34 | return ""
35 | #print 'buffer is: ', timerRingBuffer.get()
36 |
37 | @app.route("/processWordCounts")
38 | def processWordCounts():
39 | print 'buffer is: ', timerRingBuffer.get()
40 | print 'response is', json.listToJSON(timerRingBuffer.get())
41 | print
42 | return json.listToJSON(timerRingBuffer.get())
43 |
44 | def updateCount(count):
45 | lock.acquire()
46 | open('wordcount', 'w').write(str(count))
47 | lock.release()
48 |
49 |
50 | if __name__ == "__main__":
51 | app.run(debug=True)
52 |
--------------------------------------------------------------------------------
/xlitGen.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import QuillEngXlit
3 |
4 | def main() :
5 | if len(sys.argv) < 4 :
6 | print "Usage : xlitGen.py