|
|
|
@ -34,7 +34,7 @@ class Formatter:
|
|
|
|
|
|
|
|
|
|
class OutNoStatFormatter(Formatter):
|
|
|
|
|
def additional_init(self):
|
|
|
|
|
self.representation = ""
|
|
|
|
|
self.representation = {}
|
|
|
|
|
|
|
|
|
|
def header_repeat(self):
|
|
|
|
|
return ["Lemma", "Representative_form", "RF_msd", "RF_scenario"]
|
|
|
|
@ -49,16 +49,18 @@ class OutNoStatFormatter(Formatter):
|
|
|
|
|
|
|
|
|
|
rep = representations[idx]
|
|
|
|
|
if rep is None:
|
|
|
|
|
self.representation += " " + word.lemma
|
|
|
|
|
self.representation[idx] = word.lemma
|
|
|
|
|
return [word.lemma, word.lemma, "", "lemma_fallback"]
|
|
|
|
|
else:
|
|
|
|
|
self.representation += " " + rep
|
|
|
|
|
self.representation[idx] = rep
|
|
|
|
|
return [word.lemma, rep, word.msd, "ok"]
|
|
|
|
|
|
|
|
|
|
def content_right(self, freq):
|
|
|
|
|
rep = re.sub(' +', ' ', self.representation.strip())
|
|
|
|
|
def content_right(self, freq, best_word_order=None):
|
|
|
|
|
if best_word_order is None:
|
|
|
|
|
best_word_order = sorted(self.representation.keys())
|
|
|
|
|
rep = ' '.join([self.representation[o] for o in best_word_order if o in self.representation])
|
|
|
|
|
result = [rep, str(freq)]
|
|
|
|
|
self.representation = ""
|
|
|
|
|
self.representation = {}
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def group(self):
|
|
|
|
@ -181,13 +183,13 @@ class OutFormatter(Formatter):
|
|
|
|
|
def header_right(self):
|
|
|
|
|
return self.f1.header_right() + self.f2.header_right()
|
|
|
|
|
|
|
|
|
|
def content_repeat(self, words, representations, idx, sidx):
|
|
|
|
|
def content_repeat(self, words, representations, idx, sidx, best_word_order=None):
|
|
|
|
|
cr1 = self.f1.content_repeat(words, representations, idx, sidx)
|
|
|
|
|
cr2 = self.f2.content_repeat(words, representations, idx, sidx)
|
|
|
|
|
return cr1 + cr2
|
|
|
|
|
|
|
|
|
|
def content_right(self, freq):
|
|
|
|
|
return self.f1.content_right(freq) + self.f2.content_right(freq)
|
|
|
|
|
def content_right(self, freq, best_word_order=None):
|
|
|
|
|
return self.f1.content_right(freq, best_word_order) + self.f2.content_right(freq)
|
|
|
|
|
|
|
|
|
|
def group(self):
|
|
|
|
|
return self.f1.group() and self.f2.group()
|
|
|
|
|