Rev 49 | Rev 89 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
46 | szabot | 1 | #!/usr/bin/python |
2 | # -*- coding: utf-8 -*- |
||
3 | |||
4 | import tornado.database |
||
5 | import re |
||
6 | |||
7 | def getnavilist(): |
||
8 | ret = [] |
||
9 | current = u"" |
||
10 | db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi") |
||
11 | for row in db.query(""" |
||
12 | SELECT *, CHAR_LENGTH(navi) AS NL |
||
13 | FROM `metaWords` |
||
14 | ORDER BY NL DESC"""): |
||
65 | szabot | 15 | if row["infixes"]: |
16 | ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"], "type": row["partOfSpeech"]}) |
||
17 | else: |
||
18 | ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"], "type": row["partOfSpeech"]}) |
||
46 | szabot | 19 | db.close() |
20 | return ret |
||
21 | |||
22 | def getnavi(word): |
||
23 | ret = [] |
||
24 | db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi") |
||
25 | for row in db.query(""" |
||
26 | SELECT * |
||
27 | FROM `metaWords` |
||
28 | WHERE navi = ?""",word): |
||
65 | szabot | 29 | if row["infixes"]: |
30 | ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"], "type": row["partOfSpeech"]}) |
||
31 | else: |
||
32 | ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"], "type": row["partOfSpeech"]}) |
||
46 | szabot | 33 | db.close() |
34 | return ret |
||
49 | szabot | 35 | |
36 | #def gettrans(id, cod): |
||
37 | #ret = [] |
||
38 | #if cod not in (u"est",u"ptbr",u"de",u"eng",u"all"): |
||
39 | #return ret |
||
40 | #db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi") |
||
41 | #if cod == "all": |
||
42 | #for row in db.query(""" |
||
43 | #SELECT * |
||
44 | #FROM `metaWords` |
||
45 | #WHERE id = ?""",idd): |
||
46 | #infix = makeinfix(row) |
||
47 | #ret.append([row["id"],row["navi"], infix, row["partOfSpeech"]]) |
||
48 | #db.close() |