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

Improvements to dictionary matching #180

Merged
merged 3 commits into from
Mar 26, 2021
Merged

Conversation

frreiss
Copy link
Member

@frreiss frreiss commented Mar 10, 2021

This PR includes some fixes for issues with our dictionary matching that encountered while working on a market intelligence use case for a blog post.

The specific problems addressed here are:

  • There was no API for creating a dictionary from an in-memory list, so I've added a new function create_dict().
  • SpaCy's default set tokenizers tend to overthink how they treat punctuation, which leads to dictionary entries getting tokenized differently from text, which messes up dictionary matching. So I've added a function simple_tokenizer() that returns a tokenizer that splits on every chunk of whitespace and on every punctuation character. Dictionary creation uses that tokenizer by default now.

I also fixed a minor bug in the handling of the warnings element of responses from Watson Natural Language Understanding.

@frreiss
Copy link
Member Author

frreiss commented Mar 24, 2021

@BryanCutler would you mind giving these changes a quick review?

Thanks!

@BryanCutler
Copy link
Member

Sorry, slipped under the radar. Looking at it now.

Copy link
Member

@BryanCutler BryanCutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple nit questions, otherwise LGTM

text_extensions_for_pandas/spanner/extract.py Show resolved Hide resolved
text_extensions_for_pandas/spanner/extract.py Outdated Show resolved Hide resolved
@frreiss
Copy link
Member Author

frreiss commented Mar 26, 2021

Thanks for the review! Pushed some corrections. Will merge once this branch passes tests.

@frreiss frreiss merged commit fdf40e0 into CODAIT:master Mar 26, 2021
@frreiss frreiss deleted the branch-dict branch October 29, 2021 20:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants