NL Interpreter Overview

Introduction

The purpose of the Natural Language Interpreter API is to interpret any string in the same way the Natural Language Test tool can, and then return the results of that interpretation according to Inbenta’s Natural Language Processing (NLP) system in the form of symbols stored in the Lexicon. Symbols are abstract representations of the words identified in the provided text. The API furthermore returns the list of words assigned to those symbols, so that you can have a complete overview of the Inbenta NLP elements.The API has two endpoints:

GET /v1/interpretations

This endpoint only accepts requests that contain at least one value for the “text” parameter. Upon receiving the request, the API runs the parameter value through the pre-processing engine of Inbenta’s NLP system.

In its response, the endpoint then returns Inbenta’s interpretation of the text provided in the request.

This response includes:

  • The ID of the lexical units reflecting each symbol identified in the “text” parameter value. (For a definition of a lexical unit, please refer to the Inbenta glossary.)

  • The lexical units corresponding to each lexical unit ID.
  • The words that were interpreted for each lexical unit.
  • The symbols that represent the lexical units.
  • The grammar category of each symbol.
  • The semantic weight of each symbol. (For a definition of semantic weight, please refer to the Inbenta glossary.)
  • The lexical relations that are defined in the Lexicon for each lexical unit.

In addition, the optional parameters “automatic_spell_correction” and “contraction_level” allow you to apply Automatic Spell Correction and semantic contractions to the provided text.

For example, imagine the parameter value is “Dentist outside Spain” and we apply both the Automatic Spell Correction and semantic contractions..

The API will return the following response with the symbols “dentist” and “abroad”. The response will also include each symbol’s grammar category and lexical relations (such as synonyms and similar words) as registered in the Lexicon:

{
    "interpretation": {
        "lexical_units": [
            {
                "lexical_unit_id": "dentist|N",
                "identified_word": "dentist",
                "symbol": "dentist",
                "grammar_category": "N",
                "semantic_category_weight": 0.95,
                "relations": [
                    {
                        "lexical_unit_id": "tooth|N",
                        "symbol": "tooth",
                        "grammar_category": "N",
                        "relevance": "Similar"
                    },
                   (...)

            {
                        "lexical_unit_id": "orthodontist|N",
                        "symbol": "orthodontist",
                        "grammar_category": "N",
                        "relevance": "Synonym"
                    }
                ]
            },

            {
                "lexical_unit_id": "abroad|ADV",
                "identified word": "abroad",
                "symbol": "abroad",
                "grammar_category": "ADV",
                "semantic_category_weight": 0.6,
                "relations": [
                    {
                        "lexical_unit_id": "international|A",
                        "symbol": "international",
                        "grammar_category": "A",
                        "relevance": "Synonym"
                    },
                    {
                        "lexical_unit_id": "overseas|N",
                        "symbol": "overseas",
                        "grammar_category": "N",
                        "relevance": "Synonym"
                    },
                    {
                        (...)
                    },
                    { 
                        "lexical_unit_id": "country|N",
                        "symbol": "country", 
                        "grammar_category": "N", 
                        "relevance": "Related" 
                    }
                ]
            }
        ]
    }
}

GET /v1/words

This endpoint only accepts requests that contain one value for the “lexical_unit_id” parameter. Upon receiving a valid request, the API runs the parameter value through the pre-processing engine of Inbenta’s NLP system.

In its response, the endpoint then returns the words that are assigned to the lexical unit whose ID was provided in the request.

For example, imagine the parameter value is “abroad|ADV“.

The API will return the following response with the words “abroad” and “out of the country”:

{

    "words": [

        {

            "word": "abroad"

        },

        {

           "word": "out of the country"

        }

   ]

}