Skip to content

Commit

Permalink
feat(Fragment): add ocredSigns field
Browse files Browse the repository at this point in the history
  • Loading branch information
Vas9ka committed Sep 3, 2024
1 parent a2d9298 commit 90ea429
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions ebl/fragmentarium/application/fragment_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class FragmentSchema(Schema):
ScopeField(),
data_key="authorizedScopes",
)
ocr_signs = fields.String(load_default="", data_key="ocredSigns")
introduction = fields.Nested(IntroductionSchema, default=Introduction())
script = fields.Nested(ScriptSchema, load_default=Script())
external_numbers = fields.Nested(
Expand Down
1 change: 1 addition & 0 deletions ebl/fragmentarium/domain/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class Fragment:
folios: Folios = Folios()
text: Text = Text()
signs: str = ""
ocr_signs: str = ""
notes: Notes = Notes()
references: Sequence[Reference] = ()
uncurated_references: Optional[Sequence[UncuratedReference]] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def update_field(self, field, fragment):
"authorized_scopes": [
"authorized_scopes",
],
"ocredSigns": ("ocredSigns"),
}

if field not in fields_to_update:
Expand Down
3 changes: 2 additions & 1 deletion ebl/tests/alignment/test_named_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ebl.tests.factories.fragment import FragmentFactory

signs = "X X ABZ001\nABZ002\nX X X\n"
ocr_signs = ""
sequence = Sequence(["ABZ001", "#", "ABZ002", "#", "#"])


Expand All @@ -18,7 +19,7 @@ def test_of_signs() -> None:

def test_of_fragment() -> None:
vocabulary = Vocabulary()
fragment = FragmentFactory.build(signs=signs)
fragment = FragmentFactory.build(signs=signs, ocr_signs=ocr_signs)
named = NamedSequence.of_fragment(fragment, vocabulary)

assert named.name == str(fragment.number)
Expand Down
2 changes: 2 additions & 0 deletions ebl/tests/factories/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class Meta:
projects = (ResearchProject.CAIC,)
archaeology = factory.SubFactory(ArchaeologyFactory)
colophon = factory.SubFactory(ColophonFactory)
ocr_signs = "ABZ10 X"


class InterestingFragmentFactory(FragmentFactory):
Expand Down Expand Up @@ -454,6 +455,7 @@ class TransliteratedFragmentFactory(FragmentFactory):
"X MU TA MA UD\n"
"ŠU/|BI×IS|"
)
ocr_signs = "ABZ10 X"
folios = Folios((Folio("WGL", "3"), Folio("ARG", "3")))
record = Record((RecordEntry("test", RecordType.TRANSLITERATION),))
line_to_vec = (
Expand Down
1 change: 1 addition & 0 deletions ebl/tests/fragmentarium/test_dtos.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def expected_dto(lemmatized_fragment, has_photo):
"archaeology": ArchaeologySchema().dump(lemmatized_fragment.archaeology),
"colophon": ColophonSchema().dump(lemmatized_fragment.colophon),
"authorizedScopes": [],
"ocredSigns": "ABZ10 X",
},
pydash.is_none,
)
Expand Down
1 change: 1 addition & 0 deletions ebl/tests/fragmentarium/test_fragment_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
)
),
signs="MI DIŠ DIŠ UD ŠU",
ocr_signs="",
)


Expand Down

0 comments on commit 90ea429

Please sign in to comment.