Jump to content

Compressed pattern matching

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Pintoch (talk | contribs) at 14:25, 10 November 2016 (External links: change |id={{citeseer}} to |citeseerx= using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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.

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. 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.

References

  • "Almost optimal fully LZW-compressed pattern matching". CiteSeerX 10.1.1.44.5521. {{cite journal}}: Cite journal requires |journal= (help)
  • A Dictionary-based Compressed Pattern Matching Algorithm (PDF), archived from the original (PDF) on March 13, 2003 {{citation}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  • "A unifying framework for compressed pattern matching". CiteSeerX 10.1.1.50.1745. {{cite journal}}: Cite journal requires |journal= (help)
  • "Speeding Up String Pattern Matching by Text Compression: The Dawn of a New Era" (PDF). {{cite journal}}: Cite journal requires |journal= (help)
  • "Shift-and approach to pattern matching in LZW compressed text". CiteSeerX 10.1.1.15.4609. {{cite journal}}: Cite journal requires |journal= (help)
  • "LZW Algorithm" (PDF). {{cite journal}}: Cite journal requires |journal= (help)