Adds a new component to the match. For example, if your Eduction task returns an email address as a match, you can use addComponent
to extract the text after the @ symbol and add it as a DOMAIN component for the match.
You can also use addComponent
to add metadata from other sources. For example, if you have extracted a place name, you can add components called “LATITUDE” and “LONGITUDE”, and populate them with data from a different source, regardless of the fact that they were not components of the original text.
edkmatch:addComponent(name, offset, offsetLength)
Argument | Description |
---|---|
name
|
The name of the new component (for example, TOPIC, or SENTIMENT) |
offset
|
The position of the text to use as the new component, in bytes from the start of the match. |
offsetLength
|
The position of the text to use as the new component, in characters from the start of the match. |
NOTE: If you are unsure of the correct offset
or offsetLength
, or the component value comes from an external source, you can set offset
or offsetLength
to 0.
The new empty component object.
|