Token

CoreNLP/simple. Token

Class representing a Token

Constructor

new Token(word)

Source:

Create a Token

Parameters:
Name Type Description
word string

Extends

  • Annotable

Methods

(static) fromJSON(data) → {Token}

Source:

Get an instance of Token from a given JSON

Parameters:
Name Type Description
data TokenJSON

The token data, as returned by CoreNLP API service

Returns:

token - A new Token instance

Type
Token

after() → {string}

Source:

Get the after string relative to the container sentence

Returns:

after

Type
string

before() → {string}

Source:

Get the before string relative to the container sentence

Returns:

before

Type
string

characterOffsetBegin() → {number}

Source:

A 0-based index of the word's initial character within the sentence

Returns:

characterOffsetBegin

Type
number

characterOffsetEnd() → {number}

Source:

Get the characterOffsetEnd relative to the parent sentence A 0-based index of the word's ending character within the sentence

Returns:

characterOffsetEnd

Type
number

index() → {number}

Source:

Get the inde number associated by the StanfordCoreNLP This index is relative to the sentence it belongs to, and is a 1-based (possitive integer). This number is useful to match tokens within a sentence for depparse, coreference, etc.

Returns:

index

Type
number

lemma() → {string}

Source:

Get the annotated lemma

Returns:

lemma

Type
string

ner() → {string}

Source:

Get the annotated named-entity for the current token

Returns:

ner

Type
string

originalText() → {string}

Source:

Get the original text

Returns:

originalText

Type
string

pos() → {string}

Source:

Get the annotated part-of-speech for the current token

Returns:

pos

Type
string

posInfo() → {PosInfo}

Source:
See:

Get additional metadata about the POS annotation NOTE: Do not use this method other than just for study or analysis purposes.

Returns:

posInfo

Type
PosInfo

speaker() → {string}

Source:
See:
  • CorefAnnotator

Get the annotated speaker for the current token

Returns:

speaker

Type
string

toJSON() → {TokenJSON}

Source:

The following arrow function data => Token.fromJSON(data).toJSON() is idempontent, if considering shallow comparison, not by reference. This JSON will respects the same structure as it expects from {@see Token#fromJSON}.

Returns:

data

Type
TokenJSON

toString() → {string}

Source:

Get a string representation

Returns:

token

Type
string

word() → {string}

Source:

Get the original word

Returns:

word

Type
string