$k. TaggingContext

new TaggingContext()

Hold parameters and results during tagging. Needs to be recreated with every call to tag().

Methods

detectedLanguage() → {string}

Returns the language detected by the tagger

Since
  • 5.2.0
Returns:
Type: 
string

language() → {string}

Returns the language used for tagging. Might be used by the tagger to improve tagging.

Since
  • 5.2.0
Returns:
Type: 
string

setLanguage(language)

Sets the language used for tagging. Might be used by the tagger to improve tagging.

Parameters:
NameTypeDescription
languagestring

Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng")

Since
  • 5.2.0

setShouldCreateTags(shouldCreateTags)

Set to true if new objects should be created for unknown tags automatically. Additionaly requires that the tag type specifies that objects should be created.

Parameters:
NameTypeDescription
shouldCreateTagsboolean
Since
  • 5.2.0

setShouldLinkTags(shouldLink)

Set to true if the tag objects should be linked to the source object with a relation

Parameters:
NameTypeDescription
shouldLinkboolean
Since
  • 5.2.0

setShouldPreserveTags(shouldPreserveTags)

Set to true if persistent tags should be preserved

Parameters:
NameTypeDescription
shouldPreserveTagsboolean
Since
  • 5.2.0

setShouldSyncRelations(shouldSyncRelations)

Set to true if obsolete tag relations should be deleted after tagging

Parameters:
NameTypeDescription
shouldSyncRelationsboolean
Since
  • 5.2.0

setSource(source)

Sets the tagging source. Tagging relations will be created between this object and the tag objects. If no text is defined by this context, then the text will be extracted from the source by applying the text extraction configuration.

Parameters:
NameTypeDescription
source$k.SemanticElement
Since
  • 5.2.0

setText() → {string}

Sets the text to tag. If not defined then the text will be extracted from the source object.

Since
  • 5.2.0
Returns:
Type: 
string

shouldCreateTags() → {boolean}

Returns true if new objects should be created for unknown tags automatically. Additionaly requires that the tag type specifies that objects should be created. The default value is true.

Since
  • 5.2.0
Returns:
Type: 
boolean

shouldLinkTags() → {boolean}

Returns true if the tag objects should be linked to the source object with a relation. The default value is true.

Since
  • 5.2.0
Returns:
Type: 
boolean

shouldPreserveTags() → {boolean}

True if persistent tags should be preserved

Since
  • 5.2.0
Returns:
Type: 
boolean

shouldSyncRelations() → {boolean}

True if obsolete tag relations should be deleted after tagging. The default value is true.

Since
  • 5.2.0
Returns:
Type: 
boolean

source() → {$k.SemanticElement}

Returns the tagging source

Since
  • 5.2.0
Returns:
Type: 
$k.SemanticElement

tags() → {Array.<$k.Tag>}

Returns the tags found by the tagger

Since
  • 5.2.0
Returns:
Type: 
Array.<$k.Tag>

text() → {string}

Returns the text to tag. If not defined then the text will be extracted from the source object.

Since
  • 5.2.0
Returns:
Type: 
string