kazu.steps.ner.entity_post_processing

Classes

NonContiguousEntitySplitter

Some simple rules to split non-contiguous entities into component entities.

SplitOnConjunctionPattern

SplitOnNumericalListPatternWithPrefix

split a string of numerically incrementing parts:

class kazu.steps.ner.entity_post_processing.NonContiguousEntitySplitter[source]

Bases: object

Some simple rules to split non-contiguous entities into component entities.

__call__(entity, text)[source]

Call self as a function.

Parameters:
Return type:

list[Entity]

__init__(entity_conditions)[source]
Parameters:

entity_conditions (dict[str, list[Callable[[Entity, str], list[Entity]]]])

class kazu.steps.ner.entity_post_processing.SplitOnConjunctionPattern[source]

Bases: object

__call__(entity, text)[source]

Call self as a function.

Parameters:
Return type:

list[Entity]

__init__(path)[source]

Analyse.

Parameters:
  • pattern

  • path (str)

run_conjunction_rules(doc, entity, text)[source]
Parameters:
Return type:

list[Entity]

class kazu.steps.ner.entity_post_processing.SplitOnNumericalListPatternWithPrefix[source]

Bases: object

split a string of numerically incrementing parts:

splitter = SplitOnNumericalListPatternWithPrefix()
ent = Entity.load_contiguous_entity(
    start=0, end=8, namespace="test", entity_class="gene", match="BRCA1/2/3"
)
print(splitter(ent, "BRCA1/2/3 are oncogenes"))
[BRCA1:gene:test:0:5, BRCA2:gene:test:0:7, BRCA3:gene:test:0:9]
__call__(entity, text)[source]

Call self as a function.

Parameters:
Return type:

list[Entity]

__init__(pattern='/')[source]

Pattern to split the string on (typically “/”)

Parameters:

pattern (str)