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

similarity_score function #1

Open
ghost opened this issue Oct 10, 2017 · 0 comments
Open

similarity_score function #1

ghost opened this issue Oct 10, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 10, 2017

def similarity_score(s1, s2):
    largest = []
    for item1 in s1:
        max = 0
        for item2 in s2:
            similarity = wn.wup_similarity(item1, item2)
            print(similarity)
            if similarity:
                if similarity > max:
                    max = similarity
        largest.append(max)
        max = 0
    score = sum(largest) / len(largest)
    return score

I tried to write like this, but when I compute like this,

    synset1 = doc_to_synsets('I like cats')
    synset2 = doc_to_synsets('I like dogs')
    res = similarity_score(synset1, synset2)

the res is 0.9285714285714286, isn't right ,do you have any ideas how to solve this question?

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

No branches or pull requests

0 participants