From 432dc87a5fdd24704fd3a7ba1c0bb0d9c7dc033e Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Mon, 10 Jun 2019 10:49:53 +0200 Subject: [PATCH] new outformatter, old is not outnostatformatter --- wani.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/wani.py b/wani.py index 445e7bc..db87dc9 100644 --- a/wani.py +++ b/wani.py @@ -1054,7 +1054,7 @@ class Formatter: pass -class OutFormatter(Formatter): +class OutNoStatFormatter(Formatter): def additional_init(self): self.representation = "" @@ -1180,6 +1180,34 @@ class StatsFormatter(Formatter): def group(self): 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: @staticmethod