⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yearswithinfivepipe.java

📁 这是一个matlab的java实现。里面有许多内容。请大家慢慢捉摸。
💻 JAVA
字号:
package edu.umass.cs.mallet.projects.seg_plus_coref.coreference;import edu.umass.cs.mallet.base.pipe.Pipe;import edu.umass.cs.mallet.base.types.Instance;import edu.umass.cs.mallet.projects.seg_plus_coref.coreference.Citation;import edu.umass.cs.mallet.projects.seg_plus_coref.coreference.NodePair;/** * FieldStringDistancePipe * User: mhay * Email: mhay@cs.umass.edu * Date: Feb 18, 2004 4:40:24 PM */public class YearsWithinFivePipe extends Pipe {    public Instance pipe (Instance carrier) {        NodePair pair = (NodePair)carrier.getData();        Citation c1 = (Citation)pair.getObject1();        Citation c2 = (Citation)pair.getObject2();        String y1 = c1.getField(Citation.year);        String y2 = c2.getField(Citation.year);        if (y1.length() == 0 || y2.length() == 0) {            return carrier;        }        int y1Int = (new Integer(y1)).intValue();        int y2Int = (new Integer(y2)).intValue();	if (!(y1Int == y2Int))	    pair.setFeatureValue("YearsDoNotMatch", 1.0);	if (Math.abs(y1Int - y2Int) < 1) 	    pair.setFeatureValue("YearsMatch", 1.0);	else if (Math.abs(y1Int - y2Int) < 2)	    pair.setFeatureValue("Years1Apart", 1.0);	else if (Math.abs(y1Int - y2Int) < 4)	    pair.setFeatureValue("Years2to3Apart", 1.0);        else if (Math.abs(y1Int - y2Int) > 3)	    pair.setFeatureValue("YearsMoreThanThree", 1.0);        return carrier;    }}

⌨️ 快捷键说明

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