Parameters for Taxonomy Logic
Syntax
Considerations around punctuation and special characters
To create a logic block
You can use our built-in taxonomy editor to help you categorize unstructured data into thematic topics.
Parameters for Taxonomy Logic
Scope tells Stratifyd the level at which to apply the logic. Valid values are as follows.
-
Sentence: By default, logic is applied at the sentence level. This ensures that it finds words in a specific context.
-
Paragraph: Select this to apply the matching logic at the paragraph level.
-
Document: Select this to apply the matching logic at the level of each record. This is a more generalized way to include only documents that match a specific word.
Note: For many datasets, unstructured text fields do not have differentiated paragraphs. In this case, Paragraph and Document scope levels behave identically.
Logic tells Stratifyd how to determine whether data is funneled into this label. Valid values are as follows.
-
Any: The default logic container for any label uses the Any logic. Use this to match data that includes any of the words listed in the container.
-
All: Create a new logic container with the All logic to match only data that includes all of the words listed in the container.
-
None: Create a new logic container with the None logic to match only data that includes none of the words listed in the container.
Syntax
Each rule in your taxonomy should be separated by commas and will follow the logic of the container that it's in (ALL, NONE, ANY). You can use the following syntax to create more advanced taxonomy rules.
Rule type: Simple
-
Syntax: None
-
Use: Simply writing service in your taxonomy logic container will match any data with the word "service"
Rule type: Single-character wildcard
-
Syntax: ?
-
Use: Use the question mark to create a single-character wildcard, e.g. rec??ve matches both “receive” and “recieve.”
Rule type: Multi-character wildcard
-
Syntax: *
-
Use: Use the asterisk to create a multi-character wildcard, e.g. app* matches "application" and "app" and "apple."
Rule type: Padded logic
-
Syntax: termone~#~termtwo
example: uninstalled~2~reinstalled -
Use: Use the tilde and specify a number to indicate the maximum number of words to allow between the two words, e.g. uninstalled~2~reinstalled matches “uninstalled and then reinstalled,” but not “uninstalled and then later I reinstalled.”
Rule type: Boolean logic
-
Syntax: (service + (good | great))
-
Use: Use parentheses to set precedence, e.g. ((uninstalled | reinstalled) + app) matches "uninstalled app" and "reinstalled app," but not "uninstalled and reinstalled app."
Note: Most cases can be covered using the different logic containers (ALL, NONE, ANY), so use this syntax sparingly as it can make troubleshooting your taxonomy more difficult if you see unexpected results
Rule type: Structured data match
-
Syntax: {value_to_match:@:column_header_name}
-
Use: Use braces to specify a value to match in a structured data field on the same record, e.g. {true:@:VerifiedBuyer} matches only records where the reviewer is a verified buyer of the product.
Rule type: Exact match
-
Syntax: "exactly this phrase*"
-
Use: If you need to match any characters that are reserved for special syntax, you can use double quotes to bypass the syntax to match the special characters in your data. For example if you want to match a literal question mark instead of using it as a single-character wildcard, then putting it inside double quotes (e.g. "why?") will match the phrase and the question mark character in your data.
Considerations around punctuation and special characters
How does the taxonomy handle matching punctuation?
If you want to use punctuation in your taxonomy logic to match specific strings of text containing punctuation, you can write the logic as you normally would and it will match in the text.
For example, if you want your label to match text containing M&M's
, the logic would simply be M&M's
.
Use double quotes around your logic if you want to match the literal characters ?
or *
, which are reserved for wildcards when not inside double quotes.
By default, the taxonomy analysis "cleans" the special characters in the input text so that your logic will match, even if there is punctuation surrounding it. This way, you don't have to worry about having wildcards to account for data with punctuation.
For example, if the input text is Can I check my account balance?
and your taxonomy has logic account balance
, the analysis will clean the text to Can I check my account balance ?
so that you don't have to have a wildcard after balance (balance*
) for instances where punctuation is immediately following a word that you want to match.
Creating a logic block
1. In the Taxonomy Editor, in the Labels panel to the left, select the label to which you want to add a logic container. By default, each label has one empty logic block with these default settings.

Scope: Sentence
Logic: Any
2. Optionally change the scope to Paragraph or Document, but Sentence level is a reasonable setting for most purposes.

3. Click in the box next to the number 1, and begin adding key words or phrases to signal to Stratifyd that a sentence (or paragraph or document) belongs under this label.
Separate words or phrases with commas, and use other syntax from the table above as needed.

4. Notice that in the Labels panel to the left, the label to which you added logic renders in yellow text and has an M for "modified" to its right, and any parent label renders in yellow text with a dot to its right to indicate that there are unsaved changes. Click the disk icon to Save.

The text color reverts to white, and a message indicates that the taxonomy changes were saved.
To add a new logic block
1. Below the existing logic container, click New logic block and select the type of logic to use.

2. As with the first logic block, optionally change the scope to Paragraph or Document.

3. Click in the box next to the number 1, and add comma-separated words or phrases as before, and click Save when you have finished.
You can collapse logic blocks that you are not using to simplify the view.

Additional Resources
Taxonomy Troubleshooting Guide
Comments
0 comments
Please sign in to leave a comment.