PHPを使って記事からキーワードを抽出するにはどうすればよいですか? PHP は分析中国語と英語の単語セグメンテーションを使用してキーワードを抽出します

1. Analysis をダウンロードし、test.php テストを作成します。

2. 中国語単語分割を実現する分析の導入
<?php
include "./Analysis/Analysis.php";

$an=new \WordAnalysis\Analysis();
$content="机器学习是一门重要的技术,可以用于数据分析和模式识别。";
//10分词数量
$contents=$an::getKeywords($content,10);
var_dump(explode(',',$contents));

3. 英単語の分割を実現する分析の導入 
<?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));

おすすめ

転載: blog.csdn.net/weixin_39934453/article/details/133198284