de.aitools.ir.retrievalmodels.representation.suffixtree
Class SuffixParser

java.lang.Object
  extended by de.aitools.ir.retrievalmodels.representation.suffixtree.SuffixParser

public class SuffixParser
extends java.lang.Object

This class contains several helper methods which are often used during construction of a suffix tree.

Version:
aitools 3.0 $Id: SuffixParser.java,v 1.3 2010/05/04 14:57:12 hoppe Exp $
Author:
Martin Potthast

Constructor Summary
SuffixParser()
           
 
Method Summary
static java.lang.String getCommonPrefix(java.util.List<Suffix> suffixes)
          Returns the common prefix shared by all texts which are represented by this node.
static java.lang.String getCommonPrefix(java.util.List<Suffix> suffixes, int commonPrefixLength)
          Returns the supposed common prefix of the suffixes.
static java.util.List<java.lang.String> getCommonPrefixWords(java.util.List<Suffix> suffixes, int commonPrefixLength)
           
static java.lang.String getFirstWord(Suffix currSuffix)
          Returns the first word of the suffix currSuffix as String.
static java.util.List<Suffix> getSuffixReferences(java.lang.Iterable<java.lang.String> texts)
          Returns all references to all suffixes of the texts inside the Collection texts.
static java.util.List<Suffix> getSuffixReferences(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuffixParser

public SuffixParser()
Method Detail

getSuffixReferences

public static java.util.List<Suffix> getSuffixReferences(java.lang.Iterable<java.lang.String> texts)
Returns all references to all suffixes of the texts inside the Collection texts. The references to each suffix is an instance of Suffix.

Parameters:
texts - The set of texts to get references to its suffixes for.
Returns:
A set of Suffix instances.

getSuffixReferences

public static java.util.List<Suffix> getSuffixReferences(java.lang.String text)

getFirstWord

public static java.lang.String getFirstWord(Suffix currSuffix)
Returns the first word of the suffix currSuffix as String.

Parameters:
currSuffix - The suffix to get the first word of.
Returns:
The first word of the suffix.

getCommonPrefix

public static java.lang.String getCommonPrefix(java.util.List<Suffix> suffixes,
                                               int commonPrefixLength)
Returns the supposed common prefix of the suffixes. This method does not compute whether the prefix is really common to all of the suffixes. It will just return the first commonPrefixLength letters.

Parameters:
suffixes - The suffixes to get the common prefix for.
commonPrefixLength - The length of the common prefix.
Returns:
The common prefix.

getCommonPrefixWords

public static java.util.List<java.lang.String> getCommonPrefixWords(java.util.List<Suffix> suffixes,
                                                                    int commonPrefixLength)

getCommonPrefix

public static java.lang.String getCommonPrefix(java.util.List<Suffix> suffixes)
Returns the common prefix shared by all texts which are represented by this node.

Parameters:
suffixes - The suffixes to get the common prefix for.
Returns:
a String with the common words shared by all suffixes