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")
- Alphabetic
- By Inheritance
- Gliner2DslParser
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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()
-
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
IllegalArgumentExceptionif spec is empty
-
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
IllegalArgumentExceptionif spec is empty or invalid
-
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
-
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
IllegalArgumentExceptionif spec is empty or invalid
-
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
-
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
IllegalArgumentExceptionif spec is empty
-
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
-
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
IllegalArgumentExceptionif spec is empty
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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()