Types of Conditions
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 WHEN
Condition 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.
Connecting Conditions can be combined to create a more scalable Rule, such as AND NOT
or OR ALL
.
Examples
Format in a Rule
ANY( "signal1" "signal2" ) AND ANY ( "signal3" "signal4" )
Example in a Rule
ANY( "gender identity" ) AND ANY ( "explicitly offensive stereotypes" "slurs" )
This example Rule is using the ANY
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.
For the full list of available Operators that are used in Context Conditions, check out this article.
Examples
Format in a Rule
"signal" [OPERATOR] "signal"
Example in a Rule
"encouragement" [REGARDING] "self harm"
This Rule flags content where encouragement regarding any form of self harm occurs, helping to identify situations where these two elements appear together.
Match 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 Rule
Single word example: =(“signal”) Multi-word example: =( “signal1” ”signal2” ”signal3” )
Exact Match Example in a Rule
Single word example:
=(“cocaine”)
This example will flag the word cocaine. Since Exact Match Conditions are not case sensitive, this will match any variation of capitalization, for example "Cocaine," "COCAINE," or "cOcaiNE."
Multi-word example:
=( “cocaine” ”marijuana” ”heroin” )
This Rule flags content where encouragement regarding any form of self harm occurs, helping to identify situations where these two elements appear together.
Fuzzy Match Format in a Rule
Single word example: ~(“signal”) Multi-word example: ~( “signal1” ”signal2” ”signal3” )
Fuzzy Match Example in a Rule
Single word example:
~(“cocaine”)
This Rule flags content with variations of the word "cocaine," such as "c0c41n3”
Multi-word example:
~( “cocaine” ”marijuana” ”heroin” )
This Rule flags content with any variation of any of the Signals in the list, such as “c0caine”, “marijuanaaa”,”h3r01n”.
Sentiment Match Format in a Rule
SENTIMENT("signal")
*Sentiment Conditions should have one Signal within, not a list.
Sentiment Match Example in a Rule
SENTIMENT("threatening")
This Rule flags content with a threatening tone, such as "I'll hurt you," even if the exact words aren't explicitly violent.
EXCEPT 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 Rule
LABEL "section name": "section risk" { "signal1" [OPERATOR] "signal2" EXCEPT WHEN { "signal3" } }
EXCEPT WHEN example in a Rule
LABEL "Harassment": "MED" { "attacks" [ABOUT] "personal circumstances" EXCEPT WHEN { "light trash talk" } }
This example demonstrates that this Section focuses on analyzing content related to personal attacks, except in cases where the content is identified as light trash talk. If light trash talk is detected, the Section will not trigger a flag.
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.
Need more help? Contact our support team at support@clavata.ai