给出以下几行文字
TOKYO-BLING.1 H02-AVAILABLE
TOKYO-BLING.1 H02-MIDDLING
TOKYO-BLING.1 H02-TOP
TOKYO-BLING.2 H04-USED
TOKYO-BLING.2 H04-AVAILABLE
TOKYO-BLING.2 H04-CANCELLED
WAY-VERING.1 H03-TOP
WAY-VERING.2 H03-USED
WAY-VERING.2 H03-AVAILABLE
WAY-VERING.1 H03-CANCELLED
我想做一些解析来生成一些合理的分组。上面的列表可以按如下方式分组
^{pr2}$有谁能提出一种算法(或某种方法),可以扫描给定数量的文本,并得出文本可以按上述方式分组吗。显然每个小组都可以走得更远。我想我正在寻找一个好的解决方案来查看一个短语列表,并找出如何最好地按一些常见的字符串序列对它们进行分组。在
有一种方法:
实施示例:
用法示例:
^{pr2}$这会产生:
在这里看到它的作用:http://ideone.com/1Da0S
您可以用空格分隔每个字符串,然后生成一个
dict
。在我是这样做的:
这会产生:
^{pr2}$一个Generalized Suffix tree可以工作,suffix array
相关问题 更多 >
编程相关推荐