{"record":{"id":"abf9db595d1f66f4","repo":"Humanizr/Humanizer","slug":"unrecognized-number-word-unrecognizedword-abf9db","errorCode":null,"errorMessage":"Unrecognized number word: {unrecognizedWord}","messagePattern":"Unrecognized number word: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/WordsToNumber/EastAsianPositionalWordsToNumberConverter.cs","lineNumber":15,"sourceCode":"namespace Humanizer;\n\n/// <summary>\n/// Parses East Asian positional number words made up of digits, small units, and large units.\n/// </summary>\ninternal class EastAsianPositionalWordsToNumberConverter(EastAsianPositionalWordsToNumberProfile profile) : GenderlessWordsToNumberConverter\n{\n    readonly EastAsianPositionalWordsToNumberProfile profile = profile;\n\n    /// <inheritdoc />\n    public override long Convert(string words)\n    {\n        if (!TryConvert(words, out var parsedValue, out var unrecognizedWord))\n        {\n            throw new ArgumentException($\"Unrecognized number word: {unrecognizedWord}\");\n        }\n\n        return parsedValue;\n    }\n\n    /// <inheritdoc />\n    public override bool TryConvert(string words, out long parsedValue) =>\n        TryConvert(words, out parsedValue, out _);\n\n    /// <inheritdoc />\n    public override bool TryConvert(string words, out long parsedValue, out string? unrecognizedWord)\n    {\n        if (string.IsNullOrWhiteSpace(words))\n        {\n            throw new ArgumentException(\"Input words cannot be empty.\");\n        }\n\n        var normalized = words.Replace(\" \", string.Empty).Trim();","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/WordsToNumber/EastAsianPositionalWordsToNumberConverter.cs#L1-L33","documentation":"This ArgumentException is thrown by EastAsianPositionalWordsToNumberConverter.Convert when TryConvert fails. This converter parses positional number words (Chinese/Japanese/Korean style) composed of digits, small units (tens/hundreds), and large units (thousands/ten-thousands). The error fires when the normalized input contains a character or multi-character token that is not in the locale's digit, small-unit, or large-unit token tables.","triggerScenarios":"Calling \"words\".ToNumber(culture) for an East Asian positional locale with a string containing characters not registered as digits or units, or mixing scripts from different locales.","commonSituations":"User input containing non-numeric CJK characters; mixing Simplified Chinese characters with a Japanese locale or vice versa; passing Latin-alphabet words to a CJK locale; input with Unicode variants or full-width characters not in the token map; ordinal affixes the locale did not configure.","solutions":["Use TryToNumber(words, out value, culture, out unrecognizedWord) for any input that may be invalid.","Verify the input uses the correct script and character set for the target locale.","Pre-filter input to known digit and unit characters if the source is unstructured text.","Check the unrecognizedWord to identify the offending character or token."],"exampleFix":"// before\nlong value = input.ToNumber(new CultureInfo(\"ja\"));\n\n// after\nif (!input.TryToNumber(out var value, new CultureInfo(\"ja\"), out var bad))\n    Console.WriteLine($\"Unrecognized token: {bad}\");","handlingStrategy":"try-catch","validationCode":"bool canParse = words.TryToNumber(out var value, culture, out var unrecognized);\nif (!canParse)\n    Console.WriteLine($\"Unrecognized token: {unrecognized}\");","typeGuard":"static bool LooksLikeNumberWords(string words, CultureInfo culture) =>\n    !string.IsNullOrWhiteSpace(words) && words.TryToNumber(out _, culture, out _);","tryCatchPattern":"try\n{\n    return words.ToNumber(new CultureInfo(\"ja\"));\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unrecognized number word\"))\n{\n    return 0;\n}","preventionTips":["Use TryToNumber for CJK input that may contain non-numeric characters.","Verify the input uses the correct script and character set for the target locale.","Pre-filter input to known digit and unit characters when the source is unstructured text.","Check for full-width or Unicode variant characters that may not be in the token map."],"tags":["argumentexception","words-to-number","east-asian","positional","unrecognized-word","parsing"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}