Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to filter rules #9

Open
versae opened this issue Jun 11, 2019 · 0 comments
Open

Add an option to filter rules #9

versae opened this issue Jun 11, 2019 · 0 comments

Comments

@versae
Copy link
Contributor

versae commented Jun 11, 2019

In some cases it might become handy to filter out some of the rules, e.g., ignoring prefixes, hence the need to add that option.

It could be in the form of a filter function, such as rules_exclude, or a parameter based on rule["kind"], so rules_kind could be either AFFIXES_PREFIX or AFFIXES_SUFFIX and filter out appropriately.

Right now the only way to achieve this is by loading the rules, doing the filtering, and passing the resulting filtered list to the AffixesMatcher constructor.

from spacy_affixes.utils import AFFIXES_SUFFIX, load_affixes                                                                                                                              

# Let's ignore all prefix rules
suffixes = {k: v for k, v in load_affixes().items()
                 if k.startswith(AFFIXES_SUFFIX)}                                                                                                                      
affixes_matcher = AffixesMatcher(nlp, split_on=["VERB"], rules=suffixes) 

Maybe both options would be good to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant