public class ChineseEnglishWordMap extends Object implements Serializable
Constructor and Description |
---|
ChineseEnglishWordMap()
Make a ChineseEnglishWordMap with a default CEDict path.
|
ChineseEnglishWordMap(String dictPath)
Make a ChineseEnglishWordMap
|
ChineseEnglishWordMap(String dictPath,
boolean normalized)
Make a ChineseEnglishWordMap
|
ChineseEnglishWordMap(String dictPath,
String pattern,
String delimiter,
String charset) |
ChineseEnglishWordMap(String dictPath,
String pattern,
String delimiter,
String charset,
boolean normalized) |
Modifier and Type | Method and Description |
---|---|
int |
addMap(Map<String,Set<String>> addM)
Add all of the mappings from the specified map to the current map.
|
boolean |
containsKey(String key)
Does the word exist in the dictionary?
|
Set<String> |
getAllTranslations(String key) |
String |
getFirstTranslation(String key) |
static ChineseEnglishWordMap |
getInstance()
A method for getting a singleton instance of this class.
|
Map<String,Set<String>> |
getReverseMap()
Returns a reversed map of the current map.
|
static void |
main(String[] args)
The main method reads (segmented, whitespace delimited) words from a file
and prints them with their English translation(s).
|
void |
readCEDict(String dictPath) |
void |
readCEDict(String dictPath,
String pattern,
String delimiter,
String charset) |
int |
size() |
String |
toString() |
public ChineseEnglishWordMap()
public ChineseEnglishWordMap(String dictPath)
dictPath
- the path/filename of the CEDictpublic ChineseEnglishWordMap(String dictPath, boolean normalized)
dictPath
- the path/filename of the CEDictnormalized
- whether the entries in dictionary are normalized or notpublic ChineseEnglishWordMap(String dictPath, String pattern, String delimiter, String charset)
public static ChineseEnglishWordMap getInstance()
public boolean containsKey(String key)
key
- The word in Chinesepublic Set<String> getAllTranslations(String key)
key
- a Chinese wordpublic String getFirstTranslation(String key)
key
- a Chinese wordpublic void readCEDict(String dictPath)
public void readCEDict(String dictPath, String pattern, String delimiter, String charset)
public Map<String,Set<String>> getReverseMap()
public int addMap(Map<String,Set<String>> addM)
public int size()
public static void main(String[] args) throws IOException
IOException