Lexicon Editor

The GetSentiment API performs phrase-level sentiment analysis: it detects terms (key phrases and entities) in each sentence and recognizes sentiment associated with each term. To achieve that, it uses proprietary classifiers and lexicons. To customize them to a new domain (industry or vertical, such as finance, retail, hospitality), the system accepts user-supplied lexicons that extend and override the default functionality.


The purpose of the Lexicon Editor is to enable the user to:

  • Create and edit custom sentiment and term lexicons

  • Import such lexicons from other sources into the system

  • Export created lexicons from the system

  • Delete created lexicons

while retaining the rights over them.


1. Subscribe to GetSentiment API


Send us an email describing your selected pricing plan and any requirements, we will send you instructions how to subscribe to GetSentiment API as well as an access URL to the Lexicon Editor.

2. Create a custom domain


Login to GetSentiment Lexicon Editor (please get in touch with us to get access instructions). Once logged in, you will be shown a list of your custom domains. To create a new one, give it a name (e.g., “MyDomain”) and click “Add”. You will be taken to the screen for the created domain:


Define the extended domain. Under “Extends”, select the domain your custom domain should extend (e.g, “Retail”). Click “Update”. By extending your custom domain from a pre-built one, you will re-use existing domain-specific classifiers. You will not have access to the pre-built lexicons, but you will be able to add new entries that will extend or override the pre-built ones.

Once you select a pre-built domain to extend from, its categories will be automatically added to the “Categories” field, e.g.:



You can edit the pre-built categories: remove or rename them, or add new categories.

By default, each new custom domain extends the “General” domain, i.e. it will use only general-language sentiment resources. By extending your custom domain from the general one, you can create your categories from scratch.

Define user names. Under “Usernames”, add the username of the Mashape account, from which the service will be used. This is to ensure that only Mashape users that you select have access to the domain you have created.


Export or delete your domain. On the same screen, you can export the created domain data to a local file (click on “Export”). The data will be exported into a format that should also be used for importing a domain into the system. You can remove your domain from the system by clicking the “Delete” button.


3. Edit domain terms


Clicking on the “Terms” button, you will be taken to a screen where you can search for terms, add new ones, edit or delete existing ones.



4. Edit domain sentiment phrases


Clicking on the “Sentiment” button you will be taken to a screen where you can search for sentiment phrases, add news ones, edit or delete existing ones:




Notice that the example includes “cool” marked as a neutral phrase. In this way, we override the general-domain lexicon, where “cool” is encoded as a positive phrase.


Note the conventions for terms and sentiment phrases:


  • An entry can include single words (nice, excellent, awful) and multi-word phrases (a cut above the rest).

  • Any given word in a phrase can be modified by a part-of-speech tag – N for noun, V for verb, J for adjective and R for adverb – in order to restrict matches to that part-of-speech (break:V, cool:J, fit:J for purpose).

  • Each word may be either in the inflected form (goes, went, gone, going) or in the lemmatized form (go).


5. Use the custom domain in the API calls


First, write a client progam to interact with the API via Mashape (see examples for Java, Python, Ruby, PHP, R, Node.js, C#). To use the customized domain, you will need to specify the domain name in the API request parameters ({ ..., "domain": "MyDomain" }) and make sure that in the headers of the request you are using the Mashape username that you've indicated in the user interface.


If input text contains words or phrases you've included into your lexicons, the text will be analyzed accordingly. For example, if you add the terms and sentiment phrases as shown above, and provide the input:


Term1 is SentimentPhrase1. Term2 is cool.”,


the “Service” category will be recognized in the first sentence, and associated sentiment will be positive, the sentiment in the second sentence will be neutral.