Skip to content

Commit

Permalink
✨ feat: add .nerve.toml configuration file for language detection
Browse files Browse the repository at this point in the history
#2

- Add contributor information
- Set language to English
- Enable automatic issue labeling, title formatting, and report closing with issues
  • Loading branch information
sudoskys committed Jul 6, 2024
1 parent 476d892 commit 45fd124
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ print(detect_langs("你好,世界!"))
## Advanced usage 🚀

```python
from fast_langdetect import detect, parse_sentence, detect_multilingual
from fast_langdetect import detect, detect_multilingual

print(detect("Hello, world!"))
# {'lang': 'en', 'score': 0.1520957201719284}

print(detect_multilingual("Hello, world!你好世界!Привет, мир!"))
# [{'lang': 'ru', 'score': 0.39008623361587524}, {'lang': 'zh', 'score': 0.18235979974269867}, {'lang': 'ja', 'score': 0.08473210036754608}, {'lang': 'sr', 'score': 0.057975586503744125}, {'lang': 'en', 'score': 0.05422825738787651}]

print(parse_sentence("你好世界!Hello, world!Привет, мир!"))
# [{'text': '你好世界!Hello, world!', 'lang': 'ZH', 'length': 18}, {'text': 'Привет, мир!', 'lang': 'UK', 'length': 12}, {'text': '', 'lang': 'EN', 'length': 0}]
```

### Splitting text by language 🌐

check out the [split-lang](https://github.com/DoodleBears/split-lang).

## Accuracy 🎯

References to the [benchmark](https://github.com/zafercavdar/fasttext-langdetect#benchmark)

0 comments on commit 45fd124

Please sign in to comment.