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

Find word from document in word list containing word roots #53

Open
NelsonPython opened this issue Jul 3, 2019 · 0 comments
Open

Find word from document in word list containing word roots #53

NelsonPython opened this issue Jul 3, 2019 · 0 comments

Comments

@NelsonPython
Copy link
Contributor

The original detector attempted to find a word in a list of words. But the list of words often had the root, for example "compet" is in the list. The word from the document is "competition". "Competition" is longer than "compet" so you cannot find "competition" in "compet". But you can find "compet" in "competition".

This is a code snippet that worked for me:

    found = False
    for word, start, stop in token_indices:
    # NELSON - changed loop so word can be found in GENDERED_WORDS
        if word.lower() in GENDERED_WORDS:
            found = True
            report.add_flag(
                    Flag(start, stop, Issue(
                        "{word}".format(word=word)
                        ))
            )
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