GithubHelp home page GithubHelp logo

hhself / chinese_wubi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arcsecw/wubi

2.0 2.0 0.0 451 KB

中文 五笔字型码 拼音相互转换工具 中文语料转换后可以直接应用于字符级自然语言模型中

Python 100.00%

chinese_wubi's Introduction

##五笔字型码与汉字转换工具

背景:当前自然语言处理模型中单词级模型效果很好,但是由于英文单词天然由空格隔开,中文只有连续的字与标点,为了将各种单词级语言模型应用于中文,中文分词成了中文自然语言处理领域一个基础性研究。近来研究表明,在很多神经网络模型中,字符级语言模型效果也很好,而且从长远来看,由于字符级语言模型比单词级语言模型保留了更多的原始信息,随着神经网络模型的发展以及计算能力的提高,字符级语言模型的效果应该会更好。

将每一个中文汉字当做一个字符输入字符级语言模型会导致很多问题,实验效果相对英文语料来说并不理想,经实,验先将中文汉字转化为五笔字型码,输入模型计算后再将五笔字型码转换回汉字直观效果与英文语料相近。

本着分享的精神将这一想法供广大的中文自然语言处理的童鞋一起分享,同时将我自己写的小工具开源出来。欢迎各位试用,有任何问题麻烦各位发issues。

喜欢就star一下

依赖

pip install pinyin

##使用 git clone [email protected]:arcsecw/chinese_wubi.git cd chinese_wubi python w_trans.py --input your.input.file

参数

--input 输入文件
--output 指定输出文件 不指定的话默认为input文件后加个后缀.out
--type 0 中文转化为五笔字形码 1 五笔转化回中文 2 中文转化为拼音

##程序中使用 from w_trans import W_trans m_trans = W_trans() outputfile = m_trans.chinese_wubi('chinese.txt', 'chinese_wubi.txt')

chinese_wubi's People

Contributors

arcsecw avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.