org.jqurantree.search
Class TokenSearch

java.lang.Object
  extended by org.jqurantree.search.TokenSearch

public class TokenSearch
extends java.lang.Object

The TokenSearch class searches for tokens within the orthography model. This class supports searching for tokens using an exact string match, or by substring, and is used by performing the following steps:

Step 1. Initiate a new TokenSearch instance by specifying which encoding type to use, e.g. Buckwalter transliteration, or Unicode. All string comparisons will be performed using the specified encoding type.

Step 2. Define the search criteria through calls to findToken(String) and findSubstring(String).

Step 3. Run the search by calling the getResults() method.

The results will be returned as an analysis table with 4 columns:

- The chapter number.
- The verse number.
- The token number.
- The token's text in the specified encoding.

The returned analysis table will list all matching tokens together with their location. The search criteria are combined using a Boolean OR, so that if any of the search criteria match, the token will be listed.

Author:
Kais Dukes

Constructor Summary
TokenSearch(EncodingType encodingType)
          Creates a new TokenSearch instance, using the specified encoding scheme.
TokenSearch(EncodingType encodingType, SearchOptions options)
          Creates a new TokenSearch instance, using the specified encoding scheme and search options.
 
Method Summary
 void findSubstring(java.lang.String text)
          Adds a substring match to the list of search criteria.
 void findSubstring(java.lang.String text, SearchOptions options)
          Adds a substring match to the list of search criteria.
 void findToken(java.lang.String text)
          Adds an exact string match to the list of search criteria.
 void findToken(java.lang.String text, SearchOptions options)
          Adds an exact string match to the list of search criteria, with search options.
 AnalysisTable getResults()
          Gets an AnalysisTable holding the search results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenSearch

public TokenSearch(EncodingType encodingType)
Creates a new TokenSearch instance, using the specified encoding scheme.

Parameters:
encodingType - the encoding scheme to use when performing string comparsions

TokenSearch

public TokenSearch(EncodingType encodingType,
                   SearchOptions options)
Creates a new TokenSearch instance, using the specified encoding scheme and search options. If SearchOptions.RemoveDiacritics is specified, then the search performed will not be sensitive to the presence of diacritics.

Parameters:
encodingType - the encoding scheme to use when performing string comparsions
options - the search options to use.
Method Detail

findToken

public void findToken(java.lang.String text)
Adds an exact string match to the list of search criteria.

Parameters:
text - the string to search for, in the specified encoding scheme

findToken

public void findToken(java.lang.String text,
                      SearchOptions options)
Adds an exact string match to the list of search criteria, with search options.

Parameters:
text - the string to search for, in the specified encoding scheme
options - the search options to use when performing this match

findSubstring

public void findSubstring(java.lang.String text)
Adds a substring match to the list of search criteria.

Parameters:
text - the substring to search for, in the specified encoding scheme

findSubstring

public void findSubstring(java.lang.String text,
                          SearchOptions options)
Adds a substring match to the list of search criteria.

Parameters:
text - the substring to search for, in the specified encoding scheme
options - the search options to use when performing this match

getResults

public AnalysisTable getResults()
Gets an AnalysisTable holding the search results. The returned analysis table will list all matching tokens together with their location. The search criteria are combined using a Boolean OR, so that if any of the search criteria match, the token will be listed.

Returns:
an analysis table holding the search results


Copyright© Kais Dukes, 2009. All Rights Reserved.