Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 查找一组字符串之间的关联程度_Php_Javascript_Algorithm - Fatal编程技术网

Php 查找一组字符串之间的关联程度

Php 查找一组字符串之间的关联程度,php,javascript,algorithm,Php,Javascript,Algorithm,我有一个字符串数组(如示例所示)。我只是想知道他们中最常见的是什么。最常见的字符串定义为:-如果Apple Ipod touch出现10次(比如说),而Apple Ipod出现8次,那么我会说Apple Ipod touch在所有元素中都是主导/常见字符串 Apple iPod touch, 8GB (with FaceTime Camera and Retina Display) Aple Ipod Clasic 80gb 6th Generation Black iPod classic 1

我有一个字符串数组(如示例所示)。我只是想知道他们中最常见的是什么。最常见的字符串定义为:-如果Apple Ipod touch出现10次(比如说),而Apple Ipod出现8次,那么我会说Apple Ipod touch在所有元素中都是主导/常见字符串

Apple iPod touch, 8GB (with FaceTime Camera and Retina Display)
Aple Ipod Clasic 80gb 6th Generation Black
iPod classic 160GB - Silver
Apple 8GB iPod Touch
Apple Ipod Touch 8gb 4th Generation Mc540ll/a 8 Gb Newest Model
Apple iPod touch Black 4th Generation 8GB Touch Screen Wi-Fi MP3
Apple 8GB iPod touch�
Apple 8GB iPod touch MC540LL/A
Apple MC540LL/A - 8GB iPod Touch w/ Camera (4th Gen) (Newest Model)
Apple iPod Touch - 8 GB - Electronics
Apple iPod 8GB 4th Generation Black Touch
Apple iPod touch 8GB 4th Gen (Refurbished)
Apple Ipod Touch Digital Player - Apple Ios 5
Apple Ipod Touch 8G - White (4Th Gen)
Apple MC540LL/A iPod Touch 8GB (4th Generation)
(refurbished) Apple Ipod Touch 8gb (4th Generation)
Apple Ipod Touch 8Gb 4Th Generation
iPod Touch 8GB (4th Gen)
Apple Ipod Touch 32G - White (4Th Gen)
Apple iPod touch 8GB (4th Gen), White
Apple iPod touch White 4th Generation 8GB Touch Screen Wi-Fi MP3
Apple 32GB Black 4th Generation iPod Touch - MC544LL/A
Apple 8GB iPod touch�
Apple iPod touch 8GB - White - Electronics
Apple MC544LL/A - 32GB iPod Touch w/ Camera (4th Gen) (Newest Model)
那么,有人能给我推荐一些好的算法吗?问题是我没有任何标准/基准可供比较。我只需要比较它们之间的所有元素,找出最常见的元素。这必须用PHP或Javascript实现


希望我的问题清楚。如果我不清楚,请发表评论。

我不确定您是否使用过PHP的
类似的\u text
函数,或者是否有类似的javascript函数。一个快速的谷歌搜索也显示了这一点


编辑:类似的文本Javascript函数

那么您想要出现在大多数行中的子字符串(可能只有完整的字数)?因为那将是苹果公司。或者您想要显示在多行中的最长子字符串?您要查找的字符串是整行还是其中的一部分?另外,您的搜索是否区分大小写?字符串应尽可能长且不区分大小写。我可以从上述列表中生成建议列表。我应该使用什么算法?