def analiza_slowa(slowo): slowo = slowo.strip() string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] wynik = "" for nr in ids: i = int(nr) label = _plp.plp_label(i) bform = _plp.plp_bform(i) forms = _plp.plp_forms(i) vec_id = _plp.plp_vec(i,slowo) wynik = wynik + "\nid: "+ str(i) + "\n" if len(label) >= 1: wynik = wynik + "1)label: " + label + "\n" if len(bform) >= 1: wynik = wynik + "2)bform: " + bform + "\n" if len(forms) >= 1: wynik = wynik + "3)forms:" + forms + "\n" if len(vec_id) >= 1: wynik = wynik + "4)vec_id: " + vec_id + "\n" label = "" bform = "" forms = "" vec_id= "" return wynik
def label_set(slowo): slowo = slowo.strip() string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] return frozenset(_plp.plp_label(int(nr)) for nr in ids)
def doFromyPodstawowej(lista_slow,wyniki): for slowo in lista_slow: string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] if ile < 1: wyniki.write(slowo + "- ??\n" ) else: for nr in ids: i = int(nr) bform = _plp.plp_bform(i) wyniki.write(slowo +" -> "+ bform + "\n") return 1
def doFromyPodstawowej(lista_slow): lista_slow_podst = [] for slowo in lista_slow: string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] if ile < 1: lista_slow_podst.append(slowo) else: for nr in ids: i = int(nr) bform = _plp.plp_bform(i) lista_slow_podst.append(bform) return lista_slow_podst
def analiza_slowa_pl(file,slowo): slowo = slowo.strip() string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] wynik = "" bform_list = [] for nr in ids: i = int(nr) label = _plp.plp_label(i) bform = _plp.plp_bform(i) #forms = _plp.plp_forms(i) #vec_id = _plp.plp_vec(i,slowo) wynik = wynik + "\nid: "+ str(i) + "\n" if len(label) >= 1: wynik = wynik + "1)label: " + label + "\n" if len(bform) >= 1: wynik = wynik + "2)bform: " + bform + "\n" bform_list.append(bform) #if len(forms) >= 1: # wynik = wynik + "3)forms:" + forms + "\n" #if len(vec_id) >= 1: # wynik = wynik + "4)vec_id: " + vec_id + "\n" file.write(wynik) label = "" bform = "" #forms = "" #vec_id= "" return bform_list
def doFormyPodstawowej(lista_slow): lista_slow_podst = [] slowa_str = "\nBASE FORM: " no_replay = "" for slowo in lista_slow: string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] if ile < 1: slowa_str = slowa_str + ", #" + slowo lista_slow_podst.append(slowo) else: for nr in ids: i = int(nr) bform = _plp.plp_bform(i) if no_replay != bform: lista_slow_podst.append(bform) slowa_str = slowa_str + ", " + bform no_replay = bform print slowa_str return lista_slow_podst
import _plp, os, sys, re from string import * print "init..." _plp.plp_init() print "after init" print _plp.plp_ver() print "Aby zakonczyc wpisz: q, exit lub quit" while 1: print "\npodaj wyraz:" slowo = sys.stdin.readline() slowo = slowo.strip() if slowo == 'q' or slowo =='exit' or slowo=='quit': break string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] for nr in ids: i = int(nr) label = _plp.plp_label(i) bform = _plp.plp_bform(i) forms = _plp.plp_forms(i) vec_id = _plp.plp_vec(i,slowo) print "\nid: "+ str(i) if len(label) >= 1: print "1)label: " + label
import _plp, os, sys, re from string import * _plp.plp_init() print _plp.plp_ver() print "Aby zakonczyc wpisz: q, exit lub quit" while 1: print "\npodaj wyraz:" slowo = sys.stdin.readline() slowo = slowo.strip() if slowo == 'q' or slowo =='exit' or slowo=='quit': break string = _plp.plp_rec(slowo) numery = string.split(':') ile = int(numery[0]) ids = numery[1:] for nr in ids: i = int(nr) label = _plp.plp_label(i) bform = _plp.plp_bform(i) forms = _plp.plp_forms(i) vec_id = _plp.plp_vec(i,slowo) print "\nid: "+ str(i) if len(label) >= 1: print "1)label: " + label if len(bform) >= 1: print "2)bform: " + bform