Subversion Repositories navi

Rev

Rev 89 | Rev 122 | 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("""
103 szabot 12
    SELECT *
46 szabot 13
    FROM `metaWords`
103 szabot 14
    WHERE partOfSpeech <> 'num.' AND partOfSpeech <> "prefix"
15
    ORDER BY CHAR_LENGTH(navi) DESC"""):
65 szabot 16
        if row["infixes"]:
89 szabot 17
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"].lower(), "type": row["partOfSpeech"]})
65 szabot 18
        else:
89 szabot 19
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"].lower(), "type": row["partOfSpeech"]})
46 szabot 20
    db.close()
21
    return ret
22
 
23
def getnavi(word):
24
    ret = []
25
    db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
26
    for row in db.query("""
27
    SELECT *
28
    FROM `metaWords`
29
    WHERE navi = ?""",word):
65 szabot 30
        if row["infixes"]:
89 szabot 31
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"].lower(), "type": row["partOfSpeech"]})
65 szabot 32
        else:
89 szabot 33
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"].lower(), "type": row["partOfSpeech"]})
46 szabot 34
    db.close()
35
    return ret
49 szabot 36
 
37
#def gettrans(id, cod):
38
    #ret = []
39
    #if cod not in (u"est",u"ptbr",u"de",u"eng",u"all"):
40
        #return ret
41
    #db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
42
    #if cod == "all":
43
            #for row in db.query("""
44
            #SELECT *
45
            #FROM `metaWords`
46
            #WHERE id = ?""",idd):
47
                #infix = makeinfix(row)
48
            #ret.append([row["id"],row["navi"], infix, row["partOfSpeech"]])
49
    #db.close()