Exemplo n.º 1
0
 /**
  * Creates a string of the semi-infinite strings in the corpus array. Only use this on small
  * suffixArrays!
  */
 public String toString() {
   String str = "";
   for (int i = 0; i < suffixes.length; i++) {
     Phrase phrase = corpus.getPhrase(getCorpusIndex(i), corpus.size());
     str += phrase.toString() + "\n";
   }
   return str;
 }
Exemplo n.º 2
0
  /**
   * Gets a list of phrases.
   *
   * @param startPositions List of start positions in the corpus array.
   * @param length Length of the phrase to be extracted.
   * @return A list of phrases.
   */
  public List<Phrase> getPhrases(int[] startPositions, int length) {
    List<Phrase> results = new ArrayList<Phrase>(startPositions.length);

    for (int start : startPositions) {
      results.add(corpus.getPhrase(start, start + length));
    }

    return results;
  }
Exemplo n.º 3
0
 /** @return the phrase spanning the specified indices in the corpus. */
 public Phrase getPhrase(int startPosition, int endPosition) {
   return corpus.getPhrase(startPosition, endPosition);
 }