Home > Article > Backend Development > How to use scws to implement mysql full-text search function in php_PHP tutorial
The example in this article describes how PHP uses scws to implement the full-text search function of mysql. Share it with everyone for your reference. The specific method is as follows:
Chinese word segmentation plug-ins like scws are quite good. I simply studied it. It contains a set of rules for proper names, names of people, names of places, digital ages, etc. You can directly separate sentences into keywords one by one according to these rules, accurately The rate is between 90% and 95%. Follow the installation instructions to put the scws extension into the PHP extension directory, download the rule files and dictionary files, and reference them in the PHP configuration file. Then you can use scws for word segmentation.
1) Modify the php extension code to be compatible with php 5.4.x
2) Fixed the problem that the limit parameter of scws_get_tops in the php extension is not allowed to be less than 10
3) libscws adds scws_fork() to branch from existing scws instances and share dictionaries/rule sets, mainly for multi-threaded development.
4) Added some versions of win32 dll extension
PHP example code is as follows:
Version list
Version Type Platform Performance Others
SCWS-1.1.x C code *Unix*/*PHP* Accuracy: 95%, Recall: 91%, Speed: 1.2MB/sec
PHP extended word segmentation speed: 250KB/sec [Download] [Documentation] [Installation Instructions]
php_scws.dll(1) PHP extension library Windows/PHP 4.4.x Accuracy: 95%, Recall: 91%,
php_scws.dll(2) PHP extension library Windows/PHP 5.2.x Accuracy: 95%, Recall: 91%,
php_scws.dll(3) PHP extension library Windows/PHP 5.3.x Accuracy: 95%, Recall: 91%,
php_scws.dll(4) PHP extension library Windows/PHP 5.4.x Accuracy: 95%, Recall: 91%,
PSCWS23 PHP source code Unlimited (UTF-8 not supported) Accuracy: 93%, Recall: 89%,
PSCWS4 PHP source code No limit Accuracy: 95%, Recall: 91%,
I hope this article will be helpful to everyone’s PHP programming design.