clips / clips/pattern

Attribute error in similarity method

Open
#172 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

review
Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

The following code give me a {AttributeError}'NoneType' object has no attribute 'ic':

wordnet.synsets("next", "JJ")[0].similarity(wordnet.synsets("following", "JJ")[0])

This is because the ancestor method can return a None value.
What's the fix? Should the similarity between 2 synsets without common ancestor be 0.0?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the expression using wordnet.synsets(...)[0].similarity(...) and inspect the ancestor and similarity methods that produce the AttributeError. Determine the expected behavior when two synsets have no common ancestor, then add regression coverage for that case and verify the existing similarity behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.