class

Zh2Vi::Dict::DepDict

Inherits Reference < Object

DepDict looks up word translations based on dependency relations Format: Each line in JSONL is ["child", "parent", "deprel", "child_val", "parent_val"]

Pattern matching:

  • parent can be "suffix" or "prefix" for wildcard matching
  • deprel can be "*" to match all relations
  • When wildcard is used, parent_val is not applied

Constructors

load(path : String) : DepDict

Load dictionary from JSONL file

Source

Instance methods

add(child : String, parent : String, deprel : String, child_val : String, parent_val : String | Nil) : Nil

Add an entry

Source
lookup(child : String, parent : String, deprel : String) : DepMatch | Nil

Look up translation based on child, parent, and dependency relation Returns the most specific match (exact > pattern > wildcard)

Source
size
Source