Laravel5.8 使用结巴中文分词的简单教程_php中文分词
1.首先用composer加载结巴中文分词-PHP
composer require fukuball/jieba-php:dev-master
2.在composer.json 中引用, 让他自动加载
3.执行 composer dump-autoload 加载
4.使用方法
1 ini_set('memory_limit', '1024M'); 2 3 $jb = new \Fukuball\Jieba\Jieba; 4 $fg = new \Fukuball\Jieba\Finalseg; 5 6 Jieba::init(); 7 Finalseg::init(); 8 $seg_list = Jieba::cut("怜香惜玉也得要看对象啊!"); 9 10 dd($seg_list);
5.效果
参考:
https://learnku.com/articles/13601/the-use-of-php-thesaurus-jieba-and-scws-in-laravel