Class com.phrasys.FileTokeniser

java.lang.Object
    |
    +----com.phrasys.FileTokeniser

public class FileTokeniser
extends java.lang.Object
implements WordListener
This class combines a LineReader, a Sentencer, and a Tokeniser. It fully tokenises an input file.

Version:
1.0 (15/02/00)
Author:
Oliver Mason

Constructor Index

 o FileTokeniser(String)
Constructor.

Method Index

 o addWordListener(WordListener)
Add a WordListener.
 o main(String[])
Run as stand-alone application.
 o removeWordListener(WordListener)
Remove a WordListener.
 o start()
Start off the tokenisation process.
 o wordReceived(WordEvent)
Receive a WordEvent.

Constructor Detail

 o FileTokeniser
public FileTokeniser(java.lang.String file)
          Constructor.
Parameters:
file - the name of the file to be tokenised.

Method Detail

 o addWordListener
public void addWordListener(WordListener listener)
          Add a WordListener.
Parameters:
listener - the listener.
See Also:
WordListener
 o removeWordListener
public void removeWordListener(WordListener listener)
          Remove a WordListener.
Parameters:
listener - the listener to remove.
See Also:
WordListener
 o start
public void start() throws java.io.FileNotFoundException
          Start off the tokenisation process.
Throws:
FileNotFoundException. -
 o wordReceived
public void wordReceived(WordEvent event)
          Receive a WordEvent. In order to function as a stand-alone program, the FileTokeniser implements the WordListener interface and can receive its own WordEvents. Here they are simply printed to System.out, with one word/token per line.
Parameters:
event - a WordEvent.
 o main
public static final void main(java.lang.String args[]) throws java.io.FileNotFoundException
          Run as stand-alone application.
Parameters:
args - a list of filenames to be tokenised.