📄 dictionary.java
字号:
/**
*
*/
package org.solol.mmseg.internal;
import java.util.TreeMap;
import org.solol.mmseg.core.IDictionary;
import org.solol.mmseg.core.IWord;
/**
* @author solo L
*
*/
public final class Dictionary implements IDictionary {
private TreeMap dictionary = new TreeMap();
public boolean isMatched(String value) {
return dictionary.containsKey(value);
}
public void addWord(String value,int type) {
dictionary.put(value, new Word(value,type));
}
public void addWord(String value, int frequency,int type) {
dictionary.put(value, new Word(value, frequency,type));
}
public IWord getWord(String value) {
return (IWord) dictionary.get(value);
}
public void removeWord(String value) {
dictionary.remove(value);
}
public int getLength() {
return dictionary.size();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -