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
fix(dotnet): match Python default and mixed-language route reasons
kevin-gatimuf3a4fcea1723
diff --git a/laya-dotnet/src/Laya/LayaRouter.cs b/laya-dotnet/src/Laya/LayaRouter.csindex 8c428eab..c6e7c41b 100644--- a/laya-dotnet/src/Laya/LayaRouter.cs+++ b/laya-dotnet/src/Laya/LayaRouter.cs@@ -41,7 +41,8 @@ public sealed class LayaRouterOptionspublic int MaxLoaded { get; set; } = 1;/// <summary>- /// Checkpoint used when a state has no letters at all (script <c>"unknown"</c>). Default+ /// Checkpoint used when a state has no letters or its Latin language is undetermined without+ /// non-English evidence. Default/// <see cref="LayaCheckpoint.English"/>, matching Python's default./// </summary>public LayaCheckpoint Default { get; set; } = LayaCheckpoint.English;@@ -266,13 +267,21 @@ public sealed class LayaRouter : ILayaPredictor, IDisposableelse if (!det.IsEnglish){model2 = LayaCheckpoint.Multilingual;- reason = det.Language is { } identified+ reason = det.MixedSegment is { Length: > 0 } mixed+ ? $"Latin script, mostly English, but a line or field reads as {PyRepr(det.Language!)} "+ + $"({PyRepr(LanguageDetection.SliceCodePoints(mixed, 60))}); the English checkpoint cannot read it"+ : det.Language is { } identified? $"Latin script but language looks like {PyRepr(identified)}, not English"// Unidentified Latin-script language: routed on the non-English letters alone,// because no stopword list here covers it.: $"Latin script, language not identified but {FormatPercent0(det.DiacriticRate)}% "+ "non-English letters; not safe for the English checkpoint";}+ else if (det.LanguageUndecided)+ {+ model2 = Default;+ reason = $"Latin script, language not identified and no non-English letters; using default ({CheckpointName(model2)})";+ }else{model2 = LayaCheckpoint.English;diff --git a/laya-dotnet/tests/Laya.Tests/LayaRouterTests.cs b/laya-dotnet/tests/Laya.Tests/LayaRouterTests.csindex a193c15d..758b6da4 100644--- a/laya-dotnet/tests/Laya.Tests/LayaRouterTests.cs+++ b/laya-dotnet/tests/Laya.Tests/LayaRouterTests.cs@@ -471,6 +471,8 @@ public sealed class LayaRouterTestsAssert.Equal(wantDetection.GetProperty("language_undecided").GetBoolean(), got.LanguageUndecided);Assert.Equal(wantDetection.GetProperty("diacritic_rate").GetDouble(), got.DiacriticRate, 1e-9);Assert.Equal(wantDetection.GetProperty("non_latin_fraction").GetDouble(), got.NonLatinFraction, 1e-9);+ Assert.Equal(wantDetection.GetProperty("mixed_segment").ValueKind == JsonValueKind.Null+ ? null : wantDetection.GetProperty("mixed_segment").GetString(), got.MixedSegment);}}