public class PhoneSetImpl extends Object implements PhoneSet
PhoneSet
that reads the info from
a file. The format of the file is as follows:
phone feature value phone feature value phone feature value ...Where
phone
is the phone name, feature
is
the phone feature such as "vc," "vlng," "vheight," and so on, and
"value" is the value of the feature. There can be multiple lines
for the same phone to describe various features of that phone.Modifier and Type | Field and Description |
---|---|
private int |
lineCount
Used for informational purposes if there's a bad line in the
file.
|
private Map |
phonesetMap
The set of phone features indexed by phone.
|
Constructor and Description |
---|
PhoneSetImpl(URL url)
Create a new
PhoneSetImpl by reading from the
given URL. |
Modifier and Type | Method and Description |
---|---|
private String |
getKey(String phoneme,
String feature)
Given a phoneme and a feature, returns the key that
will obtain the value.
|
String |
getPhoneFeature(String phone,
String featureName)
Given a phoneme and a feature name, returns the feature.
|
private void |
parseAndAdd(String line)
Creates a word from the given input line and add it to the map.
|
private int lineCount
private Map phonesetMap
public PhoneSetImpl(URL url) throws IOException
PhoneSetImpl
by reading from the
given URL.url
- the input sourceIOException
- if an error occursprivate void parseAndAdd(String line)
line
- the input lineprivate String getKey(String phoneme, String feature)
phoneme
- the phonemefeature
- the name of the featurepublic String getPhoneFeature(String phone, String featureName)
getPhoneFeature
in interface PhoneSet
phone
- the phoneme of interestfeatureName
- the name of the feature of interestWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses