diff --git a/ebl/transliteration/domain/at_line_transformer.py b/ebl/transliteration/domain/at_line_transformer.py index 6bef9d5de..7043e5955 100644 --- a/ebl/transliteration/domain/at_line_transformer.py +++ b/ebl/transliteration/domain/at_line_transformer.py @@ -28,6 +28,9 @@ class ObjectData: class AtLineTransformer(LabelTransformer): + def __init__(self): + super().__init__() + def ebl_atf_at_line__free_text(self, content): return "".join(content) diff --git a/ebl/transliteration/domain/labels.py b/ebl/transliteration/domain/labels.py index 8d1c2bdac..b46e78962 100644 --- a/ebl/transliteration/domain/labels.py +++ b/ebl/transliteration/domain/labels.py @@ -170,10 +170,9 @@ def to_atf(self) -> str: class LabelTransformer(Transformer): def __init__(self): - # ToDo: Fix. This method appereatly is not being called - input("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") - for method in [method for method in dir(self) if "ebl_atf_common" in method]: - self.set_methods(method.replace("ebl_atf_common__", "")) + methods = [method for method in dir(self) if "ebl_atf_common" in method] + for method in methods: + self.set_methods(method) def set_methods(self, method: str) -> None: for prefix in [ @@ -181,8 +180,12 @@ def set_methods(self, method: str) -> None: "ebl_atf_at_line", "ebl_atf_translation_line", ]: - print(f"{prefix}__{method}") - input() + _method = method.replace("ebl_atf_common__", "") + setattr( + self, + f"{prefix}__{_method}", + getattr(self, method), + ) setattr( self, f"{prefix}__{method}", @@ -196,15 +199,12 @@ def ebl_atf_common__labels(self, children) -> Sequence[Label]: def ebl_atf_common__column_label( self, numeral: Token, status: Sequence[Status] ) -> ColumnLabel: - print(numeral, status) - input() return ColumnLabel.from_label(numeral, status) # pyre-ignore[6] @v_args(inline=True) def ebl_atf_common__surface_label( self, surface: Token, status: Sequence[Status] ) -> SurfaceLabel: - input("SURFACE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") return SurfaceLabel.from_label( Surface.from_label(surface), # pyre-ignore[6] status, diff --git a/ebl/transliteration/domain/line_transformer.py b/ebl/transliteration/domain/line_transformer.py index f210c82dc..385de87be 100644 --- a/ebl/transliteration/domain/line_transformer.py +++ b/ebl/transliteration/domain/line_transformer.py @@ -18,6 +18,13 @@ class LineTransformer( ParallelLineTransformer, TranslationLineTransformer, ): + def __init__(self): + super(AtLineTransformer, self).__init__() + super(DollarLineTransformer, self).__init__() + super(NoteLineTransformer, self).__init__() + super(ParallelLineTransformer, self).__init__() + super(TranslationLineTransformer, self).__init__() + def empty_line(self, _): return EmptyLine() diff --git a/ebl/transliteration/domain/note_line_transformer.py b/ebl/transliteration/domain/note_line_transformer.py index b90874b20..5a247abe0 100644 --- a/ebl/transliteration/domain/note_line_transformer.py +++ b/ebl/transliteration/domain/note_line_transformer.py @@ -65,5 +65,9 @@ def ebl_atf_note_line__url(self, children) -> str: class NoteLineTransformer(MarkupTransformer): + + def __init__(self): + super(MarkupTransformer, self).__init__() + def note_line(self, children: Sequence[MarkupPart]) -> NoteLine: return NoteLine(children) diff --git a/ebl/transliteration/domain/text_line_transformer.py b/ebl/transliteration/domain/text_line_transformer.py index f0523e90f..a9b7c7d96 100644 --- a/ebl/transliteration/domain/text_line_transformer.py +++ b/ebl/transliteration/domain/text_line_transformer.py @@ -134,11 +134,12 @@ class TextLineTransformer( def __init__(self): for method in [method for method in dir(self) if "ebl_atf_text_line" in method]: _method = method.replace("ebl_atf_text_line", "") - setattr( - self, - f"ebl_atf_parallel_line{_method}", - getattr(self, method), - ) + for prefix in ["ebl_atf_parallel_line", "ebl_atf_translation_line"]: + setattr( + self, + f"{prefix}{_method}", + getattr(self, method), + ) @v_args(inline=True) def text_line(self, line_number, content): diff --git a/ebl/transliteration/domain/translation_line_transformer.py b/ebl/transliteration/domain/translation_line_transformer.py index c91b1c7ef..501a0db03 100644 --- a/ebl/transliteration/domain/translation_line_transformer.py +++ b/ebl/transliteration/domain/translation_line_transformer.py @@ -4,9 +4,16 @@ from ebl.transliteration.domain.markup import MarkupPart from ebl.transliteration.domain.note_line_transformer import MarkupTransformer from ebl.transliteration.domain.translation_line import Extent, TranslationLine +from ebl.transliteration.domain.line_number import ( + LineNumber, +) class TranslationLineTransformer(LabelTransformer, MarkupTransformer): + def __init__(self): + super(LabelTransformer, self).__init__() + super(MarkupTransformer, self).__init__() + @v_args(inline=True) def translation_line( self, language, extent, *markup: MarkupPart @@ -16,5 +23,22 @@ def translation_line( ) @v_args(inline=True) - def ebl_atf_text_line__translation_extent(self, labels, line_number) -> Extent: + def ebl_atf_translation_line__translation_extent( + self, labels, line_number + ) -> Extent: + print(labels, line_number) + input() + # ToDo: continue from here + # translation-expected_line4] (Tree('ebl_atf_translation_line__ebl_atf_common__surface_label', + # [Token('ebl_atf_translation_line__ebl_atf_common__OBVERSE', 'o'), Tree('ebl_atf_translation_line__ebl_atf_common__status', [])]), + # Tree('ebl_atf_translation_line__ebl_atf_common__column_label', [Token('ebl_atf_translation_line__ebl_atf_common__ROMAN_NUMERAL', 'iii'), + # Tree('ebl_atf_translation_line__ebl_atf_common__status', [])])) LineNumber(number=1, has_prime=False, prefix_modifier=None, suffix_modifier=None) return Extent(line_number, labels or ()) + + @v_args(inline=True) + def ebl_atf_translation_line__ebl_atf_common__single_line_number( + self, prefix_modifier, number, prime, suffix_modifier + ): + return LineNumber( + int(number), prime is not None, prefix_modifier, suffix_modifier + )