I played with transformers, a natural language library. https://huggingface.co/transformers/main_classes/pipelines.html https://github.com/huggingface/transformers
When I entered "I am happy", it was output as positive.
$pip install -q transformers
str = "I am happy"
nlp_sentence_classif(str)
[{'label': 'POSITIVE', 'score': 0.9998802}]
You can also answer questions. When I ask "What do you like?" To the sentence "I am a student who likes computer science.", "Computer science" is returned.
nlp = pipeline('question-answering')
nlp({
'question': 'What do you like?',
'context': 'I am a student who likes computer science.'
})
{'answer': 'computer science.',
'end': 41,
'score': 0.978939160814079,
'start': 25}
Sounds good.
I couldn't find out what model this library uses by default. (~ _ ~ Me)