Download the PHP package one23/language-detection without Composer
On this page you can find all versions of the php package one23/language-detection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download one23/language-detection
More information about one23/language-detection
Files in one23/language-detection
Package language-detection
Short Description PHP ngram language detection
License MIT
Homepage https://github.com/FlexIDK/language-detection
Informations about the package language-detection
PHP ngram language detection
PHP library that detects the language from a text string.
Features
- More than 350 supported languages
- Very fast, no database needed
- Packaged with a 500kb dataset
- Learning steps are already done, library is ready to use
- Small code, small footprint
- N-grams algorithm
- Supports PHP 8.0
Install
Quick usage
API Methods
__constructor(array $options)
evaluate(string $str): self
It performs an evaluation on a given text.
getLanguage(): string
The detected language
getLanguages(): string[]
A list of loaded models that will be evaluated.
getScores(): array
A list of loaded models that will be evaluated.
getSupportedLanguages(): string[]
A list of supported languages that will be evaluated.
setDictionary(string $dict): self
setOnly(array $lang): self
getOnly(array $lang): ?array
Get limited languages by supported languages
getText(): string
Returns the last string which has been evaluated
For one-liners only
Detector639 is extends Detector
getScores(): array
A list of loaded models that will be evaluated.
getSupportedLanguages(): string[]
A list of supported iso-639-1 languages that will be evaluated.
getLanguages(): Code3Min[]
A list of loaded models that will be evaluated.
code1(): Code1
code2t(): Code2t
code2b(): Code2b
code3(): Code3Min
Use
Additionals
Ngram
What's this?
This package gets you bigrams, trigrams, all the n-grams!
Use
Utils\Trigram
Use
Utils\WhitespaceCollapse
Use
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.