如何提取php5中两个或多个段落之间的常用词?
我想总结每个文本以创建排名靠前的单词列表可能会起作用
然后比较它们。
我想最基本的方法是:
-
split each paragraph into an array of words, using either explode http://fr.php.net/explode or preg_split http://fr.php.net/preg_split
- maybe, do some filtering on the list of words :
- clean each word
- 删除特殊字符,例如重音字母
- 将所有内容转换为小写/大写,以帮助您稍后进行比较
- remove 太常见了 words
- remove 过短 words
-
array_filter https://www.php.net/array_filter,在这里,可能会有所帮助
- 然后,得到两个数组中的单词列表,使用类似的东西array_intersect https://www.php.net/manual/en/function.array-intersect.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)