finding characteristic substrings from compressed texts
play

Finding Characteristic Substrings from Compressed Texts Shunsuke - PowerPoint PPT Presentation

Finding Characteristic Substrings from Compressed Texts Shunsuke Inenaga Kyushu University, Japan Hideo Bannai Kyushu University, Japan Text Mining and Text Compression Text mining is a task of finding some rule and/or knowledge from given textual


  1. Finding Characteristic Substrings from Compressed Texts Shunsuke Inenaga Kyushu University, Japan Hideo Bannai Kyushu University, Japan

  2. Text Mining and Text Compression Text mining is a task of finding some rule and/or knowledge from given textual data. Text compression is to reduce a space to store given textual data by removing redundancy. compress decompress

  3. Our Contribution We present efficient algorithms to find characteristic substrings (patterns) from given compressed strings directly (i.e., without decompression ). Longest repeating substring (LRS) Longest non ‐ overlapping repeating substring (LNRS) Most frequent substring (MFS) Most frequent non ‐ overlapping substring (MFNS) Left and right contexts of given pattern

  4. Text Compression by Straight Line Program SLP T X 1 = a X 2 = b X 3 = X 1 X 2 X 4 = X 3 X 1 X 5 = X 3 X 4 X 6 = X 5 X 5 X 7 = X 4 X 6 X 8 = X 7 X 5 T = SLP T is a CFG in the Chomsky normal form which generates language { T } .

  5. Text Compression by Straight Line Program SLP T X 1 = a X 2 = b X 3 = X 1 X 2 X 4 = X 3 X 1 X 5 = X 3 X 4 X 6 = X 5 X 5 X 7 = X 4 X 6 X 8 = X 7 X 5 T = Encodings of the LZ ‐ family, run ‐ length, Sequitur, etc. can quickly be transformed into SLP.

  6. Exponential Compression by SLP Highly repetitive texts can be exponentially large w.r.t. the corresponding SLP ‐ compressed texts. Text T = ababab…ab ( T is an N repetition of ab ) SLP T : X 1 = a, X 2 = b, X 3 = X 1 X 2 , X 4 = X 3 X 3 , X 5 = X 4 X 4 , ... , X n = X n -1 X n -1 N = O (2 n ) Any algorithms that decompress given SLP ‐ compressed texts can take exponential time! We present efficient (i.e., polynomial ‐ time ) algorithms without decompression .

  7. Finding Longest Repeating Substring Input: SLP T which generates text T Output: A longest repeating substring (LRS) of T ≠ T ≠ Example T = aabaabcabaabb

  8. Key Observation – 6 Cases of Occurrences of LRS X i X i X i X l X l X l X r X r X r Case 1 Case 2 Case 3 X i X i X i X l X l X l X r X r X r Case 4 Case 5 Case 6

  9. Algorithm to Compute LRS Input : SLP T Output : LRS of text T foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  10. Algorithm to Compute LRS Input : SLP T X i Output : LRS of text T foreach variable X i of SLP T do X l X r compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; Case 1 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  11. Algorithm to Compute LRS Input : SLP T X i Output : LRS of text T foreach variable X i of SLP T do X l X r compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; Case 1 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  12. Algorithm to Compute LRS Input : SLP T Output : LRS of text T foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  13. Algorithm to Compute LRS Input : SLP T X i Output : LRS of text T foreach variable X i of SLP T do X l X r compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; Case 2 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  14. Algorithm to Compute LRS Input : SLP T X i Output : LRS of text T foreach variable X i of SLP T do X l X r compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; Case 2 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  15. Algorithm to Compute LRS Input : SLP T Output : LRS of text T foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; compute LRS of Case 3; compute LRS of Case 4; compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  16. Algorithm to Compute LRS X i Input : SLP T Output : LRS of text T X l X r foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; Case 3 compute LRS of Case 3; compute LRS of Case 4; compute LRS of Case 5; compute LRS of Case 6; LRS of X i of Case 3 is return two positions and the length of the longest common the “longest” LRS above; substring of X l and X r .

  17. Longest Common Substring of Two SLPs Theorem 1 [Matsubara et al. 2009] For every pair of variables X l and X r , we can compute a longest common substring of X l and X r in total of O ( n 4 log n ) time. n is num. of variables in SLP T

  18. Algorithm to Compute LRS X i Input : SLP T Output : LRS of text T X l X r foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; Case 4 compute LRS of Case 3; compute LRS of Case 4; compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  19. Case 4 X i X l X r X j

  20. Case 4 ‐ 1 X i X l X r X j X t X s X j

  21. Case 4 ‐ 1 X l Overlap of X l and X t X t

  22. Case 4 ‐ 1 X i X l X r X j Expand Overlap of X l and X t overlap X t X s X j

  23. Case 4 ‐ 2 X i X l X r X j Expand Overlap of X r and X s overlap X s X t X j

  24. Set of Overlaps X Set of length of overlaps of X and Y Y

  25. Set of Overlaps OL ( aabaaba , abaababb ) = {1, 3, 6} X a a b a a b a a b a a b a b b Y a b a a b a b b Y a b a a b a b b Y

  26. Set of Overlaps Lemma 1 [Kaprinski et al. 1997] For every pair of variables X i and Y j , OL ( X i , Y j ) forms O ( n ) arithmetic progressions. Lemma 2 [Kaprinski et al. 1997] For every pair of variables X i and Y j , OL ( X i , Y j ) can be computed in total of O ( n 4 log n ) time. n is num. of variables in SLP T

  27. Case 4 Lemma 3 For every variable X i , a longest repeating substring in Case 4 can be computed in O ( n 3 log n ) time. [Sketch of proof] • We can expand all elements of each arithmetic progression of OL ( X i , X j ) in O ( n log n ) time. • The size of OL ( X i , X j ) is O ( n ) by Lemma 1. • There are at most n -1 descendants X j of X i .

  28. Algorithm to Compute LRS X i Input : SLP T Output : LRS of text T X l X r foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; Case 5 compute LRS of Case 3; compute LRS of Case 4; Symmetric to Case 4 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  29. Algorithm to Compute LRS X i Input : SLP T Output : LRS of text T X l X r foreach variable X i of SLP T do compute LRS of Case 1; compute LRS of Case 2; Case 6 compute LRS of Case 3; compute LRS of Case 4; Similarly to Case 4 compute LRS of Case 5; compute LRS of Case 6; return two positions and the length of the “longest” LRS above;

  30. Finding Longest Repeating Substring Theorem 2 For any SLP T which generates text T , we can compute an LRS of T in O ( n 4 log n ) time. n is num. of variables in SLP T

  31. Finding Longest Non ‐ Overlapping Repeating Substring Input: SLP T which generates text T Output: A longest non ‐ overlapping repeating substring (LNRS) of T Example T = ababababab LRS of T is abababab LRNS of T is abab

  32. Finding Longest Non ‐ Overlapping Repeating Substring Theorem 3 For any SLP T which generates text T , we can compute an LNRS of T in O ( n 6 log n ) time. n is num. of variables in SLP T

  33. Finding Most Frequent Substring Input: SLP T which generates text T Output: A most frequent substring (MFS) of T The solution is always the empty string  .

  34. Finding Most Frequent Substring Input: SLP T which generates text T Output: A most frequent substring (MFS) of T of length 2 T

  35. Algorithm to Compute MFS Y 3 |  | 2 substrings of length 2 Y 1 Y 2 Input : SLP T Output : MFS of text T a b foreach substring P of T of length 2 do construct an SLP P which generates substring P ; compute num. of occurrences of P in T ; return substring of maximum num. of occurrences; Lemma 4 For every pair of variables X i and Y j , the number of occurrences of Y j in X i can be computed in total of O ( n 2 ) time.

  36. Finding Most Frequent Substring Theorem 4 For any SLP T which generates text T , we can compute an MFS of T of length 2 in O (|  | 2 n 2 ) time. n is num. of variables in SLP T

  37. Finding Most Frequent Non ‐ Overlapping Substring Input: SLP T which generates text T Output: A most frequent non ‐ overlapping substring (MFNS) of T of length 2 Example T = aaaaababab MFS of T of length 2 is aa MFNS of T of length 2 is ab

  38. Finding Most Frequent Non ‐ Overlapping Substring Theorem 5 For any SLP T which generates text T , we can compute an MFNS of T of length 2 in O ( n 4 log n ) time. n is num. of variables in SLP T

  39. Computing Left and Right Contexts of Given Pattern Input: Two SLPs T and P which generate text T and pattern P , respectively Output: Substring  P  of T such that  (resp.  ) always precedes (resp. follows) P in T  and  are as long as possible Example T = bbaabaabbaabb P = ab  = ba  = 

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend