Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olekscode/languagedetector
Detects the language of a text
https://github.com/olekscode/languagedetector
pharo
Last synced: 7 days 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 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-09T16:39:03.000Z (over 2 years ago)
- Last Synced: 2024-10-31T06:41:59.926Z (about 2 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
[![Build status](https://github.com/olekscode/LanguageDetector/workflows/CI/badge.svg)](https://github.com/olekscode/LanguageDetector/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/olekscode/LanguageDetector/badge.svg?branch=master)](https://coveralls.io/github/olekscode/LanguageDetector?branch=master)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](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'"
```