Package com.sun.speech.freetts
Class PartOfSpeechImpl
- java.lang.Object
-
- com.sun.speech.freetts.PartOfSpeechImpl
-
- All Implemented Interfaces:
PartOfSpeech
public class PartOfSpeechImpl extends java.lang.Object implements PartOfSpeech
Implementation of aPartOfSpeech
that reads the info from a file. The format of the file is as follows:word pos word pos word pos ...
Whereword
is the word andpos
is the part of speech for the word. The part of speech is implementation dependent.
-
-
Constructor Summary
Constructors Constructor Description PartOfSpeechImpl(java.net.URL url, java.lang.String defaultPartOfSpeech)
Creates a new PartOfSpeechImpl by reading from the given URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getPartOfSpeech(java.lang.String word)
Returns a description of the part of speech given a word.
-
-
-
Constructor Detail
-
PartOfSpeechImpl
public PartOfSpeechImpl(java.net.URL url, java.lang.String defaultPartOfSpeech) throws java.io.IOException
Creates a new PartOfSpeechImpl by reading from the given URL.- Parameters:
url
- the input sourcedefaultPartOfSpeech
- the default part of speech- Throws:
java.io.IOException
- if an error occurs
-
-
Method Detail
-
getPartOfSpeech
public java.lang.String getPartOfSpeech(java.lang.String word)
Returns a description of the part of speech given a word. If the given word cannot be found, the part of speech will be thedefaultPartOfSpeech
parameter passed to the constructor.- Specified by:
getPartOfSpeech
in interfacePartOfSpeech
- Parameters:
word
- the word to classify- Returns:
- an implementation dependent part of speech for the word
-
-