測試環境為 CentOS 8 x86_64 (虛擬機)
TextBlob 的 拼字檢查 是它綜多功能的其中一種,參考文章 – https://textblob.readthedocs.io/en/dev/quickstart.html#spelling-correction
首先安裝 textblob 套件.
[root@localhost ~]# pip install textblob
[root@localhost ~]# python3 Python 3.6.8 (default, Sep 21 2021, 20:17:36) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information.
匯入 textblob 模駔.
>>> from textblob import TextBlob
測試一下,其中 have good spelling 都拼錯.
>>> b = TextBlob("I havv goood speling!")
都已更正成正確的拼法.
>>> print(b.correct()) I have good spelling!
沒有解決問題,試試搜尋本站其他內容