简洁无减速的字典匹配
Succinct Dictionary Matching With No Slowdown
摘要:
字典匹配问题是字符串匹配中的一个经典问题:给定一个由d个字符串组成的集合S,其总长度为n个字符,在一个大小为sigma的字母表上(不一定是常数),建立一个数据结构,使得我们可以在任何文本T中匹配属于S的所有字符串。这个问题的经典解决方案是Aho-Corasick自动机,它使用占用O(mlog m)位空间的数据结构在O(|T| + occ)时间内找到文本T中所有occ出现,其中m <= n + 1是自动机中的状态数。在本文中,我们表明,Aho-Corasick自动机可以表示在短短的m(log sigma + O(1))+ O(d log(n/d))位的空间,同时仍然保持在O(|T| + occ)时间回答查询的能力。据我们所知,目前最快的简洁的数据结构的字典匹配问题使用的空间O(n log sigma),而在O(|T| log log n + occ)时间回答查询。在本文中,我们还展示了如何将空间占用减少到m(H 0 + O(1))+ O(d log(n/d)),其中H 0是出现在集合S的trie表示中的字符的经验熵,假设对于任何常数0 <n < 1,sigma < m^n。查询时间保持不变。
英文摘要:
The problem of dictionary matching is a classical problem in string matching: given a set S of d strings of total length n characters over an (not necessarily constant) alphabet of size sigma, build a data structure so that we can match in a any text T all occurrences of strings belonging to S. The classical solution for this problem is the Aho-Corasick automaton which finds all occ occurrences in a text T in time O(|T| + occ) using a data structure that occupies O(m log m) bits of space where m <= n + 1 is the number of states in the automaton. In this paper we show that the Aho-Corasick automaton can be represented in just m(log sigma + O(1)) + O(d log(n/d)) bits of space while still maintaining the ability to answer to queries in O(|T| + occ) time. To the best of our knowledge, the currently fastest succinct data structure for the dictionary matching problem uses space O(n log sigma) while answering queries in O(|T|log log n + occ) time. In this paper we also show how the space occupancy can be reduced to m(H0 + O(1)) + O(d log(n/d)) where H0 is the empirical entropy of the characters appearing in the trie representation of the set S, provided that sigma < m^epsilon for any constant 0 < epsilon < 1. The query time remains unchanged.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。