Packages

o

com.johnsnowlabs.nlp.annotators.ner

Gliner2DslParser

object Gliner2DslParser

Parser for GLiNER2 DSL (Domain-Specific Language) specifications.

Provides methods to parse string specifications into structured objects for entities, classifications, relations, and structure fields.

All parsing methods follow the :: separator pattern for consistency.

Example usage:

val entitySpec = Gliner2DslParser.parseEntitySpec("person::Names of people")
val fieldSpec = Gliner2DslParser.parseFieldSpec("category::[electronics|software]::str")
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Gliner2DslParser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. def parseClassificationTaskSpec(spec: String): ClassificationTaskSpec

    Parse classification task specification from DSL string.

    Parse classification task specification from DSL string.

    Format: "task_name" or "task_name::multi"

    spec

    DSL specification string

    returns

    Parsed ClassificationTaskSpec

    Exceptions thrown

    IllegalArgumentException if spec is empty

  16. def parseEntitySpec(spec: String): EntitySpec

    Parse entity specification from DSL string.

    Parse entity specification from DSL string.

    Format: "entity_name" or "entity_name::dtype::description" or "entity_name::description"

    Rules:

    • Single part: name only, defaults to list type
    • Two parts: If second part is "str" or "list", treat as dtype, else description
    • Three parts: name::dtype::description
    spec

    DSL specification string

    returns

    Parsed EntitySpec

    Exceptions thrown

    IllegalArgumentException if spec is empty or invalid

  17. def parseEntitySpecs(specs: Array[String]): Array[EntitySpec]

    Parse multiple entity specifications.

    Parse multiple entity specifications.

    specs

    Array of entity DSL specification strings

    returns

    Array of parsed EntitySpecs

  18. def parseFieldSpec(spec: String): FieldSpec

    Parse field specification from DSL string for structure extraction.

    Parse field specification from DSL string for structure extraction.

    Format: "field_name::type::description" or "field_name::[choice1|choice2]::type::description"

    Rules:

    • Default dtype: "list"
    • If choices present (format: [opt1|opt2|opt3]): forces dtype to "str"
    • Parts after field name can be in any order (type, choices, description)
    • Type must be "str" or "list"
    • Choices must be enclosed in brackets: [choice1|choice2]
    • Any other text is treated as description
    spec

    DSL specification string

    returns

    Parsed FieldSpec

    Exceptions thrown

    IllegalArgumentException if spec is empty or invalid

  19. def parseFieldSpecs(specs: Array[String]): Array[FieldSpec]

    Parse multiple field specifications.

    Parse multiple field specifications.

    specs

    Array of field DSL specification strings

    returns

    Array of parsed FieldSpecs

  20. def parseLabelSpec(spec: String): LabelSpec

    Parse classification label specification from DSL string.

    Parse classification label specification from DSL string.

    Format: "label" or "label::Description"

    spec

    DSL specification string

    returns

    Parsed LabelSpec

    Exceptions thrown

    IllegalArgumentException if spec is empty

  21. def parseLabelSpecs(specs: Array[String]): Array[LabelSpec]

    Parse multiple label specifications.

    Parse multiple label specifications.

    specs

    Array of label DSL specification strings

    returns

    Array of parsed LabelSpecs

  22. def parseRelationSpec(spec: String): RelationSpec

    Parse relation specification from DSL string.

    Parse relation specification from DSL string.

    Format: "relation_name" or "relation_name::description"

    spec

    DSL specification string

    returns

    Parsed RelationSpec

    Exceptions thrown

    IllegalArgumentException if spec is empty

  23. def parseRelationSpecs(specs: Array[String]): Array[RelationSpec]

    Parse multiple relation specifications.

    Parse multiple relation specifications.

    specs

    Array of relation DSL specification strings

    returns

    Array of parsed RelationSpecs

  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped