Overview
Conditions are the building blocks of every Rule, and when creating Rules in Clavata.ai, you’ll use a variety of predefined Conditions to guide content evaluation. Each type of Condition serves a unique purpose in defining how content is evaluated. Below, we’ll cover the various Conditions, how they allow you to scale your Policies, and how and when to use them.Types of Conditions
Connecting Conditions
- Connecting Conditions allow you to link various Signals and Signal Lists within your Policy Sections, or Policy Labels, using logical terms—such as
NOT,AND,OR,ALL,ANY, andNONE. - They help define how different Rules interact with each other. For example, you can combine statements like:
ANY ("gender") AND ANY (“degrading remarks”,”offensive stereotypes”,”slurs”)
Context Conditions
- Context Conditions define relationships between objects or concepts in specific contexts to create Rules such as
"threats" [CONCERNING] "real world violence"
Match Conditions
- Match Conditions are where you can specify one or more words or phrases to look for within text. The matches can be exact, fuzzy, or sentiment matches.
- Exact Match Conditions identify specific words or phrases in content, ignoring case differences, like
=(“cat”)would identify cAt, CAT, and CAt. - Fuzzy Match Conditions detect words or phrases that are similar in meaning or form, including variations like leetspeak, like
~(“hate”)will detect “h4t3”.- Note: Rules containing Exact Match and Fuzzy Match Conditions apply to text and text-on-images only.
- Exact and Fuzzy Match Conditions are only applicable to text or text-on-image.
- Exact Match Conditions identify specific words or phrases in content, ignoring case differences, like
- The Sentiment Match Condition analyzes the overall sentiment of content, such as identifying threatening or negative language. ie,
SENTIMENT("threatening")will detect “I am going to kill you.”
EXCEPT WHEN Condition
- The
EXCEPT WHENCondition specifies exceptions to the Rules within a Section or Label of your Policy. These exceptions apply only to that Section, without affecting the overall Policy or other Sections.
Connecting Conditions
Connecting Conditions allow you to link various Signals and Signal Lists within your Policy Sections or Labels using logical terms. They allow for more specification between Rules to ensure that they capture the intended context of a statement. There are 6 different Connecting Conditions:NOT: Excludes specific Signals.AND: Ensures additional Signals are true.OR: At least one Signal must be true.ALL: All Signals must be true.ANY: Specifies that at least one of several Signals must be true.NONE: Ensures none of the listed Signals are true.
AND NOT or OR ALL .
Examples
Format in a RuleANY and the AND Connecting Conditions.
The first use of the ANY Condition targets the detection of any kind of gender identity. The AND ANY Conditions specify that this Rule should only flag if any gender identity is used in relation to explicitly offensive stereotypes or slurs.
Context Conditions
Context Conditions define relationships between objects or concepts within a specific context. They help refine content evaluation by adding contextual details to the objects being analyzed. Context Conditions are useful when you need to specify how objects interact or relate in a particular situation, such as a person holding a weapon or an object being used in a specific context. Context Conditions follow the structure of“signal” [OPERATOR] “signal” . Operators are predefined words used within Context Conditions to define relationships between Signals.
Examples
Format in a RuleMatch Conditions
Match Conditions are a set of Conditions designed to identify and flag specific patterns within content. These Conditions can detect exact words or phrases, variations of terms (such as misspellings), or the sentiment behind the content. Each Condition serves a different purpose, ensuring flexible and precise content analysis. There are three different Connecting Conditions:- Exact Match: Exact Match identifies content that contains specific words or phrases exactly as they are, without considering letter case. These Conditions are ideal for when you need to flag content with defined words or phrases.
- Fuzzy Match: Fuzzy Match is used to detect words or phrases that are close variations of the specified terms, accounting for misspellings, abbreviations, or alternative forms like leetspeak.
- Sentiment Match: Sentiment Match analyzes the emotional tone of the content, such as detecting negative or threatening sentiment. This Condition is designed to evaluate the content’s mood or context rather than searching for exact terms.
Examples
Exact Match Format in a RuleEXCEPT WHEN Conditions
The EXCEPT WHEN Condition specifies exceptions to the Rules within a Section of your Policy. These exceptions apply only to the preceding Section, without affecting the overall Policy or other Sections. EXCEPT WHEN format in a RulePriority and Label Composition
Priority allows you to specify hierarchies when it comes to yourLabel s—allowing you to specify that one label should take priority over the other in the event both are true. For example, if both a "Wolf" label and a "Dog" label are true, apply the "Wolf" label only. This can be useful for applying ratings, for discovering taxonomies, and many other purposes.
Priority “Chain”
You can set a priority statement at the top (level) of your policy. You may include some, or all, of the labels from the current policy in this chain—so long as you have included the labels you want to create a hierarchy between. In this example, we can read the chain as:Mature is greater than R which is greater than PG-13 which is greater than PG . That is, if Mature is true, then R , PG-13 , and PG will automatically be considered false. The priority then cascades down the chain from left to right. So if R is true (and Mature is not), then PG-13 and PG both cannot be true. And so on.
R will not be applied to content if Mature is true, PG will not be applied if PG-13 is true, but there is no linkage between PG and Mature because they are part of different priority chains.
Note that Priority chains must always have at least 2 labels in them. Any less will cause a compilation error.
Label-Level Priority
There’s another way to set priorities that only connects two labels together, theUNLESS -> X statement.
If you only need to say that R cannot be true if Mature is true, you can do so right in the R label. This allows you to compose labels together (instead of writing a complex UNLESS { } block, and it also keeps all the logic for the label R with the rest of the logic for the label R .
Functionally,PRIORITYandUNLESS Xbehave exactly the same. Which one you use is a matter of preference. We recommend usingPRIORITYfor long chains of labels (at least 3) andUNLESS -> "X"when the relationship is only between two labels (and there’s no “chain” to speak of.)
Errors
It is an error when usingPriority or UNLESS -> "X" to reference a label that does not exist in the current policy. We’re working on future updates that will allow you to reference labels in other policies. If you’d like to be part of testing those updates when they arrive, let us know!
Considerations
- Use Conditions that are specific enough to catch the intended content, but not so narrow that you miss similar violations.
- You may be able to use different Conditions to achieve the same outcomes. Keeping the Rule simple will make it easier to maintain and troubleshoot.
- Ensure that Fuzzy Match Conditions align with your expectations by thoroughly testing different variations of content.
- Rules containing Exact Match and Fuzzy Match Conditions apply to text and text-on-images only.
We’d Love to Hear From You
Whether you have a suggestion, feedback, or a bug to report, here are the best ways to get in touch:- In the App: Use the Feedback button for direct suggestions.
- On Slack: Reach out to the team in your shared channel.
- With your AM: Talk to your dedicated account manager.
- Via Email: Send a message to [email protected].