金子邦彦研究室プログラミングPythonPyEnchant (Python で動くスペルチェッカー) のインストールと試用(Windows 上)

PyEnchant (Python で動くスペルチェッカー) のインストールと試用(Windows 上)

Windows での,PyEnchant のインストール手順を説明する.

PyEnchant は,英語のスペルチェックと,正しい単語の提案の機能を持ったパッケージである.

URL: https://pyenchant.github.io/pyenchant/

謝辞:このページで紹介するソフトウェアの作者に感謝します.

前準備

Python の準備(Windows,Ubuntu 上)

サイト内の関連ページ

関連する外部ページ

Python の公式ページ: https://www.python.org/

PyEnchant のインストール

  1. Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. pip と setuptools の更新

    次のコマンドを実行.

    ※ 「 python -m pip install ...」は,Python パッケージをインストールするためのコマンド.

    Windows での pip の実行では、コマンドプロンプトを管理者として開いて実行することにする。

    python -m pip install -U pip setuptools
    
  3. PyEnchant のインストール

    python -m pip install pyenchant
    
  4. 動作確認のため,Python プログラムを動かす

    https://pyenchant.github.io/pyenchant/tutorial.htmlで公開されているプログラムを使用.

    import enchant
    d = enchant.Dict("en_US")
    d.check("Hello")
    d.check("Helo")
    

    from enchant.checker import SpellChecker
    chkr = SpellChecker("en_US")
    chkr.set_text("This is sme sample txt with erors.")
    for err in chkr:
        print("ERROR:", err.word)
    

    [image]