Class: TaggingContext

$k. TaggingContext

new $k.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 Description
string

language() : string

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

Since:
  • 5.2.0
Returns:
Type Description
string

setLanguage(language)

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

Name Type Description
language string

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.

Name Type Description
shouldCreateTags boolean
Since:
  • 5.2.0

setShouldLinkTags(shouldLink)

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

Name Type Description
shouldLink boolean
Since:
  • 5.2.0

setShouldPreserveTags(shouldPreserveTags)

Set to true if persistent tags should be preserved

Name Type Description
shouldPreserveTags boolean
Since:
  • 5.2.0

setShouldSyncRelations(shouldSyncRelations)

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

Name Type Description
shouldSyncRelations boolean
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.

Name Type Description
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 Description
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 Description
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 Description
boolean

shouldPreserveTags() : boolean

True if persistent tags should be preserved

Since:
  • 5.2.0
Returns:
Type Description
boolean

shouldSyncRelations() : boolean

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

Since:
  • 5.2.0
Returns:
Type Description
boolean

source() : $k.SemanticElement

Returns the tagging source

Since:
  • 5.2.0
Returns:
Type Description
$k.SemanticElement

tags() : Array.<$k.Tag>

Returns the tags found by the tagger

Since:
  • 5.2.0
Returns:
Type Description
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 Description
string