Document2Vec を使ってみる

Finding document vectors from pre-trained word2vec word vectors

先人に感謝.

前準備

Python のインストール(Windows上)

注:既にPython(バージョン3.12を推奨)がインストール済みの場合は,この手順は不要である.

winget(Windowsパッケージマネージャー)を使用してインストールを行う

  1. Windowsで,コマンドプロンプト管理者権限で起動する(例:Windowsキーを押し,「cmd」と入力し,「管理者として実行」を選択)
  2. winget(Windowsパッケージマネージャー)が利用可能か確認する:
    winget --version
    
  3. Pythonのインストール(下のコマンドにより Python 3.12 がインストールされる).
    winget install --scope machine Python.Launcher
    winget install --scope machine Python.Python.3.12
    
  4. 【関連する外部サイト】

    【サイト内の関連ページ】

    Git のインストール

    Git の URL: https://git-scm.com/

    • Windows での Git のインストール: 別ページ »で説明
    • Ubuntu での Git のインストール:

      端末で,次のコマンドを実行

      sudo apt -y update
      sudo apt -y install git
      

    Document2Vec のインストール

    cemoody/Document2Vec の Web ページ: https://github.com/cemoody/Document2Vec

    1. Windows で,コマンドプロンプト管理者権限で起動する(例:Windowsキーを押し,「cmd」と入力し,「管理者として実行」を選択)
    2. ダウンロードとインストール
      cd /d c:%HOMEPATH%
      rmdir /s /q Document2Vec
      git clone https://github.com/cemoody/Document2Vec
      cd Document2Vec
      python -m pip install pandas numpy gensim
      
    3. インストールが成功したかを確認したい.

      新しくコマンドプロンプトを開き, 次のコマンドを順に実行.エラーメッセージが出なければ成功.

      cd /d c:%HOMEPATH%
      cd Document2Vec
      python
      import document2vec
      exit()