Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created September 23, 2021 15:27
Show Gist options
  • Save davidmezzetti/633a0cdff82ddce4bde5b198b63b2645 to your computer and use it in GitHub Desktop.
Save davidmezzetti/633a0cdff82ddce4bde5b198b63b2645 to your computer and use it in GitHub Desktop.
from txtai.pipeline import Similarity
# Use default sentiment analysis model
similarity = Similarity(dynamic=False)
# Query with label text
similarity("positive", ["I am happy", "I am mad"])
# Query with label id
similarity("1", ["I am happy", "I am mad"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment