class

Zh2Vi::Translator

Inherits Reference < Object

Translator is the main engine for Chinese to Vietnamese translation It combines parsing, reordering, and dictionary lookup

Constructors

default

Create translator with default/minimal dictionaries

Source
load(pos_dict_path : String, dep_dict_path : String, hanviet_path : String | Nil = nil) : Translator

Load translator from data files

Source
new(pos_dict : Dict::PosDict, dep_dict : Dict::DepDict, hanviet : Dict::HanViet)
Source

Instance methods

dep_dict
Source
hanviet
Source
lookup_word(node : Node, cws : Array(String), dep : Array(DepRel)) : String

Look up translation for a token

Source
output_text(tree : Node) : String

Get Vietnamese output as string

Source
parser
Source
pos_dict
Source
translate(con : String, cws : Array(String), pos : Array(String), ner : Array(NerSpan) = [] of NerSpan, dep : Array(DepRel) = [] of DepRel) : Node

Full translation pipeline (String input)

Source
translate(con : RawCon, cws : Array(String), pos : Array(String), ner : Array(NerSpan) = [] of NerSpan, dep : Array(DepRel) = [] of DepRel) : Node

Full translation pipeline (RawCon input)

Source
translate_tree(tree : Node, cws : Array(String) = [] of String, dep : Array(DepRel) = [] of DepRel) : Nil

Translate just from a parsed tree

Source