def test_text_line_atf_gloss() -> None:
    line = TextLine.of_iterable(
        LINE_NUMBER,
        [
            DocumentOrientedGloss.open(),
            Word.of([Reading.of_name("mu")]),
            Word.of([Reading.of_name("bu")]),
            DocumentOrientedGloss.close(),
        ],
    )
    assert line.atf == f"{line.line_number.atf} {{(mu bu)}}"
 def ebl_atf_text_line__close_document_oriented_gloss(self, _):
     return DocumentOrientedGloss.close()
 def ebl_atf_text_line__open_document_oriented_gloss(self, _):
     return DocumentOrientedGloss.open()
from ebl.transliteration.domain.tokens import (
    Column,
    CommentaryProtocol,
    ErasureState,
    Joiner,
    LanguageShift,
    Tabulation,
    UnknownNumberOfSigns,
    ValueToken,
    Variant,
)

TOKENS = [
    UnknownNumberOfSigns(frozenset({EnclosureType.BROKEN_AWAY}), ErasureState.NONE),
    LanguageShift.of("%sux"),
    DocumentOrientedGloss.open(),
]


def test_value_token():
    value = "value"
    token = ValueToken.of(value)
    equal = ValueToken.of(value)
    other = ValueToken.of("anothervalue")

    assert token.value == value
    assert token.clean_value == value
    assert token.get_key() == f"ValueToken⁝{value}"
    assert token.lemmatizable is False

    serialized = {"type": "ValueToken"}
Пример #5
0
 def make_token(self, data, **kwargs):
     return (
         DocumentOrientedGloss.of(data["side"])
         .set_enclosure_type(frozenset(data["enclosure_type"]))
         .set_erasure(data["erasure"])
     )
                     Joiner.dot(),
                     Number.of_name("15"),
                     Joiner.dot(),
                     Logogram.of_name("KAM", 2),
                 ]),
             ),
         ),
     ],
 ),
 (
     "1. {(he-pi₂ eš-šu₂)}\n2. {(NU SUR)}",
     [
         TextLine.of_iterable(
             LineNumber(1),
             (
                 DocumentOrientedGloss.open(),
                 Word.of(parts=[
                     Reading.of_name("he"),
                     Joiner.hyphen(),
                     Reading.of_name("pi", 2),
                 ]),
                 Word.of(parts=[
                     Reading.of_name("eš"),
                     Joiner.hyphen(),
                     Reading.of_name("šu", 2),
                 ]),
                 DocumentOrientedGloss.close(),
             ),
         ),
         TextLine.of_iterable(
             LineNumber(2),
         "displayValue": "2-4 lines missing",
     },
 ),
 (
     ControlLine("#", " comment"),
     {
         "type": "ControlLine",
         "prefix": "#",
         "content": [OneOfTokenSchema().dump(ValueToken.of(" comment"))],
     },
 ),
 (
     TextLine.of_iterable(
         LineNumber(1),
         (
             DocumentOrientedGloss.open(),
             Word.of([Reading.of_name("bu")]),
             LoneDeterminative.of([Determinative.of([Reading.of_name("d")])]),
             DocumentOrientedGloss.close(),
         ),
     ),
     {
         "type": "TextLine",
         "prefix": "1.",
         "lineNumber": OneOfLineNumberSchema().dump(LineNumber(1)),
         "content": OneOfTokenSchema().dump(
             [
                 DocumentOrientedGloss.open(),
                 Word.of(
                     [
                         Reading.of(