Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Looks up sequences of tokens in a dictionary and then tags the sequence with one or more semantic tags as an alternative representation. Typically, these tags represent entities such as {person}, {place}, {company}, etc.  This stage is also known as the "Entity Recognizer".


Operates On:  Lexical Items with TOKEN and possibly other flags as specified below.

Saga_is_recognizer

Note

All possibilities are tagged, including overlaps and sub-patterns, with the expectation that later disambiguation stages will choose which tags are the correct interpretation.


Include Page
Generic Configuration Parameters
Generic Configuration Parameters

Configuration Parameters

  • Parameter
    summaryThe dictionary resource that holds the names and that is to be located in the text
    namedictionary
    requiredtrue
    • This is specified as "provider:name" in the standard resource format.
  • Parameter
    summaryIgnore matches with tags specified in the ignoreTags list
    nameignoreTags
    typestring array
  • Parameter
    summaryName of the tag which indicates what entities should be process
    nameentity

  • Parameter
    summaryRemoves accents and diacritics and generates a new pattern
    defaultfalse
    namenormalizeAccents
  • Parameter
    summaryIndicates if characters should be removed from the pattern using a list creating a new pattern
    defaultfalse
    nameremoveChars
    typeboolean
  • Parameter
    summaryList of characters to remove from the pattern
    default_-‿⁀⁔︳︴﹍﹎﹏_
    namecharsList
Info

In version 1.2.2 this parameter was added:

  • Parameter
    summaryThreshold use to filter when doing vector similarity
    default0.7
    namecosineSimThreshold
    typedouble



Saga_config_stage
boundaryFlagstext block split
stageDictionaryTagger
requiredFlagstoken, semantic tag
skipFlagsskip
"dictionary": "dict-provider:people-lowercase",
"ignoreTags": ["color", "currency"],
"normalizeAccents": false,
"removeChars": false,
"charsList": "_-‿⁀⁔︳︴﹍﹎﹏_"
Note

"people-lowercase" resource must be in the format specified below.

Example Output

In the following example, "abraham lincoln" is in the dictionary as a person, "lincoln" as a place,  and "macaroni", "cheese" and "macaroni and cheese" are all specified as foods:

Saga_graph
V--------------[abraham lincoln likes macaroni and cheese]--------------------V
^--[abraham]--V--[lincoln]--V--[likes]--V--[macaroni]--V--[and]--V--[cheese]--^
              ^--[{place}]--^           ^---[{food}]---^         ^--[{food}]--^
^---------[{person}]--------^           ^----------------[{food}]-------------^

Output Flags

Lex-Item Flags

  • SEMANTIC_TAG - Identifies all lexical items that are semantic tags.
  • ENTITY - Identifies the token as an entity.
  • PROCESSED - Placed on all the tokens which composed the semantic tag.

Vertex Flags:

Info

No vertices are created in this stage

Resource Data

The dictionary tagger must have an "entity dictionary" (a string to JSON map) which is a list of JSON records, indexed by entity ID. In addition, there may also be a pattern map and a token index.

Entity Dictionary Format

The only file that is absolutely required is the entity dictionary. It is a series of JSON records, typically indexed by entity ID.

Each JSON record represents an entity. The format is as follows:

Saga_json
TitleEntity Json Format
"_id" : "KGAAJGsBemSwA0nZTLXA",
"id":"Q28260",
"tag":"{city}",
"display": "Lincon"
"patterns":[
  "Lincoln", "Lincoln, Nebraska", "Lincoln, NE"
],
"fields": {
  "coord": [40.813639, -96.702611]
}
"confAdjust": 0.95
. . . additional fields as needed go here . . . 
Note
  • Multiple entries can have the same pattern. If the pattern is matched, then it will be tagged with multiple (ambiguous) entry IDs.
  • Additional fielded data can be added to the record; as needed by downstream processes.

Fields

  • Parameter
    summaryAn ID normally refering the ID of a database, a document, an API key, not necessary unique
    nameid
    requiredtrue
  • Parameter
    summaryTag which will identify any match in the graph, as an interpretation
    nametag
    requiredtrue

    • These will all be added to the interpretation graph with the SEMANTIC_TAG flag.

      Tip

      Tags are hierarchical representations of the same intent. For example, {city} → {administrative-area} → {geographical-area}

  • Parameter
    summaryA list of patterns to match in the content
    namepatterns
    typestring array
    requiredtrue
    • Patterns will be tokenized and there may be multiple variations which can match.

      Note

      Currently, tokens are separated on simple white-space and punctuation, and then reduced to lowercase.

  • Parameter
    summaryWhat to show the user when browsing this entity
    namedisplay

  • Parameter
    summaryFree space to add extra data in any format supported by JSON
    namefields
    typejson

Include Page
Generic Resource Fields
Generic Resource Fields

Dictionary Index

To improve performance especially for every large databases of entities, the entity dictionary is inverted and indexed.

This currently happens in RAM inside the DictionaryTagger stage. An off-line option for pre-inverting the dictionary will be provided in the future.