Sophia NLU Engine - JSON Objects

Below shows the exact objects returned by the Sophia NLU engine, both as Rust structs from the shared library, and as JSON objects from the RPC daemon:

tokenize(input)

The tokenize(input) function returns the following JSON object:

  • processing_time_ms
  • total_tokens
  • tokens -- Vector of tokens representing each individual word.
  • mwe< - Vector of tokens representing each multi-word entity./li>

Individual Token

Represents a single token in the output.

  • word
  • index - Corresponding integer value of the word
  • label - (see POS labels page for list)
  • stem
  • potential_stems
  • antecedent
  • placement -- word, prefix or suffix
  • is_possessive
  • is_negative
  • categories - Vector of category objects shown below.
  • ner - Only applicable for named entities / proper nouns. Vector of category objects shown below.
  • inner_word - Used for special place holders (eg. |num|, |time|, |weight|, |distance|, etc.)
  • inner_value
  • inner_unit

Category

Individual category object, filles the 'category' and 'er' fields of the above token object.

  • name
  • fqn - fully qualified name (eg. noun/animal/mammal/lion)

interpret(input)

The interpret(input) function returns the following JSON object:

  • processing_time_ms
  • total_tokens
  • tokens -- Vector of tokens representing each individual word.
  • mwe< - Vector of tokens representing each multi-word entity./li>
  • phrases - Vector of chunked phrases
  • scores - Hashmap of classification scores of input such as sentiment, politeness, humor, seriousness, and others.
  • audit - String containing block of debug / audit text

Phrase

  • start - index within mwe the phrase starts at
  • end - index within mwe the phrase ends at
  • split_token - index within mwe where the phrase was split
  • nouns - Vector of nouns
  • verbs - Vector of verbs
  • tense - past, present or future
  • person - first, second or third
  • classification - declarative, imperative, interrogative, exclamatory or conversational

Noun

  • head - index within mwe
  • compound_elements - vector of indexes within mwe
  • modifiers - vector of noun modifiers
  • siblings - vector of noun siblings
  • prepositions - vector of indexes within mwe
  • determiners - vector of indexes within mwe
  • adjectives - vector of adjective objects

Noun Modifier

  • position - index within mwe
  • compound_elements - vector of indexes within mwe
  • siblings - vector of noun siblings
  • prepositions - vector of indexes within mwe
  • determiners - vector of indexes within mwe
  • adjectives - vector of ajective objects

Noun Sibling

  • position
  • is_excluded
  • determiners
  • adjectives
  • seperators

Verb

  • head
  • objects
  • modifiers
  • siblings
  • auxillary_verbs
  • prepositions
  • determiners
  • adverbs

Verb Modifier

  • position
  • objects
  • auxillary_verbs
  • prepositions
  • adverbs

Verb Sibling

  • position
  • objects
  • seperators

Adjective

  • position
  • adverbs
  • predicative_verbs