PairedTextFilterConfig
Group of paired targets: one word per class in every pair, one class per tuple position (e.g. British/American spelling).
Use it in TextPredictionDataCreator.feature_targets instead of one :class:TextFilterConfig per class.
Every pair lists one word per class; the creator adds the other word of the pair as an extra column
for each matched word, so every training row carries its explicit alternative.
pairs is a list of tuples together with ids (one class id per tuple position), or a dict
{class_id: [words]} of aligned lists (ids then comes from the keys). Several groups with the same
ids extend the same classes, e.g. one group per part of speech. A sentence with several different words
of the same class is skipped, because a row has only one alternative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
Union[Sequence[Sequence[str]], Dict[str, Sequence[str]]]
|
List of tuples (one word per class) or dict of aligned word lists. |
required |
ids
|
Optional[Sequence[str]]
|
Class ids for the tuple positions; omit for dict |
None
|
**filter_options
|
Any
|
Passed to :class: |
{}
|
Example
PairedTextFilterConfig(pairs=[("colour", "color"), ("centre", "center")], ids=("BE", "AE"),
spacy_tags={"pos": "NOUN"})
Source code in gradiend/data/text/filter_config.py
__repr__
to_configs
Return one ordinary :class:TextFilterConfig per class id.