RoutingRule#
- class scikitplot.corpus.RoutingRule(shape, legs, phrases=(), matcher=None)[source]#
One shape: the words that reveal it and the evidence paths it needs.
- Parameters:
- shapestr or QueryShape
Shape name,
[a-z][a-z0-9_]{0,63}.- legsiterable of LegKind
Paths the shape needs, added by
routewhen available.- phrasesiterable of str, default=()
Words or phrases (lowercase, single spaces) any one of which reveals the shape.
- matchercallable or None, default=None
matcher(tokens) -> bool, for what phrases cannot say (a year, a number). The shape is detected if a phrase or the matcher matches.
- Raises:
- TypeError
If a field has the wrong type.
- ValueError
If the shape name or a phrase is malformed, or the rule has neither phrases nor a matcher.
- Parameters:
- matches(tokens)[source]#
Return whether the query, as
query_tokens, has this shape.