Python Chinese Word Segmentation implementation method (install pymmseg ),
This example describes how to implement Chinese Word Segmentation in Python. We will share this with you for your reference. The details are as follows:
In Python, pymmseg-cpp is very convenient!
Environment ubuntu10.04, python2.65
Steps:
1. Download the source code of mmseg-cpp.Http://code.google.com/p/pymmseg-cpp/
2. Execute:
Tar-zxf pymmseg-cpp * .tar.gz // decompress the package to obtain the pymmseg directory cd pymmseg \ mmseg-cpppython build. py # generate the mmseg. so file.
3. Copy the pymmseg directory to/usr/local/lib/python2.6/dist-packages.
4. Is the test successful:
Test. py file:
From pymmseg import mmsegmmseg. dict_load_defaults () text = 'today's weather is really good. Let's go out and play together. 'algor = mmseg. algorithm (text) for tok in algor: print '% s [% d .. % d] '% (tok. text, tok. start, tok. end)