Exemple #1
0
def otsi2(sona, x):
    import re
    h.kr("<h4>Tulemused:</h4>")
    h.k("Sõna oli: \"")
    h.k(sona)
    h.kr("\"")
    sona2 = re.escape(sona)
    sona = sona.replace("\'", "\\''")
    if (x == '1'):
        sone = """SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl FROM wilaused_et e, wilaused_vro v WHERE e.lause ilike '%%%s%%' AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr;""" % sona
    elif (x == '2'):
        sone = """SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl FROM wilaused_et e, wilaused_vro v WHERE v.lause ilike '%%%s%%' AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr;""" % sona
    else:
        h.kr("Keelevalik puudus?")

    h.tabel_a()
    h.tr_l()
    h.td("töö nr", 'd')
    h.td("lause nr", 'd')
    h.td("lause", 'd')
    h.td("lause", 'd')
    h.tr_l()
    for r in s.sqle(d.n, sone):
        h.tr_l()
        enr = str(r['enr'])
        viide = "wi.py?z=vati&nr=" + enr
        h.atd('aeg r', viide, enr)
        elnr = str(r['elnr'])
        viide2 = "wi.py?z=val&tnr=" + elnr + "&lnr=" + enr
        h.atd('aeg r', viide2, elnr)
        h.td(r['el'], 'd')
        h.td(r['vl'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #2
0
def vroet():
    sql = """SELECT võro,eesti FROM võru_eesti_sõnaraamat ORDER BY võro,eesti;"""
    h.tabel_a()
    h.kr("<tr><td>Võro</td><td>Eesti</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['võro'], 'd')
        h.td(r['eesti'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #3
0
def etvro():
    sql = """SELECT eesti,võro FROM eesti_võru_sõnaraamat ORDER BY eesti,võro;"""
    h.tabel_a()
    h.kr("<tr><td>Eesti</td><td>Võro</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['eesti'], 'd')
        h.td(r['võro'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #4
0
def vaataallikaid():
    sql = "SELECT * FROM wiallikas;"
    h.tabel_a()
    for r in s.sqle(d.n, sql):
        h.tr_l()
        h.td(r['nimi_et'], 'd')
        h.td(r['kirjeldus_et'], 'd')
        h.td(r['nimi_vro'], 'd')
        h.td(r['kirjeldus_vro'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #5
0
def vro_en_koik():
    sql = """SELECT vro,en from vro_en order by vro,en ;"""
    #sql = """SELECT COUNT(nr) AS palju, nr,om,os FROM käändsõnad_vro GROUP BY nr,om,os ORDER BY nr,palju DESC ;;"""
    h.tabel_a()
    h.kr("<tr><td>vro</td><td>en</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['vro'], 'd')
        h.td(r['en'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #6
0
def tprojektid():
    sql = """SELECT * FROM tõlkelause where (lke='et' and ske='vro') or (lke='vro' and ske='et') ORDER BY pro DESC;"""
    h.kr("<br>Projektid")
    h.tabel_a()
    h.kr("<tr><td>ID</td><td>Sõna</td><td>homograaf</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['pro'], 'd')
        h.td(r['lähtelause'], 'd')
        h.td(r['sihtlause'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #7
0
def kaanded():
    h.h3('Käänded')
    sql = """SELECT nr,nim,om,os from käändsõnad_vro ORDER BY nim,om,os;"""
    h.tabel_a()
    h.kr("<tr><td>nr</td><td>nim</td><td>om</td><td>os</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['nr'], 'd')
        h.td(r['nim'], 'd')
        h.td(r['om'], 'd')
        h.td(r['os'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #8
0
def yhesugusedkaandelopud():
    h.h3('Ühesugused käändelõpud')
    sql = """SELECT COUNT(nr) AS palju, nr,om,os FROM käändsõnad_vro GROUP BY nr,om,os ORDER BY nr,palju DESC ;;"""
    h.tabel_a()
    h.kr("<tr><td>palju</td><td>nr</td><td>om</td><td>os</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['palju'], 'd')
        h.td(r['nr'], 'd')
        h.td(r['om'], 'd')
        h.td(r['os'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #9
0
def vaatateksti(nr):
    h.k("<h4>Tekst nr: ")
    h.a(nr)
    h.kr("</h4>")
    sql = "SELECT et.lausenr AS nr, et.lause AS etlause, vro.lause AS vrolause FROM wilaused_et et, wilaused_vro vro WHERE et.nr='%s' AND vro.nr='%s' AND et.lausenr=vro.lausenr ORDER BY et.lausenr;" % (
        nr, nr)
    h.tabel_a()
    for r in s.sqle(d.n, sql):
        h.tr_l()
        h.td(r['nr'], 'd')
        h.td(r['etlause'], 'd')
        h.td(r['vrolause'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #10
0
def puhasvro():
    sql = """SELECT * FROM puhas_vro ORDER BY sõna,hg;"""
    h.kr(
        "<br>Iva ID on ivasõnaraamatu rea ID, mille abil saab sõnu tagasisiduda"
    )
    h.tabel_a()
    h.kr("<tr><td>ID</td><td>Sõna</td><td>homograaf</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['iid'], 'd')
        h.td(r['sõna'], 'd')
        h.td(r['hg'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #11
0
def tprojektid():
	sql = """SELECT nr,lke,ske,lähtejutt,sihtjutt FROM tõlked ORDER BY nr DESC;"""
	h.kr("<br>Projektid")
	h.tabel_a()
	h.kr("<tr><td>Pro ID</td><td>Lk</td><td>Sk</td><td>Sõna</td><td>homograaf</td></tr>")
	for r in s.sqlp(db.n,sql):
		h.tr_a()
		h.td(r[0],'d')
		h.td(r[1],'d')
		h.td(r[2],'d')
		h.td(r[3],'d')
		h.td(r[4],'d')
		#h.td(r['pro'],'d')
		h.tr_l()
	h.tabel_l()
Exemple #12
0
def kaandeloppuderuhmad():
    h.h3('Käändelõppude rühmad')
    sql = """with algus as (select count(nr) as mitu, nr as käändk,om as omastav,os as osastav from käändsõnad_vro  group by nr,om,os order by nr,mitu desc) select mitu,käändk,omastav,osastav from algus where mitu > 1 order by omastav,osastav;"""
    h.tabel_a()
    h.kr(
        "<tr><td>sõnadearv</td><td>käändkonna nr</td><td>omastav</td><td>osastav</td></tr>"
    )
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['mitu'], 'd')
        h.td(r['käändk'], 'd')
        h.td(r['omastav'], 'd')
        h.td(r['osastav'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #13
0
def vaatalauset(lnr, tnr):
    h.k("Töö nr: ")
    h.a(tnr)
    h.k(" Lause nr: ")
    h.a(lnr)
    h.kr(".")
    vlnr = int(lnr) - 2
    slnr = int(lnr) + 2
    sql = "SELECT et.lausenr AS nr, et.lause AS etlause, vro.lause AS vrolause FROM wilaused_et et, wilaused_vro vro WHERE et.nr='%s' AND vro.nr='%s' AND et.lausenr=vro.lausenr  AND et.lausenr >= '%s' and et.lausenr <= '%s' ORDER BY et.lausenr;" % (
        tnr, tnr, vlnr, slnr)
    h.tabel_a()
    for r in s.sqle(d.n, sql):
        h.tr_l()
        h.td(r['nr'], 'd')
        h.td(r['etlause'], 'd')
        h.td(r['vrolause'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #14
0
def vaatatekste():
    sql = """SELECT t.nr AS tnr,t.allikas AS tallikas,t.nimi_et AS etnimi,t.kirjeldus_et AS etkirjeldus,
		t.kirjeldus_vro AS vrokirjeldus, t.nimi_vro AS vro_nimi, a.kirjeldus_et AS akirjeldus
		FROM witekst t, wiallikas a WHERE t.allikas=a.id ORDER BY t.nr;"""
    h.tabel_a()
    h.tr_l()
    h.td("allikas", 'd')
    h.td("nr", 'd')
    h.td("eesti", 'd')
    h.td("võru", 'd')
    h.tr_l()
    for r in s.sqle(d.n, sql):
        h.tr_l()
        h.td(r['akirjeldus'], 'd')
        nr = str(r['tnr'])
        viide = "wi.py?z=vati&nr=" + nr
        h.atd('aeg r', viide, nr)
        h.td(r['etkirjeldus'], 'd')
        h.td(r['vrokirjeldus'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #15
0
def otsinäitelausist():
    h.kr("<h4>OTSI (sõnaraamatute näitelausetest)</h4>")
    viide = str("wi.py?z=ontl2&x=3")
    h.vorm(viide)
    h.kr("<br>")
    h.tabel_a()
    h.inputval("s", "sõna", 100, 100)
    h.submit(
        '2',
        'Otsida saab mitu sõna korraga. Vali otsitav sõna(d) eesti keeles')
    h.tabel_l()
    h.kr("</form>")
    viide = str("wi.py?z=ontl2&x=4")
    h.vorm(viide)
    h.tabel_a()
    h.inputval("s", "sõnna", 100, 100)
    h.submit(
        '2',
        'Otsi saat kõrraga üts kooni mitu sõnna. Kae otstavat sõnna/u võro keeleh'
    )
    h.tabel_l()
    h.kr("</form>")
    viide = str("wi.py?z=ontl2&x=5")
    h.vorm(viide)
    h.kr("<br>")
    h.tabel_a()
    h.inputval("s", "sõna", 100, 100)
    h.submit('2', 'TEST, sorteerituna sõnade arvu ja lause pikkuse järgi')
    h.tabel_l()
    h.kr("</form>")
    viide = str("wi.py?z=ontl2&x=6")
    h.vorm(viide)
    h.kr("<br>")
    h.tabel_a()
    h.inputval("s", "sõna", 100, 100)
    h.submit('2', 'TEST, sõnnu ja lause pikkuse perrä sortitu')
    h.tabel_l()
    h.kr("</form>")
    h.k("OMADUSED/FEATURES: ")
    h.kr(
        "tõstutundlikkuse tuge veel pole. Tegelikult on, aga veebiliideses veel ei värvita selliseid sõnu ning seepärast pole seda sisselülitatud."
    )
Exemple #16
0
def otsintl2(sona, x):
    import re
    h.kr("<h4>Tulemused:</h4>")
    h.k("Sõne oli: \"")
    h.k(sona)
    h.kr("\"")
    sona = sona.split(' ')
    if (x == '3'):
        sone = """SELECT i,id,et,vro,nr FROM sõ_eevro_laused WHERE et ~ ANY(ARRAY %s ) ORDER BY i,nr;""" % sona
    elif (x == '4'):
        sone = """SELECT i,id,et,vro,nr FROM sõ_eevro_laused WHERE vro ~ ANY(ARRAY %s ) ORDER BY i,nr;""" % sona
    elif (x == '5'):
        sone = """ with essa as (select i,id,et,vro,nr,CHAR_LENGTH(et) as ep FROM sõ_eevro_laused WHERE et ~ ANY(ARRAY %s ) ORDER BY i),
tessa as (SELECT regexp_split_to_table(et, E'\\\\s+') AS etsõna,i,id,et,vro,nr,ep FROM essa),
kossa as (SELECT etsõna,et,vro,i,id,nr,ep FROM tessa WHERE etsõna ~ ANY(ARRAY %s )),
nessa as (SELECT COUNT(etsõna) as korda, et,vro,nr,i,id FROM kossa GROUP BY et,vro,nr,i,id,ep ORDER BY korda DESC,ep)
select * from nessa;""" % (sona, sona)
    elif (x == '6'):
        sone = """ with essa as (select i,id,et,vro,nr,CHAR_LENGTH(et) as ep FROM sõ_eevro_laused WHERE vro ~ ANY(ARRAY %s ) ORDER BY i),
tessa as (SELECT regexp_split_to_table(vro, E'\\\\s+') AS vrosõna,i,id,et,vro,nr,ep FROM essa),
kossa as (SELECT vrosõna,et,vro,i,id,nr,ep FROM tessa WHERE vrosõna ~ ANY(ARRAY %s )),
nessa as (SELECT COUNT(vrosõna) as korda, et,vro,nr,i,id FROM kossa GROUP BY et,vro,nr,i,id,ep ORDER BY korda DESC,ep)
select * from nessa;""" % (sona, sona)
    else:
        h.kr("Keelevalik puudus?")

    h.tabel_a()
    h.tr_l()
    h.td("rea nr", 'd')
    h.td("otsikeel", 'd')
    h.td("paralleelkeel", 'd')
    h.td("lause nr", 'd')
    h.tr_l()
    for r in s.sqle(d.n, sone):
        h.tr_l()
        if (x == '3'):
            kogulause = r['et']
        elif (x == '4'):
            kogulause = r['vro']
        elif (x == '5'):
            kogulause = r['et']
        elif (x == '6'):
            kogulause = r['vro']
        for i in sona:
            kogulause = kogulause.replace(
                i, "<font color=\"blue\">" + i + "</font>")
        if (x == '3'):
            h.td(r['i'], 'd')
            h.td(kogulause, 'd')
            h.td(r['vro'], 'd')
            h.td(r['nr'], 'd')
        elif (x == '4'):
            h.td(r['i'], 'd')
            h.td(kogulause, 'd')
            h.td(r['et'], 'd')
            h.td(r['nr'], 'd')
        elif (x == '5'):
            h.td(kogulause, 'd')
            h.td(r['vro'], 'd')
            h.td(r['i'], 'd')
            h.td(r['id'], 'd')
            h.td(r['nr'], 'd')
        elif (x == '6'):
            h.td(kogulause, 'd')
            h.td(r['et'], 'd')
            h.td(r['i'], 'd')
            h.td(r['id'], 'd')
            h.td(r['nr'], 'd')
        h.tr_l()
    h.tabel_l()
Exemple #17
0
def otsi3(sona, x):
    import re
    h.kr("<h4>Tulemused:</h4>")
    h.k("Sõne oli: \"")
    h.k(sona)
    h.kr("\"")
    sona = sona.split(' ')
    if (x == '3'):
        sone = """SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl FROM wilaused_et e, wilaused_vro v WHERE e.lause ~ ANY(ARRAY %s ) AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr;""" % sona
    elif (x == '4'):
        sone = """SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl FROM wilaused_et e, wilaused_vro v WHERE v.lause ~ ANY(ARRAY %s ) AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr;""" % sona
    elif (x == '5'):
        sone = """ WITH essa AS (SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl, CHAR_LENGTH(e.lause) AS epikk FROM wilaused_et e, wilaused_vro v WHERE e.lause ~ ANY(ARRAY %s ) AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr), tessa AS ( SELECT regexp_split_to_table(el, E'\\\\s+') AS esõna,epikk,eid,enr,elnr FROM ESSA), kossa AS ( SELECT esõna,epikk,eid,enr,elnr FROM tessa WHERE esõna ~ ANY(ARRAY %s )), nessa AS ( SELECT COUNT(esõna) AS korda, epikk,enr,elnr FROM kossa GROUP BY epikk,enr,elnr ORDER BY korda DESC,epikk) SELECT e.lause AS el, v.lause AS vl,epikk,korda,enr,elnr from nessa n,wilaused_et e, wilaused_vro v WHERE enr=e.nr AND elnr=e.lausenr AND e.nr=v.nr AND v.lausenr=e.lausenr AND enr=v.nr AND elnr=v.lausenr ORDER BY korda DESC,epikk ;""" % (
            sona, sona)
    elif (x == '6'):
        sone = """ WITH essa AS (SELECT e.id AS eid, e.nr AS enr, e.lausenr AS elnr, e.lause AS el, v.lause AS vl, CHAR_LENGTH(e.lause) AS epikk FROM wilaused_et e, wilaused_vro v WHERE v.lause ~ ANY(ARRAY %s ) AND e.nr=v.nr AND v.lausenr=e.lausenr ORDER BY enr,elnr), tessa AS ( SELECT regexp_split_to_table(vl, E'\\\\s+') AS vsõna,epikk,eid,enr,elnr FROM ESSA), kossa AS ( SELECT vsõna,epikk,eid,enr,elnr FROM tessa WHERE vsõna ~ ANY(ARRAY %s )), nessa AS ( SELECT COUNT(vsõna) AS korda, epikk,enr,elnr FROM kossa GROUP BY epikk,enr,elnr ORDER BY korda DESC,epikk) SELECT e.lause AS el, v.lause AS vl,epikk,korda,enr,elnr FROM nessa n,wilaused_et e, wilaused_vro v WHERE enr=e.nr AND elnr=e.lausenr AND e.nr=v.nr AND v.lausenr=e.lausenr AND enr=v.nr AND elnr=v.lausenr ORDER BY korda DESC,epikk ;""" % (
            sona, sona)
    else:
        h.kr("Keelevalik puudus?")

    h.tabel_a()
    h.tr_l()
    h.td("töö nr", 'd')
    h.td("lause nr", 'd')
    h.td("lause", 'd')
    h.td("lause", 'd')
    h.tr_l()
    for r in s.sqle(d.n, sone):
        h.tr_l()
        enr = str(r['enr'])
        viide = "wi.py?z=vati&nr=" + enr
        h.atd('aeg r', viide, enr)
        elnr = str(r['elnr'])
        viide2 = "wi.py?z=val&tnr=" + elnr + "&lnr=" + enr
        h.atd('aeg r', viide2, elnr)
        if (x == '3'):
            kogulause = r['el']
        elif (x == '4'):
            kogulause = r['vl']
        elif (x == '5'):
            kogulause = r['el']
        elif (x == '6'):
            kogulause = r['vl']
        for i in sona:
            kogulause = kogulause.replace(
                i, "<font color=\"blue\">" + i + "</font>")
        if (x == '3'):
            h.td(kogulause, 'd')
            h.td(r['vl'], 'd')
        elif (x == '4'):
            h.td(kogulause, 'd')
            h.td(r['el'], 'd')
        elif (x == '5'):
            h.td(kogulause, 'd')
            h.td(r['vl'], 'd')
            h.td(r['korda'], 'd')
            h.td(r['epikk'], 'd')
        elif (x == '6'):
            h.td(kogulause, 'd')
            h.td(r['el'], 'd')
            h.td(r['korda'], 'd')
            h.td(r['epikk'], 'd')
        h.tr_l()
    h.tabel_l()