Class com.phrasys.phraser.Phraser

java.lang.Object
    |
    +----com.phrasys.phraser.Phraser

public class Phraser
extends java.lang.Object
implements com.phrasys.phraser.TNController, WordListener, java.io.Serializable
A transition network-based phrase recogniser.

The typical way of using this class would be to register it as a WordListener to a parts-of-speech tagger, and to have another WordListener listen to its output. Phrase mark-up is emitted in the form of tags like <phrase type="NP"> and can be read out as a WordEvent.

The component relies on word class labels which have to be assigned to each word; these should be stored under the label "pos" in the incoming WordEvents.

Version:
1.1 (18/11/00)
Author:
Oliver Mason

Constructor Index

 o Phraser()
Default Constructor.

Method Index

 o addWordListener(WordListener)
Register word listeners.
 o getItem(int)
Get the token at the specified position.
 o getNetwork()
Get the name of the current network.
 o hasMoreData(int)
Check if more data is available.
 o matchArc(int, String)
Match a network arc.
 o recognisePhrases()
Process a sentence.
 o removeWordListener(WordListener)
De-register listeners
 o setNetwork(String)
Specify the network to use.
 o wordReceived(WordEvent)
receive a WordEvent.

Constructor Detail

 o Phraser
public Phraser()
          Default Constructor.

Method Detail

 o setNetwork
public void setNetwork(java.lang.String filename) throws java.io.IOException
          Specify the network to use. The phrase recogniser uses a network definition file for processing. This method allows one to specify which file to use.
Parameters:
filename - the filename of the network file.
 o getNetwork
public java.lang.String getNetwork()
          Get the name of the current network.
Returns:
the network's name or null if no network has been set.
 o hasMoreData
public boolean hasMoreData(int position)
          Check if more data is available.
Parameters:
position - the position in the sentence to test.
Returns:
true if the position is before the end of the sentence, false otherwise.
 o matchArc
public boolean matchArc(int position,
                        java.lang.String label)
          Match a network arc.
Parameters:
position - the starting position in the sentence.
Returns:
true if the arc matches, false otherwise.
 o getItem
public java.lang.String getItem(int position)
          Get the token at the specified position.
Parameters:
position - the position to get.
Returns:
the token at that position.
 o recognisePhrases
public void recognisePhrases()
          Process a sentence. All phrases within the network are matched against the sentence data, and the annotated sentence is then sent out in the form of a sequence of WordEvent.
 o addWordListener
public void addWordListener(WordListener listener)
          Register word listeners.
Parameters:
listener - the listener to add.
 o removeWordListener
public void removeWordListener(WordListener listener)
          De-register listeners
Parameters:
listener - the listener to add.
 o wordReceived
public void wordReceived(WordEvent event)
          receive a WordEvent. If the EOF is reached or the token is a sentence end tag the current sentence is processed by the recogniser.
Parameters:
event - the WordEvent that has been received.