Skip to content

STEM attribute

The STEM attribute matches the root of the text of a token so that such a root can be used to match other token texts—from a morphological and not semantic point of view—that must share the same root.

The syntax is:

STEM("string1"[, "string2", "string#"])

where:

  • STEM is the attribute name and must be written in uppercase.
  • string# is a sequence of alphabetical characters, numbers, spaces and other punctuation marks.

Note

The STEM attribute is not supported for these languages:

  • Chinese
  • Korean
  • Japanese

For example, this rule:

SCOPE SENTENCE
{
    IDENTIFY(ROOTS)
    {
        @FIELD1[STEM("transformation")]
    }
}

applied to these sentences:

By using transformers, the voltage of the power can be stepped up to a high voltage.
His life had already undergone one transformation.
A deep conversation can transform a relationship into a genuine love bond.
The sofa is transformable into a bed.
We're at the brink of a transformative health care model, where connected devices change the structure of underlying health care systems.

will match:

  • transformers
  • transformation
  • transform
  • transformable
  • transformative

because they all share the same root, transform. As mentioned above, only the morphological aspect is considered, without considering the meaning.

Similar to the KEYWORD attribute, the STEM attribute is case insensitive, but while KEYWORD becomes case sensitive if you write a capital case string, STEM does not. To make the STEM attribute case sensitive, start the string with a question mark followed by a colon (?:) as discussed in the dedicated paragraph of the KEYWORD attribute.

In case you are dealing with a collocation, the STEM attribute recognizes the ending of the collocation in the ending of the last collocation atom.

For example, this rule:

SCOPE SENTENCE
{
    IDENTIFY(TEST)
    {
        @FIELD1[STEM("make allowance")]
    }
}

applied to this sentence:

He knows my problem, so he makes allowances.

will not match makes allowances, because the attribute recognizes make allow as the collocation root, while the textual value is makes allow(ances).

To create a STEM-based rule for a collocation, split the rule using as many STEM attributes as the atoms that make the collocation, like this:

SCOPE SENTENCE
{
    IDENTIFY(TEST)
    {
        @FIELD1[STEM("make")]
        >>
        @FIELD1[STEM("allowance")]
    }
}

In this case, two different stems will match the components of the collocation:

  • make
  • allow