for uci in self.ucis :
get = list(set(uci.etoiles).intersection(etoiles))
if len(get) > 1 :
- return '2 variables sur la meme ligne'
- elif get != [] :
+ log.info('2 variables sur une ligne')
+ if get != [] :
etuces[etoiles.index(get[0])] += [uce.ident for uce in uci.uces]
etuces = [set(val) for val in etuces]
tab = []
with open('/tmp/testhapxuce.html','w') as f :
f.write(txt)
+ def export_dictionary(self, fileout, syscoding) :
+ listformes = [[self.formes[forme].freq, forme, self.formes[forme].lem, self.formes[forme].gram] for forme in self.formes]
+ listformes.sort(reverse = True)
+ listformes = [forme[1:] + [`forme[0]`] for forme in listformes]
+ with open(fileout, 'w') as f :
+ f.write('\n'.join(['\t'.join(forme) for forme in listformes]).encode(syscoding))
+
+ def export_lems(self, fileout, syscoding) :
+ self.make_idformes()
+ listlem = [[lem, '\t'.join(['\t'.join([self.idformes[forme].forme, `self.lems[lem].formes[forme]`]) for forme in self.lems[lem].formes])] for lem in self.lems]
+ listlem.sort()
+ with open(fileout, 'w') as f :
+ f.write('\n'.join(['\t'.join(lem) for lem in listlem]).encode(syscoding))
+
+
+
class MakeUciStat :
def __init__(self, corpus) :
log.info(u'Empty text : %i' % linenb)
iduci -= 1
self.corpus.ucis.pop()
- #raise Exception("EmptyText %i" % linenb)
self.corpus.ucis.append(Uci(iduci, line))
if self.dlg is not None :
if not (iduci + 1) % 10 :
idpara += 1
self.corpus.ucis[-1].paras.append(line.split()[0])
else :
- raise Exception('paragrapheOT')
+ raise Exception('paragrapheOT %i' % linenb)
elif line.strip() != '' and iduci != -1 :
txt.append(line)
if txt != [] and iduci != -1 :
iduce, idpara = self.treattxt(txt, iduce, idpara, iduci)
del(txt)
else :
- raise Exception("EmptyText")
+ if iduci != -1 :
+ iduci -= 1
+ self.corpus.ucis.pop()
+ log.info(Exception("Empty text %i" % linenb))
+ else :
+ raise Exception('EmptyText %i' % linenb)
if iduci != -1 and iduce != -1:
self.backup_uce()
else :
log.info(_(u"No Text in corpora. Are you sure of the formatting ?"))
- raise Exception('TextBeforeTextMark')
+ raise Exception('TextBeforeTextMark %i' % linenb)
except UnicodeDecodeError :
raise Exception("CorpusEncoding")
parametres['originalpath'] = parent.filename
PathOut().createdir(parametres['pathout'])
ReadLexique(self.parent, lang = parametres['lang'])
- self.parent.expressions = ReadDicoAsDico(self.parent.DictPath.get(parametres['lang']+'_exp', 'french_exp'))
+ if parametres['lang'] != 'other' and os.path.exists(self.parent.DictPath.get(parametres['lang']+'_exp', 'french_exp')):
+ self.parent.expressions = ReadDicoAsDico(self.parent.DictPath.get(parametres['lang']+'_exp', 'french_exp'))
+ else :
+ self.parent.expressions = {}
self.parametres = parametres
else :
if self.dlg is not None :