https://github.com/ttab/elephant-spell
Spelling service for the elephant
https://github.com/ttab/elephant-spell
Last synced: 11 months ago
JSON representation
Spelling service for the elephant
- Host: GitHub
- URL: https://github.com/ttab/elephant-spell
- Owner: ttab
- Created: 2024-10-10T13:09:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-10T11:42:15.000Z (about 1 year ago)
- Last Synced: 2025-05-10T12:32:51.063Z (about 1 year ago)
- Language: Go
- Size: 9.58 MB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elephant spell
Elephant spell is a spellcheck service based on hunspell.
## Custom dictionary support
Register words or phrases in the custom dictionary using the Dictionary API:
``` json
POST twirp/elephant.spell.Dictionaries/SetEntry
{
"entry": {
"language": "sv-se",
"text": "Belarus",
"status": "approved",
"description": "Vitryssland var det gamla namnet på Belarus",
"common_mistakes": [
"Vitryssland"
]
}
}
```
The custom dictionary can be used both to add previously unknown words, and to encourage the replacement of words that doesn't follow your language guidelines.
Then you can call the spellcheck method:
``` json
POST twirp/elephant.spell.Check/Text
{
"language": "sv-se",
"text": [
"Detta är text som är rätstavad, nej, jag menar rätsstavad!",
"Vitryssland är ett land i Europa."
]
}
```
...and get corrections using both the built in Swedish dictionary and your custom dictionary:
``` json
{
"misspelled": [
{
"entries": [
{
"text": "rätstavad",
"suggestions": [
{
"text": "rättstavad"
}
]
},
{
"text": "rätsstavad",
"suggestions": [
{
"text": "rättstavad"
},
{
"text": "lättstavad"
},
{
"text": "rättsstat"
},
{
"text": "vadarstav"
},
{
"text": "stadsrätt"
}
]
}
]
},
{
"entries": [
{
"text": "Vitryssland",
"suggestions": [
{
"text": "Belarus",
"description": "Vitryssland var det gamla namnet på Belarus"
}
]
}
]
}
]
}
```
## Supported languages
We currently bundle the following dictionaries:
* British English
* Danish
* Finnish
* Norwegian Bokmål
* Norwegian Nynorsk
* Swedish
* US English