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

Remove unnecessary if-statement #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Remove unnecessary if-statement #29

wants to merge 1 commit into from

Conversation

Simsso
Copy link

@Simsso Simsso commented Jun 5, 2019

The if statement if (word == -1) continue; will never evaluate to true because when filling the sen array, words with id -1 are already being discarded by this check a few lines above.

I suggest to remove the if-statement because it is misleading and if it every evaluated to true, it would do so in the next iteration again (because sentence_position would not change) and the program would be in an infinite loop.

The if statement `if (word == -1) continue;` will never evaluate to `true` because when filling the `sen` array, words with id `-1` are already being discarded by [this](https://github.com/dav/word2vec/blob/0f29b188b17145d0c1d0953ba0bc80a2208dd8a0/src/word2vec.c#L413) check a few lines above.

I suggest to remove the if-statement because it is misleading and if it every evaluated to `true`, it would do so in the next iteration again (because `sentence_position` would not change) and the program would be in an infinite loop.
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.

1 participant