sk.sav.ui.ikt.nlp.gazetteer
Class Gazetteer

java.lang.Object
  extended by sk.sav.ui.ikt.nlp.gazetteer.Gazetteer
Direct Known Subclasses:
CharacterGazetteer, TokenGazetteer

public abstract class Gazetteer
extends Object


Constructor Summary
Gazetteer()
           
 
Method Summary
protected  void addResult(ArrayList<int[]> results, int start, int end, int[] ids)
          Creates a new result and appends is to the list of results.
abstract  List<int[]> find(InputStream is)
          Performs a search in the specified input stream of text for known entities defined in the gazetteer's list.
abstract  List<int[]> find(String text)
          Performs a search in the specified string for known entities defined in the gazetteer's list.
abstract  void insert(String entity)
          Inserts an entity into the gazetteer's list.
abstract  void insert(String entity, int id)
          This method has the same behavior as insert(String) except that an ID can be assigned to the inserted entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gazetteer

public Gazetteer()
Method Detail

insert

public abstract void insert(String entity)
Inserts an entity into the gazetteer's list. Duplicate entities won't be inserted. Entities can be inserted into the gazetteer's list anytime between calling of methods find(String) and find(InputStream).

Parameters:
entity - - entity to be inserted into the gazetteer's list

insert

public abstract void insert(String entity,
                            int id)
This method has the same behavior as insert(String) except that an ID can be assigned to the inserted entity. There can be multiple ids assigned for the same entity by calling this method again but with different ID values.

Parameters:
entity - - entity to be inserted into the gazetteer's list
id - - ID to be assigned the entity represented by string s

find

public abstract List<int[]> find(String text)
Performs a search in the specified string for known entities defined in the gazetteer's list.

Parameters:
text - - text to be searched
Returns:
A list of results, where each result is an array of integers with following structure: [start position, end position, ID1, ID2, ...]

find

public abstract List<int[]> find(InputStream is)
                          throws IOException
Performs a search in the specified input stream of text for known entities defined in the gazetteer's list.

Parameters:
is - - input steam of text to be searched
Returns:
A list of results, where each result is an array of integers with following structure: [start position, end position, ID1, ID2, ...]
Throws:
IOException

addResult

protected void addResult(ArrayList<int[]> results,
                         int start,
                         int end,
                         int[] ids)
Creates a new result and appends is to the list of results.

Parameters:
results - - list of results
start - - start position of the results
end - - end position of the results
ids - - ids assigned to the results