Skip to main content
Version: 2.0

Sentence

The API output is divided into three levels. The second level of return is the Sentence level. Within the Sentence Object you will find the following return below.

Check out the Document and Details level to see the full list of objects.

Sentence Object

KeyTypeDescription
source_purestringthe TRUE source
sourcestringsource of raw input
sentence_indexesintegerindex start and end of the first and last character of the sentence
emotionEmotions Objectactual
sentimentSentiment Objectactual
ML sentimentintegeractual
ML emotionstringactual
nerNER Objectactual (combines NER & ML_NER)
sentence_typestringsentence type
subsentencesintegerindex relative to the current sentence

Sentence Format

input: 'The package was delivered on Tuesday.'

output :

'sentences' : {

‘source_pure’ : ‘The package was delivered on Tuesday.
'source': ‘The package was delivered on Tuesday.
‘sentence_indexes’ : [0, 3]
‘emotion’ : []
‘sentiment’ : [{'positive': 0, 'negative': 0, 'total': 0}]
'ML_sentiment et ML_emotion': [0], [[('remorse', 1)]]
‘ner’ : [{}, {}, {}, {}, {'type': ['date'], 'value': {'ISO': '2022-01-18', 'formatted': 'Tuesday 18 January 2022 00:00:00', 'timestamp': 1642464000, 'chronology': 'future', 'chronology_day': 1, 'confidence': 0.99}}, {}]
‘sentence_type’ : "assert"
‘subsentences’ : [{"start_id": 0, "end_id": 5}]

source_pure

KeyTypeDescription
source_purestringthe TRUE source

source

KeyTypeDescription
sourcestringsource of raw input

Sentence indexes

KeyTypeDescription
sentence_indexesintegerindex start and end of the first and last character of the sentence

Emotion

Emotion Value Object

KEYTYPEDESCRIPTIONCONSTRAINTS
happinessfloatnormalized total0 <= happiness < 1
sadnessfloatnormalized total0 <= sadness < 1
angerfloatnormalized total-1 < anger < 1
surprisefloatnormalized total-1 < surprise < 1
disgustfloatnormalized total-1 < disgust < 1
fearfloatnormalized total-1 < fear < 1

Values are calculated by using emotion elements objects. Values are normalized to stay in the the [-1 : 1] interval between element, subsentence and sentence level therefore comparisons should be made made with elements of the same depth.

Sentiment

Sentiment Value Object

KEYTYPEDESCRIPTIONCONSTRAINTS
positivefloatnormalized addition of all positive sentiment values in the sentence0 <= positive < 1
negativefloatnormalized addition of all negative sentiment values in the sentence-1 < negative <= 0
totalfloatpositive + negative-1 < total < 1

Values are calculated either by using sentiment elements objects if available, or by a prediction model at the subsentence level. Values are normalized to stay in the the [-1 : 1] interval between element, subsentence and sentence level therefore comparisons should be made made with elements of the same depth.

Ml_sentiment

ML Sentiment Object

KEYTYPEDESCRIPTION
sentencelist of Sentences ML Sentiment ObjectSource of all sentiments elements divided by subsentences
subsentencelist of Subsentences ML Sentiment ObjectSource of all sentiments elements divided by subsentences

ml_sentiment values are available at the following levels of granularity: sentence and subsentence

For a demo of ML_sentiment check out our tutorial 👨🏻‍💻

ML_emotion

ML emotion is a multilabel model that returns the emotions expressed in a sentence or subsentence. The model is composed by multiple adapters trained on diverses datasets, then fine-tuned on original goemotion dataset and its french translation. "value"'s value is always 1, since it's float value is not relevant on this task.

EmotionDescription
neutralNo particular emotion in this sentence.
admirationFinding something impressive or worthy of respect.
amusementFinding something funny or being entertained.
angerA strong feeling of displeasure or antagonism.
annoyanceMild anger irritation.
approvalHaving or expressing a favorable opinion.
caringDisplaying kindness and concern for others.
confusionLack of understanding uncertainty.
curiosityA strong desire to know or learn something.
desireA strong feeling of wanting something or wishing for something to happen.
disappointmentSadness or displeasure caused by the nonfulfillment of one’s hopes or expectations.
disapprovalHaving or expressing an unfavorable opinion.
disgustRevulsion or strong disapproval aroused by something unpleasant or offensive.
embarrassmentSelf-consciousness shame or awkwardness.
excitementFeeling of great enthusiasm and eagerness.
fearBeing afraid or worried.
gratitudeA feeling of thankfulness and appreciation.
griefIntense sorrow especially caused by someone’s death.
joyA feeling of pleasure and happiness.
loveA strong positive emotion of regard and affection.
nervousnessApprehension worry anxiety.
optimismHopefulness and confidence about the future or the success of something.
pridePleasure or satisfaction due to ones own achievements or the achievements of those with whom one is closely associated.
realizationBecoming aware of something.
reliefReassurance and relaxation following release from anxiety or distress.
remorseRegret or guilty feeling.
sadnessEmotional pain sorrow.
surpriseFeeling astonished startled by something unexpected.

Main data source : @misc{demszky2020goemotions, title={GoEmotions: A Dataset of Fine-Grained Emotions}, author={Dorottya Demszky and Dana Movshovitz-Attias and Jeongwoo Ko and Alan Cowen and Gaurav Nemade and Sujith Ravi}, year={2020}, eprint={2005.00547}, archivePrefix={arXiv}, primaryClass={cs.CL} } Adapters models: @inproceedings{pfeiffer2020AdapterHub, title={AdapterHub: A Framework for Adapting Transformers}, author={Jonas Pfeiffer and Andreas R\"uckl\'{e} and Clifton Poth and Aishwarya Kamath and Ivan Vuli\'{c} and Sebastian Ruder and Kyunghyun Cho and Iryna Gurevych}, booktitle={Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP 2020): Systems Demonstrations}, year={2020}, address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2020.emnlp-demos.7", pages = "46--54", }

For a demo of ML_emotion check out our tutorial 👨🏻‍💻

NER

The NER sub-api lists all the Numeral Entities and Named Entities found in the sentence.

KEYTYPEDESCRIPTIONCONSTRAINTS
sourcestring--
typestringDescribes the type of entity foundFor proper nouns, can either be LOCATION or PERSON. For other entities, see Entity types
valueValue Object--

For a demo of NER check out our tutorial 👨🏻‍💻

Sentence Type

Sentence Acts Object

KEYTYPEDESCRIPTION
predictstringType chosen by the algorithm.

Sentence Acts Details Object

KEYTYPEDESCRIPTIONEXAMPLE
assertfloatProbability that the sentence is an assertion."I am a developer."
commandfloatProbability that the sentence is a command."Give me a response."
question_openfloatProbability that the sentence is an open-ended question."What is the best solution of NLP in French?"
question_ynfloatProbability that the sentence is a close-ended question."Do you have a question?"

For a demo of sentence type check out our tutorial 👨🏻‍💻

Subsentences

KEYTYPEDESCRIPTION
start_idintId of the first token of the subsentence
end_idintId of the last token of the subsentence