Skip to content

Conversation

@thalishsajeed
Copy link
Contributor

@thalishsajeed thalishsajeed commented Feb 7, 2021

Fixes #3031

This PR -

  • Replaces defaultdict with dict in phrases.py to avoid the Runtime error caused when defaultdict modifies its contents during runtime each time it encounters an out of vocabulary token.
  • Adds test cases to check for above bug

@thalishsajeed
Copy link
Contributor Author

@piskvorky Hi, hope I've done everything right this time :) Thank you for all the help!

@piskvorky
Copy link
Owner

piskvorky commented Feb 7, 2021

Use a better PR title and motivation in the description please.

And also link from here to the previous PR, where most of the discussion and review happened.

Copy link
Owner

@piskvorky piskvorky left a comment

Choose a reason for hiding this comment

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

Changes look good, thanks! But fix the PR title + description please. We use those to generate Release Notes, and auto-close affected tickets on merge.

@thalishsajeed thalishsajeed changed the title Fix #3031 Replace defaultdict with dict in phrases.py to fix Runtime error in while using export_phrases() Feb 7, 2021
@thalishsajeed thalishsajeed changed the title Replace defaultdict with dict in phrases.py to fix Runtime error in while using export_phrases() Replace defaultdict with dict in phrases.py to fix Runtime error while using export_phrases() Feb 9, 2021
@mpenkov mpenkov changed the title Replace defaultdict with dict in phrases.py to fix Runtime error while using export_phrases() fix RuntimeError in export_phrases (change defaultdict to dict) Feb 13, 2021
@mpenkov
Copy link
Collaborator

mpenkov commented Feb 13, 2021

Merged. Thank you @thalishsajeed and congrats on your first contribution to gensim!

@mpenkov mpenkov merged commit cfc9e95 into piskvorky:develop Feb 13, 2021
@thalishsajeed
Copy link
Contributor Author

@mpenkov Thank you! :) Looking forward to gensim 4.0

@piskvorky piskvorky changed the title fix RuntimeError in export_phrases (change defaultdict to dict) Fix RuntimeError in export_phrases (change defaultdict to dict) Mar 21, 2021
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.

Runtime error in phrases.py

3 participants