windoze / wordseg Goto Github PK
View Code? Open in Web Editor NEWA simple word segment lib for Chinese
A simple word segment lib for Chinese
This is a small library which can segment Chinese phrases. The library contains only one class "wordseg" wordseg.load_dict(dictionary_file) Load the dictionary. There is a default dictionary under data, based on People's Daily materials, and you can provide your own segment(phrase, include_cjk_word, include_cjk_ideogram) Segment phrase. If include_cjk_word is True, result includes all non-CJK words and CJK phrase is broken into words. If include_cjk_ideogram is True, result includes all non-CJK words and CJK phrase is broken into ideograms. If both are set, result includes both segmentations, note non-CJK words will be included twice. This library also do some transformations to latin words, i.e. "Café" will be transformed into "cafe", this could be usedful when you are build full-text search index as user may want "Café" while they are searching "cafe". TODO: 1. Now the lib uses a weighted shortest path algorithm to break CJK phrases, with some optimizations, generally the result should be better than MMSeg(http://technology.chtsai.org/mmseg/) and close to HMM, but there still some error cases, try "make test" to check out. This cannot be easily solved without more domain specific materials and more advanced algorithm, such as HMM. 2. Latin transformation should be configurable, this is not priority as I'm using this lib in a search engine :-) 3. CJK names, this is a major lack 4. CJK numbers, well, low priority 5. Code cleanup, a lot of test/debug code still exists. Thanks to [email protected] and his/her very easy-to-use UTF8CPP(http://utfcpp.sourceforge.net/) project; also thanks to C++ standard committee for their slow-and-buggy Unicode I/O support in STL.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.