Exemplo n.º 1
0
def is_looks_like_reference(layout_block: LayoutBlock) -> bool:
    # a quick and dirty check whether this remotely looks like a reference
    return len(list(layout_block.iter_all_tokens())) > 3
Exemplo n.º 2
0
def get_label_by_layout_token_for_block(
        layout_block: LayoutBlock, label: str) -> Dict[LayoutTokenId, str]:
    return {
        id(layout_token): 'B-' + label if index == 0 else 'I-' + label
        for index, layout_token in enumerate(layout_block.iter_all_tokens())
    }