vench / php-lsa
vench/php-lsa
1.0.1
2018-10-02 20:53 UTC
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: ^6.5 || ^7.0
This package is auto-updated.
Last update: 2024-09-13 02:38:43 UTC
README
在PHP实现语言中的奇异值分解。
此软件包可以分析文本,以查找与给定术语的关系。
它可以将包含文本文档字符串的数组作为输入,并转换它们以便可以进行查询。
该软件包还可以接受给定的文本并执行查询,以返回与原始文本文档数组中给定的文本匹配更好的文档的索引。
安装
composer require vench/php-lsa
示例
查找最相似的文本。
$documents = [
"The quick brown fox jumped over the lazy dog",
"hey diddle diddle, the cat and the fiddle",
"the cow jumped over the moon",
"the little dog laughed to see such fun",
"and the dish ran away with the spoon",
];
$lsa = new LSA(4);
$trans = $lsa->fitTransform($documents);
$query = "the brown fox ran around the dog";
$index = $lsa->query($query, $trans);
echo $documents[$index], PHP_EOL;
待办事项
- 添加保存数据
- 添加加载数据
- 更改转换