Skip to content

Commit

Permalink
Update & fix (WiP)
Browse files Browse the repository at this point in the history
  • Loading branch information
khoidt committed Dec 12, 2024
1 parent e13f696 commit f2d5132
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 15 deletions.
3 changes: 3 additions & 0 deletions ebl/transliteration/domain/at_line_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
18 changes: 9 additions & 9 deletions ebl/transliteration/domain/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,22 @@ 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 [
"ebl_atf_parallel_line",
"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}",
Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions ebl/transliteration/domain/line_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class LineTransformer(
ParallelLineTransformer,
TranslationLineTransformer,
):
def __init__(self):
super(AtLineTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be LineTransformer.
super(DollarLineTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be LineTransformer.
super(NoteLineTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be LineTransformer.
super(ParallelLineTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be LineTransformer.
super(TranslationLineTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be LineTransformer.

def empty_line(self, _):
return EmptyLine()

Expand Down
4 changes: 4 additions & 0 deletions ebl/transliteration/domain/note_line_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@ def ebl_atf_note_line__url(self, children) -> str:


class NoteLineTransformer(MarkupTransformer):

def __init__(self):
super(MarkupTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be NoteLineTransformer.

def note_line(self, children: Sequence[MarkupPart]) -> NoteLine:
return NoteLine(children)
11 changes: 6 additions & 5 deletions ebl/transliteration/domain/text_line_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
26 changes: 25 additions & 1 deletion ebl/transliteration/domain/translation_line_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be TranslationLineTransformer.
super(MarkupTransformer, self).__init__()

Check failure

Code scanning / CodeQL

First argument to super() is not enclosing class Error

First argument to super() should be TranslationLineTransformer.

@v_args(inline=True)
def translation_line(
self, language, extent, *markup: MarkupPart
Expand All @@ -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
)

0 comments on commit f2d5132

Please sign in to comment.