https://github.com/olekscode/languagedetector
Detects the language of a text
https://github.com/olekscode/languagedetector
pharo
Last synced: 3 months ago
JSON representation
Detects the language of a text
- Host: GitHub
- URL: https://github.com/olekscode/languagedetector
- Owner: olekscode
- License: mit
- Created: 2022-04-01T19:56:56.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-09T16:39:03.000Z (over 3 years ago)
- Last Synced: 2025-02-11T11:41:31.288Z (5 months ago)
- Topics: pharo
- Language: Smalltalk
- Homepage:
- Size: 230 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LanguageDetector
[](https://github.com/olekscode/LanguageDetector/actions/workflows/test.yml)
[](https://coveralls.io/github/olekscode/LanguageDetector?branch=master)
[](https://raw.githubusercontent.com/olekscode/LanguageDetector/master/LICENSE)Detects the language of a text
## How to install it
To install `LanguageDetector`, go to the Playground (Ctrl+OW) in your [Pharo](https://pharo.org/) image and execute the following Metacello script (select it and press Do-it button or Ctrl+D):
```Smalltalk
Metacello new
baseline: 'LanguageDetector';
repository: 'github://olekscode/LanguageDetector/src';
load.
```## How to depend on it
If you want to add a dependency on `LanguageDetector` to your project, include the following lines into your baseline method:
```Smalltalk
spec
baseline: 'LanguageDetector'
with: [ spec repository: 'github://olekscode/LanguageDetector/src' ].
```## How to use it
```Smalltalk
detector := LanguageDetector new.detector languageProbabilitiesFor: 'Hello world!'.
"an OrderedDictionary(
'english'->0.9486880624525642
'spanish'->0.01951642632549062
'german'->0.017971375908055948
'french'->0.01382413531388919
'other'->0.0)"detector languageOf: 'Hello world!'. "'english'"
detector languageOf: 'Bonjour, ça va ?'. "'french'"
detector languageOf: 'Ich heiße Hans'. "'german'"
detector languageOf: 'Yo como los platanos'. "'spanish'"
```