1、下载Analysis,创建test.php测试
2、引入Analysis实现中文分词
<?php
include "./Analysis/Analysis.php";$an=new \WordAnalysis\Analysis();
$content="机器学习是一门重要的技术,可以用于数据分析和模式识别。";
//10分词数量
$contents=$an::getKeywords($content,10);
var_dump(explode(',',$contents));
3、引入Analysis实现英文分词
<?php
include "./Analysis/Analysis.php";$an=new \WordAnalysis\Analysis();
$content="Machine learning is a branch of AI that enables computers to learn and make predictions without being explicitly programmed.";
//10分词数量
$contents=$an::getKeywords($content,10);
var_dump(explode(',',$contents));