Piece tool

The word segmentation tool I use is the open source version of the Institute of Computing Technology, Chinese Academy of Sciences ICTCLAS. There is also an open source Bamboo, I will also investigate the tool later.

It is a good choice to start from ICTCLAS, because its algorithm is widely spread, there are open academic documents, and compilation Simple, with few library dependencies. But currently only C/C++, Java and C# versions of the code are provided, and no PHP version of the code. What to do? Maybe you can learn its C/C++ source code and academic documents, and then develop A PHP version comes out. However, I want to use inter-process communication to call the C/C++ version of the executable file in the PHP code.

After downloading the source code and decompressing it, on a machine with a C++ development library and a compilation environment Just make ictclas directly on it. There is an error in its Makefile script. The code that executes the test does not add’./’. Of course, it can’t be executed successfully like under Windows. But it does not affect the compilation result. The PHP class for Chinese word segmentation is just Below, use the proc_open() function to execute the word segmentation program, and interact with it through the pipeline, enter the text to be segmented, and read the word segmentation result.

php ictclas word segmentation demo

p>

Leave a Comment

Your email address will not be published.