netolyrg / pyaspeller

Python text speller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python text speller

Build Status Coverage Status Code Health Join the chat at https://gitter.im/oriontvv/pyaspeller

PyPI Installs license Documentation Status

Requirements Status Python versions

License

pyaspeller (Python Yandex Speller) is a search tool typos in the text, files and websites. Used API Yandex.Speller.

Features (under development)

$ pyaspeller "testt reques"
{u'code': 1,
 u'col': 0,
 u'len': 5,
 u'pos': 0,
 u'row': 0,
 u's': [u'test'],
 u'word': u'testt'}
{u'code': 1,
 u'col': 6,
 u'len': 6,
 u'pos': 6,
 u'row': 0,
 u's': [u'request'],
 u'word': u'reques'}

You could use class Word for single word queries:

>>> from pyaspeller import Word
>>> check = Word('tesst')
>>> check.correct
False
>>> check.variants
[u'test']
>>> check.spellsafe
u'test'

For whole text you could use:

>>> from pyaspeller import YandexSpeller
>>> speller = YandexSpeller()
>>> text = 'В суббботу утромь.'
>>> changes = {change['word']: change['s'][0] for change in speller.spell(text)}
>>> for word, suggestion in changes.items():
...     text = text.replace(word, suggestion)
>>> text
'В субботу утром.'

Installation

To install pyaspeller, simply do:

$ pip install pyaspeller
$ pyaspeller --help

Restrictions API Yandex.Speller

speller has some restrictions

About

Python text speller

License:Apache License 2.0


Languages

Language:Python 95.7%Language:Makefile 4.3%