🚧 dinglehopper: WIP data structure for extracted text

pull/38/head
Gerber, Mike 5 years ago
parent 534e042f9e
commit 8435d88419

@ -4,14 +4,14 @@ import enum
# TODO handle grapheme cluster positions?
# TODO Use type annotations for attr.ib types when support for Python 3.5 is dropped
# TODO types are not validated (attr does not do this yet)
@attr.s(frozen=True)
class ExtractedText:
segments = attr.ib()
joiner = attr.ib(type=str)
# XXX Use type annotations for attr types when support for Python 3.5 is dropped
# XXX Also I think these are not validated?
@property
def text(self):

@ -6,7 +6,7 @@ from extracted_text import ExtractedText, ExtractedTextSegment
def test_text():
test1 = ExtractedText([
ExtractedTextSegment('s0', 'foo'),
ExtractedTextSegment(1, 'bar'),
ExtractedTextSegment('s1', 'bar'),
ExtractedTextSegment('s2', 'bazinga')
], ' ')

Loading…
Cancel
Save