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

Focus score #5

Open
rhear0yishere opened this issue Feb 27, 2023 · 2 comments
Open

Focus score #5

rhear0yishere opened this issue Feb 27, 2023 · 2 comments

Comments

@rhear0yishere
Copy link

Focus score does not seem to be changing from 0, no matter what the candidate texts are.

It seems like it never runs this:
score.append(1.0 / (1.0 + math.exp(-sim + 7))) # score.append(1.0 / (1.0 + math.exp(-doc1.similarity(doc2) + 7)))
When trying to run on its own, I get the error: 'SpacySimilarityHook' object has no attribute 'similarity'

@WanzhengZhu
Copy link
Owner

Maybe it is the package version problem? Can you try using the package version from the requirement.txt?

@meng-wenlong
Copy link

The error occurs because the SimilarityHook function returns a SpacySimilarityHook object. It should return a doc object. SpacySimilarityHook needs to be initialized first and then called. I guess the code in compute_sentence_similarity() should be:

nlp = spacy.load('en_core_web_md')

similarity_hook = WMD.SpacySimilarityHook(nlp)

@Language.component("simhook")
def SimilarityHook(doc):
    return similarity_hook(doc)

nlp.add_pipe('simhook', last=True)

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

3 participants