Class TextAlgorithms

java.lang.Object
org.episteme.core.mathematics.discrete.TextAlgorithms

public class TextAlgorithms extends Object
High-performance bit-parallel text matching algorithms.

References:

  • Baeza-Yates, R., invalid input: '&' Gonnet, G. H. (1992). A new approach to text searching. Communications of the ACM, 35(10), 74-82. (Shift-Or algorithm)
  • Wu, S., invalid input: '&' Manber, U. (1992). Fast text searching: allowing errors. Communications of the ACM, 35(10), 83-91. (Shift-And algorithm)

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • TextAlgorithms

      public TextAlgorithms()
  • Method Details

    • shiftOrSearch

      public static List<Integer> shiftOrSearch(String text, String pattern)
      Finds all exact occurrences of a pattern in a text using the Shift-Or algorithm. Complexity: O(n + m + sigma) where n is text length, m pattern length, sigma alphabet size. Restricted to pattern length invalid input: '<'= 64.
      Parameters:
      text - The text to search in
      pattern - The pattern to look for
      Returns:
      List of starting positions