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 #45

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

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 words with when filling the `sen` array, words with id `-1` are already being discarded by [this](https://github.com/tmikolov/word2vec/blob/master/word2vec.c#L404) 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