Package ca.phon.ipadictionary
Class IPADictionary
java.lang.Object
ca.phon.ipadictionary.IPADictionary
- All Implemented Interfaces:
IExtendable
API for the IPA dictionary. This class is final.
To implement custom IPADictionaries, implement the
IPADictionarySPI
interface and pass the constructed
object as an argument to the constructor for this class.
Dictionaries are only required to provide the method lookup(String)
.
All other functionality is optional, but it is recommended
to at least implement the actions AddEntry
, RemoveEntry
,
and OrthoKeyIterator
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an entry to this dictionary (optional)<T> T
getExtension
(Class<T> cap) Get the requested extension if available.Return all extension types supportedReturns the language handled by this dictionary.getMetadataValue
(String key) Get value for a given metadata key.getName()
Returns a string identifier for this dictionary.Return an iterator for the keys in this dictionary.String[]
Perform a lookup for the given orthographic transcription.Get the iteator for metadata keys.String[]
prefixSearch
(String prefix) Return all keys which start with the given prefix.<T> T
putExtension
(Class<T> cap, T impl) Add a new extension.void
removeEntry
(String orthography, String ipa) Remove an entry from this dictionary.<T> T
removeExtension
(Class<T> cap) Remove a capability.
-
Constructor Details
-
IPADictionary
Constructor- Parameters:
dictionary
- implementation
-
-
Method Details
-
lookup
Perform a lookup for the given orthographic transcription.- Parameters:
orthography
-- Returns:
- the ipa transcriptions found or generated by this dictionary
-
addEntry
Add an entry to this dictionary (optional)- Parameters:
orthography
-ipa
-- Throws:
IPADictionaryExecption
- if the dictionary is not capable of adding entries or the entry was not added because it was a duplicate.
-
removeEntry
Remove an entry from this dictionary. (optional)- Parameters:
orthography
-ipa
-- Throws:
IPADictionaryException
- if the dictionary is not capable of removing the entry.IPADictionaryExecption
-
keyIterator
Return an iterator for the keys in this dictionary. (optional)- Returns:
- the key iterator for the dictionary
- Throws:
IPADictionaryExecption
- if the dictionary is not capable of iterating it's keys
-
prefixSearch
Return all keys which start with the given prefix. (optional)- Parameters:
prefix
-- Returns:
- the list of keys which have the given prefix
- Throws:
IPADictionaryExecption
- if the dictionary does not support this function
-
getLanguage
Returns the language handled by this dictionary.- Returns:
- the
LanguageEntry
for this dictionary
-
getName
Returns a string identifier for this dictionary. While not required, the name should be unique to help users identify dictionaries which handle the same language.- Returns:
- the dictionary name
-
getMetadataValue
Get value for a given metadata key.- Parameters:
key
- the metadata key. Common keys are 'provider' and 'website'- Returns:
- the value for the specified key or
null
if no data is available. SeemetadataKeyIterator()
-
metadataKeyIterator
Get the iteator for metadata keys.- Returns:
- an iterator for the metadata keys available
-
getExtensions
Description copied from interface:IExtendable
Return all extension types supported- Specified by:
getExtensions
in interfaceIExtendable
-
getExtension
Description copied from interface:IExtendable
Get the requested extension if available.- Specified by:
getExtension
in interfaceIExtendable
- Returns:
- the capability object or
null
if the cability is not available
-
putExtension
Description copied from interface:IExtendable
Add a new extension.- Specified by:
putExtension
in interfaceIExtendable
- Parameters:
cap
- the extension to add- Returns:
- the added extension implementation
-
removeExtension
Description copied from interface:IExtendable
Remove a capability.- Specified by:
removeExtension
in interfaceIExtendable
- Parameters:
cap
- the capability to remove
-