Skip to main content

rules

pymusas.spacy_api.taggers.rules

[SOURCE]


spaCy registered functions for creating the following tagger rules:

And helper functions for the rules.

single_word_rule​

@spacy.util.registry.misc('pymusas.taggers.rules.SingleWordRule.v1')
def single_word_rule(
lexicon_collection: Dict[str, List[str]],
lemma_lexicon_collection: Dict[str, List[str]],
pos_mapper: Optional[Dict[str, List[str]]] = None
) -> SingleWordRule

pymusas.taggers.rules.SingleWordRule.v1 is a registered function under the @misc function register.

See the pymusas.taggers.rules.single_word.SingleWordRule for details on parameters to this function.

Returns¢​

mwe_rule​

@spacy.util.registry.misc('pymusas.taggers.rules.MWERule.v1')
def mwe_rule(
mwe_lexicon_lookup: Dict[str, List[str]],
pos_mapper: Optional[Dict[str, List[str]]] = None
) -> MWERule

pymusas.taggers.rules.MWERule.v1 is a registered function under the @misc function register.

See the pymusas.taggers.rules.mwe.MWERule for details on parameters to this function.

Returns¢​

rule_list​

@spacy.util.registry.misc('pymusas.taggers.rules.rule_list')
def rule_list(*rules: Rule) -> List[Rule]

pymusas.taggers.rules.rule_list is a registered function under the @misc function register. The function is required when wanting to create a List of rules within a config file. We found it not possible to specify a List of custom objects within a config file, but is possible when using variable position arguments, which this function accepts as input.

This function is most likely to be used when creating a pymusas.spacy_api.taggers.rule_based.RuleBasedTagger.

Parameters¢​

Returns¢​

  • List[Rule]