Using Action Patterns in Dictionaries
Vertica Pulse supports the use of action patterns in white_list dictionaries only. An action pattern enables Pulse to recognize phrases that denote action, intention, or interest, such as going to buy, waiting to see, and so on. Action patterns can identify behaviors associated with your sentiment analysis terms.
Action patterns can:
- Connect Word Forms to a Root Word — Vertica Pulse lemmatizes all words. Lemmatization recognizes different word forms and maps them to the root word. For example, Pulse would map bought and buying to buy. This ability extends to misspellings. For example, tryiiiing and seeeeeing taaablets would map to trying and seeing tablets.
- Create Object-Specific Queries — To identify only the attributes that are objects of action patterns, create a whitelist dictionary that contains only action patterns of interest. In your sentiment analysis query set the actionPattern and whiteListOnly parameters to true.
Note: Action patterns exist in the whitelist dictionary. If a word that matches an action pattern appears in both the white_list and stop_words dictionaries, the white_list takes precedence. The stop_list word would appear in sentiment analysis results.
Action Pattern Syntax
Construct an action pattern by combining action parameters within an #action. By default, parameters match any instance of the associated part of speech. You can match specific terms by listing them with the parameter. For example, the parameter $PREP(to,on)
, would match only to and on.
Parameters can also accept $regex and $list operators.
#action{$ADV $VERB $PREP $ADJ}
Parameter | Short form | Description |
$ADJECTIVE | $ADJ | Matches any adjective. |
$ADVERB | $ADV | Matches any adverb. |
$PREPOSITION | $PREP | Matches any preposition. |
$VERB | $VERB | Matches any verb. |
Default Action Patterns
Pulse includes default action patterns in the whitelist dictionary. You cannot remove these patterns. Pulse always evaluates them when you perform a sentiment analysis.
Language | Pattern | Example |
English |
|
planning on buying, thinking about dropping |
$Verb TO $Verb
|
going to buy, looking to acquire |
|
Spanish | $Verb $Prep $Verb
|
voy a comprar, pienso en dejar |
$Verb $Verb
|
quiero solicitar, planean adquirir |
Examples
The following example shows how Pulsecan match customer or client, the verb would and any other verb. It would match phrases like customer would buy or client would cancel.
INSERT INTO pulse.white_list_en values('#action{$LIST(customer,client) would $VERB}');
The following example shows a match for specific verbs like, want, and plan, plus any preposition and any other verb. It would match phrases like want to own or plan on buying.
INSERT INTO pulse.white_list_en values('#action{$VERB(like,want,plan) $PREP $VERB}');
The following example identifies words ending in ember, such as December, and uses a regular expression to identify date references, such as 2nd or 4th. This action pattern could identify users planning to attend an event or making holiday plans.
INSERT INTO pulse.white_list_en values('#action{On $regex(.+ember) $regex(\d+(th|st|rd|nd)) I will $verb to}');