1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// @generated by `cargo run -p formal-ai --example issue_386_gen_arith_table`.
// DO NOT EDIT BY HAND. Edit the cardinal/operator meanings in
// data/seed/meanings-units.lino and data/seed/meanings-calculator.lino,
// then regenerate. Parity with the live seed is enforced by the
// `arithmetic_word_tables_match_seed` test in src/calculation.rs.
//
// These tables drive `normalize_expression` in src/arithmetic.rs, which is
// compiled into the wasm worker and so must stay no_std + alloc only.
// Single-word surfaces, mapped to the value surface of their meaning (a
// spelled digit or operator word to its numeral/symbol). Applied after the
// expression is split on whitespace. Sorted by surface for a stable diff.
pub(crate) static WORD_VALUE_TOKENS: &[(&str, &str)] = &[
("eight", "8"),
("five", "5"),
("four", "4"),
("minus", "-"),
("mod", "%"),
("modulo", "%"),
("nine", "9"),
("one", "1"),
("plus", "+"),
("seven", "7"),
("six", "6"),
("ten", "10"),
("three", "3"),
("times", "*"),
("two", "2"),
("zero", "0"),
("восемь", "8"),
("два", "2"),
("две", "2"),
("девять", "9"),
("десять", "10"),
("минус", "-"),
("ноль", "0"),
("нуль", "0"),
("один", "1"),
("одна", "1"),
("одно", "1"),
("плюс", "+"),
("пять", "5"),
("семь", "7"),
("три", "3"),
("умножить", "*"),
("умножь", "*"),
("четыре", "4"),
("шесть", "6"),
("आठ", "8"),
("एक", "1"),
("ग\u{941}णा", "*"),
("घटा", "-"),
("चार", "4"),
("छह", "6"),
("जोड\u{93c}", "+"),
("तीन", "3"),
("दस", "10"),
("दो", "2"),
("नौ", "9"),
("पा\u{901}च", "5"),
("भाग", "/"),
("मॉड\u{94d}य\u{942}लो", "%"),
("श\u{942}न\u{94d}य", "0"),
("सात", "7"),
("一", "1"),
("七", "7"),
("三", "3"),
("乘以", "*"),
("九", "9"),
("二", "2"),
("五", "5"),
("八", "8"),
("六", "6"),
("减去", "-"),
("加上", "+"),
("十", "10"),
("取模", "%"),
("四", "4"),
("除以", "/"),
("零", "0"),
];
// Multi-word operator phrases, mapped to their operator symbol and applied
// before tokenization. Longest first so a phrase is rewritten before any
// shorter phrase it contains ("разделить на" before "делить на").
pub(crate) static WORD_VALUE_PHRASES: &[(&str, &str)] = &[
("multiplied by", "*"),
("разделить на", "/"),
("умножить на", "*"),
("divided by", "/"),
("делить на", "/"),
("по модулю", "%"),
];