budoux/model
Types
The scores of a BudouX model, grouped in the same way as its JSON file.
Each group maps one to three characters around a position to a score. A character means a Unicode code point, not a grapheme cluster.
pub type Model {
Model(
uw1: List(#(String, Int)),
uw2: List(#(String, Int)),
uw3: List(#(String, Int)),
uw4: List(#(String, Int)),
uw5: List(#(String, Int)),
uw6: List(#(String, Int)),
bw1: List(#(String, Int)),
bw2: List(#(String, Int)),
bw3: List(#(String, Int)),
tw1: List(#(String, Int)),
tw2: List(#(String, Int)),
tw3: List(#(String, Int)),
tw4: List(#(String, Int)),
)
}
Constructors
-
Model( uw1: List(#(String, Int)), uw2: List(#(String, Int)), uw3: List(#(String, Int)), uw4: List(#(String, Int)), uw5: List(#(String, Int)), uw6: List(#(String, Int)), bw1: List(#(String, Int)), bw2: List(#(String, Int)), bw3: List(#(String, Int)), tw1: List(#(String, Int)), tw2: List(#(String, Int)), tw3: List(#(String, Int)), tw4: List(#(String, Int)), )
Values
pub fn decoder() -> decode.Decoder(Model)
Decodes a model from the JSON format used by BudouX. Missing groups are treated as empty.
let assert Ok(custom) = json.parse(model_json, model.decoder())
let parser = budoux.new(custom)