Similarity

Report a typo

There is a code that helps compute the similarity of two words. Unfortunately, one line is absent. Find out what line should be produced, and print it in the box.

import spacy


en_lg_model = spacy.load("en_core_web_lg")
text = "Cat is a pet."
for token1 in doc:
    for token2 in doc:
        print(token1.text, token2.text, token1.similarity(token2))

Tip: We have a variable with our sentence, but where is the doc-object?

Enter a short text
___

Create a free account to access the full topic