Components
Eduction components allow you to extract attributes from a single match. The attributes are called components because they are the components of a match.
For example, sentiment analysis can match the phrase Their service is fantastic as conveying positive sentiment. Components can then break this phrase down to identify service as the subject matter, and fantastic as the adjective that describes the subject.
Eduction does not extract components by default.
To use components, you must include components in the grammar that you want to use, and turn on components at run time. You must also configure some additional parameters. See Configure Components.
When to Use Components
The English Eduction sentiment analysis grammar defines components for TOPIC
, SENTIMENT
, POSITIVE
, and NEGATIVE
. You can use these components by configuring Eduction accordingly.
Components are useful when the information that you want to match has an underlying pattern that you want to preserve.
For example, you might use components to extract data from tables and return it in a suitable format. For an example, see EntityComponentFieldN.
NOTE: Most of the standard grammars do not define components, because these grammars are mainly dictionaries or basic patterns that you can use to build more complex patterns. You might want to define components when you reference these basic entities in your patterns for custom grammars.
Configure Components
To use the components defined in the Eduction grammar, you must configure Eduction with:
-
OutputSimpleMatchInfo
set toFalse
. See OutputSimpleMatchInfo. -
EnableComponents
set toTrue
. See EnableComponents. -
the
EntityComponentField
for the entity. See EntityComponentFieldN.
Define the Components
In the Eduction grammar, you define components by using the extension operator (?A=ComponentName:Pattern)
(see Regular Expressions). Consider the following example entity:
<entity name=test> <pattern>(?A=SUBJECT:(?A^noun)) is (?A=SENTIMENT:(?A^adjective))</pattern> </entity>
In this example, an earlier part of the grammar might define the noun
entity to match nouns such as service and facility, and the adjective
entity to match descriptions such as fantastic and appalling. This test
entity then matches the phrase service is fantastic, and returns the SUBJECT
component with the text service, and the SENTIMENT
component with the text fantastic.