Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
laya-go: PyFloat and pyInt keep U+001C-U+001F, test the digit offset
Adeshina Lasisi163b0e532c67
diff --git a/laya-go/agent/calibration.go b/laya-go/agent/calibration.goindex 8e2c6fb3..75c6093c 100644--- a/laya-go/agent/calibration.go+++ b/laya-go/agent/calibration.go@@ -217,7 +217,7 @@ func versionChecksIdentity(v any) (bool, error) {// pyInt is int(s) for an integer literal: surrounding space, a sign, and Unicode decimal digits// with single underscores between them.func pyInt(s string) (*big.Int, bool) {- s = unicodedata.DecimalASCII(unicodedata.Strip(s))+ s = unicodedata.DecimalASCII(unicodedata.StripNumeric(s))neg := falseif s != "" && (s[0] == '+' || s[0] == '-') {neg = s[0] == '-'diff --git a/laya-go/agent/calibration_golden_test.go b/laya-go/agent/calibration_golden_test.goindex 3040a577..e583f042 100644--- a/laya-go/agent/calibration_golden_test.go+++ b/laya-go/agent/calibration_golden_test.go@@ -319,12 +319,12 @@ func TestVersionAndIntLiterals(t *testing.T) {if ok, err := versionChecksIdentity(json.Number("2.0")); err != nil || !ok {t.Errorf("2.0: %v %v", ok, err)}- for s, want := range map[string]int64{"2": 2, "٢": 2, "0_2": 2, " +2\n": 2, "-0_2": -2} {+ for s, want := range map[string]int64{"2": 2, "٢": 2, "0_2": 2, " +2\n": 2, "-0_2": -2, "\U0001d7ff": 9, "1\U0001d7d8": 10} {if n, ok := pyInt(s); !ok || n.Int64() != want {t.Errorf("pyInt(%q) = %v %v", s, n, ok)}}- for _, s := range []string{"²", "2__0", "_2", "2_", "", "2.0"} {+ for _, s := range []string{"\x1c2", "2\x1f", "²", "2__0", "_2", "2_", "", "2.0"} {if _, ok := pyInt(s); ok {t.Errorf("pyInt(%q) accepted", s)}diff --git a/laya-go/internal/decode/pyfloat_test.go b/laya-go/internal/decode/pyfloat_test.goindex febf2cf3..ba40bb0f 100644--- a/laya-go/internal/decode/pyfloat_test.go+++ b/laya-go/internal/decode/pyfloat_test.go@@ -6,7 +6,7 @@ import ()func TestPyFloat(t *testing.T) {- for s, want := range map[string]float64{"1_5": 15, "1_0.5": 10.5, "2e1_0": 2e10, "1.5": 1.5, "٣": 3,+ for s, want := range map[string]float64{"1_5": 15, "1_0.5": 10.5, "2e1_0": 2e10, "1.5": 1.5, "٣": 3, "\U0001d7d8": 0, "\U0001d7ff": 9, "1\U0001d7ff": 19," 2 ": 2, "-Infinity": math.Inf(-1), "INF": math.Inf(1), "1e400": math.Inf(1), ".5": 0.5, "5.": 5} {if f, ok := PyFloat(s); !ok || f != want {t.Errorf("PyFloat(%q) = %v %v, want %v", s, f, ok, want)@@ -17,7 +17,7 @@ func TestPyFloat(t *testing.T) {t.Errorf("PyFloat(%q) = %v %v", s, f, ok)}}- for _, s := range []string{"1_.5", "1._5", "_1", "1_", "1__0", "0x1p1", "infinit", "²", "2\u200b", "", "1e_1"} {+ for _, s := range []string{"1_.5", "1._5", "_1", "1_", "1__0", "0x1p1", "infinit", "²", "2\u200b", "", "1e_1", "\x1c1", "1\x1f"} {if _, ok := PyFloat(s); ok {t.Errorf("PyFloat(%q) accepted", s)}diff --git a/laya-go/internal/decode/temperature.go b/laya-go/internal/decode/temperature.goindex 08de2b80..2bbab8bf 100644--- a/laya-go/internal/decode/temperature.go+++ b/laya-go/internal/decode/temperature.go@@ -256,7 +256,7 @@ func toFloat(v any) (float64, bool) {// between digits, and a signed nan, inf or infinity in any case. Go's hex floats are refused. A// value past the float range is infinite, as in Python.func PyFloat(s string) (float64, bool) {- s = unicodedata.DecimalASCII(unicodedata.Strip(s))+ s = unicodedata.DecimalASCII(unicodedata.StripNumeric(s))if strings.ContainsAny(s, "xXpP") {return 0, false}diff --git a/laya-go/internal/unicodedata/unicodedata.go b/laya-go/internal/unicodedata/unicodedata.goindex e93e8370..616ceb9e 100644--- a/laya-go/internal/unicodedata/unicodedata.go+++ b/laya-go/internal/unicodedata/unicodedata.go@@ -115,6 +115,12 @@ func Strip(s string) string {return strings.TrimFunc(s, IsSpace)}+// StripNumeric trims what int() and float() trim: str.isspace() characters except U+001C to+// U+001F, which str.isspace() counts and those parsers do not.+func StripNumeric(s string) string {+ return strings.TrimFunc(s, func(r rune) bool { return IsSpace(r) && !(0x1c <= r && r <= 0x1f) })+}+// IsBlank is Python's `not s.strip()`.func IsBlank(s string) bool {for _, r := range s {diff --git a/laya-go/scripts/gen_go_fixtures.py b/laya-go/scripts/gen_go_fixtures.pyindex a2ca111a..b902e794 100644--- a/laya-go/scripts/gen_go_fixtures.py+++ b/laya-go/scripts/gen_go_fixtures.py@@ -1062,7 +1062,7 @@ def _calib_cases():class _CalibObj:def __init__(self, cfg):- self.cfg = cfg # an ONNXAgent keeps the parsed rl_agent_config.json and no model id+ self.cfg = cfg # the parsed rl_agent_config.json; Go has no model id, so it compares against (None, None)def calibration_family():