Package gannuWSD.algorithms

Source Code of gannuWSD.algorithms.FirstSense

package gannuWSD.algorithms;

import gannuNLP.data.AmbiguousWord;
import gannuNLP.data.Input;
import gannuNLP.data.Sense;
import gannuWSD.testing.Decision;

import java.util.ArrayList;


/**
* A simple First Sense heuristic. It always selects the first sense on the dictionary.
* @author Francisco Viveros-Jiménez
*
*/
public class FirstSense extends WSDAlgorithm {

  public FirstSense()
  {
    super();
    this.name="FS";
  }
   @Override
  public Decision disambiguate(AmbiguousWord target, ArrayList<AmbiguousWord> window) throws Exception
  {
    ArrayList<Sense> senses=target.getSenses();
    Decision decision=new Decision(target,window);
    int i;
    for(i=0;i<senses.size();i++)
    {
      ArrayList<String> dwords=new ArrayList<String>();
      decision.setSense(i, 1.0/((double)(i+2)), dwords);
     
    }
    decision.calculateAnswer();
    return decision;
  }
@Override
public void init(Input document) {
  // TODO Auto-generated method stub

}
@Override
public boolean IsUseful(AmbiguousWord target, AmbiguousWord windowWord)
    throws Exception {
  // TODO Auto-generated method stub
  return true;
}


}
TOP

Related Classes of gannuWSD.algorithms.FirstSense

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.