com.johnsnowlabs.nlp.annotators.context
ContextualEntityRulerRules
Companion object ContextualEntityRulerRules
case class ContextualEntityRulerRules(entity: String, scopeWindowLevel: Option[String], prefixPatterns: Option[Array[String]], suffixPatterns: Option[Array[String]], scopeWindow: Option[(Int, Int)], prefixRegexes: Option[Array[String]], suffixRegexes: Option[Array[String]], replaceEntity: Option[String], mode: Option[String]) extends Serializable with Product
Represents rules used by the ContextualEntityRuler to update or filter chunks in text.
- entity
The target entity to be modified. Example:
"AGE"
- scopeWindowLevel
Specifies the level of the scope window to consider. Valid values:
"token"
or"char"
. Default:"token"
.- prefixPatterns
Array of patterns (words/phrases) to search **before the entity**. If these patterns are found within the scope, they will contribute to matching. Example:
["years", "old"]
matches entities preceded by "years" or "old."- suffixPatterns
Array of patterns (words/phrases) to search **after the entity**. If these patterns are found within the scope, they will contribute to matching. Example:
["years", "old"]
matches entities followed by "years" or "old."- scopeWindow
A tuple defining the range of tokens or characters (based on
scopeWindowLevel
) to include in the scope. Default:(1, 1)
.- Both integers must be non-negative or
(-1, -1)
for no scope limit. Example:(2, 3)
means 2 tokens/characters before and 3 after the entity are considered.
- Both integers must be non-negative or
- prefixRegexes
Array of regular expressions to search **before the entity**. These regexes define more complex matching patterns for prefixes. Example:
["\\b(years|months)\\b"]
matches words like "years" or "months" as prefixes.- suffixRegexes
Array of regular expressions to search **after the entity**. These regexes define more complex matching patterns for suffixes. Example:
["\\b(old|young)\\b"]
matches words like "old" or "young" as suffixes.- replaceEntity
Optional string specifying the new entity to replace the target entity with. Example:
"AGE_RANGE"
replaces"AGE"
with"AGE_RANGE"
in matching cases.- mode
Specifies the operational mode for the rules. Possible values depend on the use case (e.g.,
"filter"
,"replace"
).
- Alphabetic
- By Inheritance
- ContextualEntityRulerRules
- Product
- Equals
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ContextualEntityRulerRules(entity: String, scopeWindowLevel: Option[String], prefixPatterns: Option[Array[String]], suffixPatterns: Option[Array[String]], scopeWindow: Option[(Int, Int)], prefixRegexes: Option[Array[String]], suffixRegexes: Option[Array[String]], replaceEntity: Option[String], mode: Option[String])
- entity
The target entity to be modified. Example:
"AGE"
- scopeWindowLevel
Specifies the level of the scope window to consider. Valid values:
"token"
or"char"
. Default:"token"
.- prefixPatterns
Array of patterns (words/phrases) to search **before the entity**. If these patterns are found within the scope, they will contribute to matching. Example:
["years", "old"]
matches entities preceded by "years" or "old."- suffixPatterns
Array of patterns (words/phrases) to search **after the entity**. If these patterns are found within the scope, they will contribute to matching. Example:
["years", "old"]
matches entities followed by "years" or "old."- scopeWindow
A tuple defining the range of tokens or characters (based on
scopeWindowLevel
) to include in the scope. Default:(1, 1)
.- Both integers must be non-negative or
(-1, -1)
for no scope limit. Example:(2, 3)
means 2 tokens/characters before and 3 after the entity are considered.
- Both integers must be non-negative or
- prefixRegexes
Array of regular expressions to search **before the entity**. These regexes define more complex matching patterns for prefixes. Example:
["\\b(years|months)\\b"]
matches words like "years" or "months" as prefixes.- suffixRegexes
Array of regular expressions to search **after the entity**. These regexes define more complex matching patterns for suffixes. Example:
["\\b(old|young)\\b"]
matches words like "old" or "young" as suffixes.- replaceEntity
Optional string specifying the new entity to replace the target entity with. Example:
"AGE_RANGE"
replaces"AGE"
with"AGE_RANGE"
in matching cases.- mode
Specifies the operational mode for the rules. Possible values depend on the use case (e.g.,
"filter"
,"replace"
).
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- val entity: String
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val mode: Option[String]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val prefixPatterns: Option[Array[String]]
- val prefixRegexes: Option[Array[String]]
- val replaceEntity: Option[String]
- val scopeWindow: Option[(Int, Int)]
- val scopeWindowLevel: Option[String]
- val suffixPatterns: Option[Array[String]]
- val suffixRegexes: Option[Array[String]]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()