{"record":{"id":"3e5a7d0b800a9e65","repo":"Humanizr/Humanizer","slug":"unrecognized-number-word-unrecognizedword-3e5a7d","errorCode":null,"errorMessage":"Unrecognized number word: {unrecognizedWord}","messagePattern":"Unrecognized number word: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/WordsToNumber/LinkedVigesimalWordsToNumberConverter.cs","lineNumber":15,"sourceCode":"namespace Humanizer;\n\n/// <summary>\n/// Parses linked-vigesimal words with scale nouns before their count words.\n/// </summary>\ninternal class LinkedVigesimalWordsToNumberConverter(LinkedVigesimalWordsToNumberProfile profile) : GenderlessWordsToNumberConverter\n{\n    readonly LinkedVigesimalWordsToNumberProfile 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            parsedValue = default;\n            unrecognizedWord = words ?? string.Empty;\n            return false;\n        }","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/WordsToNumber/LinkedVigesimalWordsToNumberConverter.cs#L1-L33","documentation":"This ArgumentException is thrown by LinkedVigesimalWordsToNumberConverter.Convert (the throwing entry point) when TryConvert returns false. This converter handles linked-vigesimal number words where scale nouns appear before their count words (e.g. Welsh, Breton, Irish style). The error fires when the input phrase contains a token that cannot be matched as an exact word, ordinal, scale name, scale count, or terminal remainder joiner. The unrecognized word or full input is included in the message.","triggerScenarios":"Calling \"words\".ToNumber(culture) for a linked-vigesimal locale with a phrase containing a token not in the locale's exact-words dictionary, ordinal map, or scale vocabulary, or a phrase whose structure does not match the scale-noun-before-count grammar.","commonSituations":"Free-text user input with misspellings or words from a different language; locale mismatch; ordinal phrases not authored in the locale's ordinal map; scale count words outside the locale's range; input with Unicode or diacritic differences the normalizer does not handle; phrases where the terminal remainder joiner is missing or incorrect.","solutions":["Use TryToNumber(words, out value, culture, out unrecognizedWord) for user-facing or untrusted input.","Verify the input phrase follows the locale's grammar: scale noun, then count, optionally joined by a remainder word.","Inspect the unrecognizedWord to locate the first unmatched token.","Ensure the culture matches the language of the words and that the locale has full vocabulary coverage."],"exampleFix":"// before\nlong value = phrase.ToNumber(new CultureInfo(\"cy\"));\n\n// after\nif (!phrase.TryToNumber(out var value, new CultureInfo(\"cy\"), out var bad))\n    Console.WriteLine($\"Unrecognized: {bad}\");","handlingStrategy":"try-catch","validationCode":"bool canParse = words.TryToNumber(out var value, culture, out var unrecognized);\nif (!canParse)\n    Console.WriteLine($\"Unrecognized: {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(\"cy\"));\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unrecognized number word\"))\n{\n    return 0;\n}","preventionTips":["Use TryToNumber for user-facing or untrusted input.","Verify the input phrase follows the locale's scale-noun-before-count grammar.","Inspect the unrecognizedWord to locate the first unmatched token.","Ensure the culture matches the language and the locale has full vocabulary coverage."],"tags":["argumentexception","words-to-number","linked-vigesimal","unrecognized-word","parsing"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}