Helpers to try to guess the language text is written in.
Methods
(inner) detectForeignScriptLanguage(str) → {string|undefined}
Returns the language code of the matched regex (if any). Not as thorough as
detectLanguage
and only meant for non Latin scripts like japanese, korean, etc.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to check. |
Returns:
The language code if detected, otherwise undefined.
- Type
- string | undefined
(inner) detectLangWithLangDetector(text) → {DetectLangLibraryResult}
Use LanguageDetect library to detect language.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text to detect the language of. |
Returns:
The detected language information.
- Type
- DetectLangLibraryResult
(inner) detectLangWithTinyLD(text) → {DetectLangLibraryResult}
Use tinyLD library to detect language.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text to detect the language of. |
Returns:
The detected language information.
- Type
- DetectLangLibraryResult
(inner) detectLanguage(text) → {LanguageDetectInfo}
Use the two different language detectors to guess a language.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text to detect the language of. |
Returns:
The detected language information.
- Type
- LanguageDetectInfo
(inner) languageName()
Convert a language code like "jp" into a language name like "Japanese".