Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat-fragment_field_ocr #573

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading