GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - zake7749/word2vec-tutorial: 中文詞向量訓練教學

BranchesTags
Open more actions menu

Latest commit

 

History

26 Commits
26 Commits

Folders and files

NameName
Last commit message
Last commit date
forPython2
forPython2
 
 
jieba_dict
jieba_dict
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
demo.py
demo.py
 
 
segment.py
segment.py
 
 
train.py
train.py
 
 
wiki_to_txt.py
wiki_to_txt.py
 
 

Repository files navigation

使用 gensim 訓練中文詞向量

教學文件

套件需求

  • jieba
pip3 install jieba
  • gensim
pip3 install -U gensim
  • OpenCC (可更換為任何繁簡轉換套件)

訓練流程

1.取得中文維基數據,本次實驗是採用 2016/8/20 的資料。

目前 8 月 20 號的備份已經被汰換掉囉,請前往維基百科:資料庫下載按日期來挑選更新的訓練資料。( 請挑選以pages-articles.xml.bz2為結尾的檔案 )

2.將下載後的維基數據置於與專案同個目錄,再使用wiki_to_txt.py從 xml 中提取出維基文章

python3 wiki_to_txt.py zhwiki-20160820-pages-articles.xml.bz2

若您採用的不是 8 月 20 號的備份,請更換 zhwiki-20160820-pages-articles.xml.bz2 為您採用的備份的檔名。

3.使用 OpenCC 將維基文章統一轉換為繁體中文

opencc -i wiki_texts.txt -o wiki_zh_tw.txt -c s2tw.json

4.使用jieba 對文本斷詞,並去除停用詞

python3 segment.py

5.使用gensim 的 word2vec 模型進行訓練

python3 train.py

6.測試我們訓練出的模型

python3 demo.py

About

中文詞向量訓練教學

zake7749.github.io/2016/08/28/word2vec-with-gensim/

Topics

gensimword2vec

Resources

Readme
MIT license
Activity

Stars

522 stars

Watchers

18 watching

Forks

161 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.