new outformatter, old is not outnostatformatter
This commit is contained in:
parent
cb53a9c7b3
commit
432dc87a5f
30
wani.py
30
wani.py
|
@ -1054,7 +1054,7 @@ class Formatter:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OutFormatter(Formatter):
|
class OutNoStatFormatter(Formatter):
|
||||||
def additional_init(self):
|
def additional_init(self):
|
||||||
self.representation = ""
|
self.representation = ""
|
||||||
|
|
||||||
|
@ -1180,6 +1180,34 @@ class StatsFormatter(Formatter):
|
||||||
def group(self):
|
def group(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
class OutFormatter(Formatter):
|
||||||
|
def additional_init(self):
|
||||||
|
self.f1 = OutNoStatFormatter(self.colocation_ids, self.word_renderer)
|
||||||
|
self.f2 = StatsFormatter(self.colocation_ids, self.word_renderer)
|
||||||
|
|
||||||
|
def header_repeat(self):
|
||||||
|
return self.f1.header_repeat() + self.f2.header_repeat()
|
||||||
|
|
||||||
|
def header_right(self):
|
||||||
|
return self.f1.header_right() + self.f2.header_right()
|
||||||
|
|
||||||
|
def content_repeat(self, words, representations, idx, sidx):
|
||||||
|
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 group(self):
|
||||||
|
return self.f1.group() and self.f2.group()
|
||||||
|
|
||||||
|
def set_structure(self, structure):
|
||||||
|
self.f2.set_structure(structure)
|
||||||
|
|
||||||
|
def new_match(self, match):
|
||||||
|
self.f2.new_match(match)
|
||||||
|
|
||||||
|
|
||||||
class Writer:
|
class Writer:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user