Package com.sun.speech.freetts

# Class PartOfSpeechImpl

java.lang.Object
com.sun.speech.freetts.PartOfSpeechImpl

All Implemented Interfaces:
  `PartOfSpeech`

public class PartOfSpeechImpl extends Object implements PartOfSpeech
Implementation of a `PartOfSpeech` that reads the info from a file. The format of the file is as follows:

     word pos
     word pos
     word pos
     ...

Where `word` is the word and `pos` is the part of speech for the word. The part of speech is implementation dependent.

## Constructor Summary

Constructors
Constructor
Description
`PartOfSpeechImpl(URL url, String defaultPartOfSpeech)`
Creates a new PartOfSpeechImpl by reading from the given URL.

## Method Summary

Modifier and Type
Method
Description
`String`
`getPartOfSpeech(String word)`
Returns a description of the part of speech given a word.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PartOfSpeechImpl

public PartOfSpeechImpl(URL url, String defaultPartOfSpeech) throws IOException
Creates a new PartOfSpeechImpl by reading from the given URL.

Parameters:
  `url` - the input source
  `defaultPartOfSpeech` - the default part of speech
Throws:
  `IOException` - if an error occurs

## Method Details

### getPartOfSpeech

public String getPartOfSpeech(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 the `defaultPartOfSpeech` parameter passed to the constructor.

Specified by:
  `getPartOfSpeech` in interface `PartOfSpeech`
Parameters:
  `word` - the word to classify
Returns:
  an implementation dependent part of speech for the word