Utilities¶
- class pie_extended.utils.Metadata(title, lang, authors, description, link)¶
Bases:
tuple- authors¶
Alias for field number 2
- description¶
Alias for field number 3
- lang¶
Alias for field number 1
- link¶
Alias for field number 4
- title¶
Alias for field number 0
- class pie_extended.utils.ObjectCreator(cls, *args, **kwargs)[source]¶
Bases:
objectSome objects should be reset everytime a new tagging is done. To make this easier we provide this class that keeps in memory the initialization parameters.
- pie_extended.utils.roman_number(inp)[source]¶
Source: https://stackoverflow.com/questions/19308177/converting-roman-numerals-to-integers-in-python Author: https://stackoverflow.com/users/1201737/r366y :param num: :return:
>>> roman_number("XXIV") 24
- Parameters:
inp (str)
- Return type:
int
Testing without models¶
- class pie_extended.testing_utils.FakeTagger(tokens, tasks)[source]¶
Bases:
ExtensibleTagger
- class pie_extended.testing_utils.FakeAutoTag(tasks, **kwargs)[source]¶
Bases:
ExtensibleTagger- Parameters:
tasks (List[str])
- tag(sents, lengths, *args, **kwargs)[source]¶
Fake tagging tokens by enumerating informations
>>> tagger = FakeAutoTag(["pos", "lemma"]) >>> tagger.tag([['a', 'b'], ['c']], lengths=[2, 1]) ([[('a', ('pos0', 'lemma0')), ('b', ('pos1', 'lemma1'))], [('c', ('pos2', 'lemma2'))]], ['pos', 'lemma'])
- Parameters:
sents (List[List[str]])
lengths (List[int])
- pie_extended.testing_utils.create_auto_tagger(module, **kwargs)[source]¶
Create a tagger as well as the iterator
- Return type:
Tuple[FakeAutoTag, DataIterator, ProcessorPrototype]