Request

Endpoint:

POST
https://api.meaningcloud.com/sentiment-2.1


If you are working with an on-premises installation, you will need to substitute api.meaningcloud.com by your own server address.

Content-Type:

multipart/form-data

Parameters:

NameDescriptionValuesNotes
keyAuthorization key for using MeaningCloud services. Create an account for free to create your key.Required
ofOutput format.json xmlOptional. Default:json
langLanguage of the text to analyze.See supported languages.Required. Use auto to perform language detection.
ilangLanguage in which the returned values will appear, if known. Check the response section to see which fields are affected.See supported languages.Optional. If not specified, the language set in lang will be used.
txtText to analyzeUTF-8 encoded text (plain text, HTML or XML).Use only one
urlURL of the document to analyze. Non-authenticated HTTP(s) and FTP supported. See supported formats.
docInput file with the content to analyze. See supported formats.
txtfThe text format parameter specifies if the text included in the txt parameter uses markup language that needs to be interpreted (known HTML tags and HTML code will be interpreted, and unknown tags will be ignored).plain
markup
Optional, default:plain
modelSentiment model to use.See models and language section.Optional, default: general.
verboseVerbose mode. When active, it shows additional information about the sentiment analysis specifically, it shows the changes applied to the basic polarity of the different polarity terms detected.y: enabled
n: disabled
Optional. Default: n
egpExpand global polarity. This mode allows you to choose between two different algorithms for the polarity detection of entities and concepts. Enabling the parameter gives less weight to the syntactic relationships, so it's recommended for short texts with unreliable typography.y: enabled
n: disabled
Optional. Default: n
rtThis parameter indicates how reliable the text to analyze is (as far as spelling, typography, etc. are concerned), and influences how strict the engine will be when it comes to take these factors into account in the analysis.y: enabled
u: enabled only for user dictionary
n: disabled
Optional. Default: n
uwDeal with unknown words. This feature adds a stage to the sentiment analysis in which the engine, much like a spellchecker, tries to find a suitable analysis to the unknown words resulted from the initial analysis assignment. It is specially useful to decrease the impact typos have in text analyses.y: enabled
n: disabled
Optional. Default: n
dmType of disambiguation applied. It is accumulative, that is, the semantic disambiguation mode will also include morphosyntactic disambiguation.n: no disambiguation
m: morphosyntactic disambiguation
s: semantic disambiguation
s
sdgSemantic disambiguation grouping. This parameter will only apply when semantic disambiguation is activated (dm=s). See disambiguation grouping for a more in depth explanation.n: none
g: global intersection
t: intersection by type
l: intersection by type - smallest location
l
contDisambiguation context. Context prioritization for entity semantic disambiguation. See context disambiguation for a more in depth explanation.
udThe user dictionary allows to include user-defined entities and concepts in the sentiment analysis. It provides a mechanism to adapt the process to focus on specific domains or on terms relevant to a user's interests, either to increase the precision in any of the domains already taken into account in our ontology to include a new one, or just to add a new semantic meaning to known terms. Several dictionaries can be combined separating them with |.Name of your user dictionariesOptional.

Important

The fields txt, doc and url are mutually exclusive; in other words, at least one of them must not be empty (a content parameter is required), and in cases where more than one of them has a value assigned, only one will be processed. The precedence order is txt, url and doc.

Models and language

Sentiment models are defined for a particular language. The sentiment analysis uses a morphosyntactic analysis, which is directly directed to the language and the reason why the lang parameter is required.

You will only be able to analyze a text in a particular language if the lang parameter and the lang of the model are the same.

The lang parameter has a new value with special behavior: when you set it to auto, it will automatically detect the language of the text, and try to find a model with the name you entered in the model parameter and the language detected in the text. If it finds a model that fits, the sentiment analysis will be carried out using that model, otherwise, an error will be raised.

This functionality is specially useful when working with a multilingual set of texts as it allows you to define a single request to the API without having to change its parameters depending on the text.

MeaningCloud currently supports a generic sentiment model (called general) for all supported languages.

You can define your own sentiment models using the user sentiment models console and work with them in the same way as with the sentiment models we provide.