Eduction 23.4

# addComponent

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.

## Syntax

`edkmatch:addComponent(name, offset, offsetLength)`

or

`edkmatch:addComponent(name, offset, offsetLength, originalOffset, originalOffsetLength)`

## Arguments

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 normalized text of the match.
`offsetLength` | The position of the text to use as the new component, in characters from the start of the normalized text of the match.
`originalOffset` | (optional) The position of the text to use as the new component, in bytes from the start of the original text of the match. If you do not set `originalOffset`, the value is set to the same as offset.
`originalOffsetLength` | (optional) The position of the text to use as the new component, in characters from the start of the original text of the match. If you do not set `originalOffsetLength`, the value is set to the same as offset.

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.

## Returns

The new empty component object.

Related Topics

- getName
- setName
- getText
- setText

Copyright 2013-2023 Open Text
Version 23.4 | Last updated September 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Eduction 23.4

Topic Title: addComponent