Compressed pattern matching

Short description: Searching for patterns in compressed data

In computer science, compressed pattern matching (abbreviated as CPM) is the process of searching for patterns in compressed data with little or no decompression. Searching in a compressed string is faster than searching an uncompressed string and requires less space.

## Contents

* 1 Compressed matching problem
* 2 Strategies
* 3 References
* 4 External links

## Compressed matching problem

If the compressed file uses a variable width encoding it could be present a problem: for example, let “100” be the codeword for a and let “110100” be the codeword for b. If we are looking for an occurrence of a in the text we could obtain as result also an occurrence that is within the codeword of b: we call this event false match. So we have to verify if the occurrence detected is effectively aligned on a codeword boundary. However we could always decode the entire text and then apply a classic string matching algorithm, but this usually requires more space and time and often is not possible, for example if the compressed file is hosted online. This problem of verifying the match returned by the compressed pattern matching algorithm is a true or a false match together with the impossibility of decoding an entire text is called the compressed matching problem.[1]

## Strategies

Many strategies exist for finding the boundaries of codewords and avoiding full decompression of the text, for example:

* List of the indices of first bit of each codeword, where we can apply a binary search;
* List of the indices of first bit of each codeword with differential coding, so we can take less space within the file;
* Mask of bit, where bit 1 marks the starting bit of each codeword;
* Subdivision in blocks, for a partial and aimed decompression.

There were introduced algorithms that provide running time that grows logarithmically with the increase of string and pattern length.[2]

## References

1. ↑ Joel Grus (2019). Data Science from Scratch. First Principles with Python. O'Reilly Media. ISBN 9781491901427. https://python.engineering/data-science-from-scratch-first-principles-with-python/. Retrieved 2021-08-26.
2. ↑ Artur Jeż (2013-06-25). "Faster fully compressed pattern matching by recompression". arXiv:1111.3244 [cs.DS].

* Shmuel T. Klein and Dana Shapira PATTERN MATCHING IN HUFFMAN ENCODED TEXTS (2003)
* Marek Karpinski, Wojciech Rytter and Ayumi Shinohara. AN EFFICIENT PATTERN-MATCHING ALGORITHM FOR STRINGS WITH SHORT DESCRIPTIONS. Nordic Journal of Computing 4(2): pp.172-168 (1997).

## External links

* Almost optimal fully LZW-compressed pattern matching. 1999. pp. 316–325.
* A Dictionary-based Compressed Pattern Matching Algorithm, http://cc.ee.ntu.edu.tw/~yen/papers/compsac2002.pdf
* A unifying framework for compressed pattern matching. 1999. pp. 89–96.
* Speeding Up String Pattern Matching by Text Compression: The Dawn of a New Era. http://www.i.kyushu-u.ac.jp/~takeda/papers/IPSJ40.pdf. Retrieved 2009-03-22.
* Shift-and approach to pattern matching in LZW compressed text. 1999. pp. 1–13.
* LZW Algorithm. http://vlsi.cs.ucf.edu/nsf/files/lzw_cpm.pdf.

* v
* t
* e

Strings

String metric|

* Approximate string matching
* Bitap algorithm
* Damerau–Levenshtein distance
* Edit distance
* Gestalt Pattern Matching
* Hamming distance
* Jaro–Winkler distance
* Lee distance
* Levenshtein automaton
* Levenshtein distance
* Wagner–Fischer algorithm

String-searching algorithm|

* Apostolico–Giancarlo algorithm
* Boyer–Moore string-search algorithm
* Boyer–Moore–Horspool algorithm
* Knuth–Morris–Pratt algorithm
* Rabin–Karp algorithm

Multiple string searching|

* Aho–Corasick
* Commentz-Walter algorithm

Regular expression|

* Comparison of regular expression engines
* Regular tree grammar
* Thompson's construction
* Nondeterministic finite automaton

Sequence alignment|

* Hirschberg's algorithm
* Needleman–Wunsch algorithm
* Smith–Waterman algorithm

Data structures|

* DAFSA
* Suffix array
* Suffix automaton
* Suffix tree
* Generalized suffix tree
* Rope
* Ternary search tree
* Trie

Other|

* Parsing
* Pattern matching
* Compressed pattern matching
* Longest common subsequence
* Longest common substring
* Sequential pattern mining
* Sorting

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Compressed pattern matching. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Compressed_pattern_matching&oldid=205704"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template