Added checking for zero depth in lch_similarity #421

Merged
merged 1 commit into from Jun 24, 2013

Conversation

Projects
None yet
2 participants
@michelleful
Contributor

michelleful commented Jun 22, 2013

lch_similarity method raises a ZeroDivisionError when a synset has no hypernyms, since LCH distance is -log(p/2d), so when d == 0, it throws a ZeroDivisionError.

I added checking for when depth == 0 and had the function return None in this case, as LCH similarity is undefined in this instance.

@stevenbird

This comment has been minimized.

Show comment
Hide comment
@stevenbird

stevenbird Jun 22, 2013

Member

Thanks for this. But you also included wordnet.py~

Member

stevenbird commented Jun 22, 2013

Thanks for this. But you also included wordnet.py~

@michelleful

This comment has been minimized.

Show comment
Hide comment
@michelleful

michelleful Jun 23, 2013

Contributor

I've now deleted wordnet.py~

Contributor

michelleful commented Jun 23, 2013

I've now deleted wordnet.py~

@stevenbird

This comment has been minimized.

Show comment
Hide comment
@stevenbird

stevenbird Jun 24, 2013

Member

Thanks.

Member

stevenbird commented Jun 24, 2013

Thanks.

stevenbird added a commit that referenced this pull request Jun 24, 2013

Merge pull request #421 from michelleful/master
Added checking for zero depth in lch_similarity

@stevenbird stevenbird merged commit c78d9fa into nltk:master Jun 24, 2013

kruskod pushed a commit to kruskod/nltk that referenced this pull request Jul 15, 2015

Merge pull request #421 from michelleful/master
Added checking for zero depth in lch_similarity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment