verboperation.java

来自「dragontoolkit用于机器学习」· Java 代码 · 共 45 行

JAVA
45
字号
package dragon.nlp.tool.lemmatiser;import dragon.util.SortedArray;/** * <p>The verb operation removes the suffix such as -s, -es, -ed, -ing</p> * <p></p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: IST, Drexel University</p> * @author Davis Zhou * @version 1.0 */public class VerbOperation implements Operation{    private SortedArray verbIndexList;    public VerbOperation(SortedArray verbIndexList) {        this.verbIndexList =verbIndexList;    }    public boolean getIndexLookupOption(){        return false;    }    public String execute(String derivation){        if(verbIndexList==null) return null;        if(derivation.endsWith("ed")){           derivation=derivation.substring(0,derivation.length()-2);           if(verbIndexList.binarySearch(derivation)>0)               return derivation;           else               return null;        }        else if(derivation.endsWith("ing")){           derivation=derivation.substring(0,derivation.length()-3);           if(verbIndexList.binarySearch(derivation)>0)               return derivation;           else               return null;        }        return null;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?