Program: 135626
Project: 135626
Buggy source:
/** 
 * The main class which requires the following parameters: -i *input_file*: the file which contains the text that will be disambiguated -o *output_file*: the file in which you want to save the output -cm *sent|doc|text*: indicates how the input text will be read and disambiguated. The available values are: "sent" one sentence per time, "doc" one doc per time, "text" read the full file -f *xml|oldxml|plain*: indicates the input file format. The available values are: "xml" for the SemEval-2013 Task 12 file format (http://www.cs.york.ac.uk/semeval-2013/task12/), "oldxml" old SemEval XML format, "plain" for plain text. The plain text must contain one token for each line. Each line must contains three values separated by TAB: token, pos-tag, lemma. The pos-tag has four possible values: n (noun), v (verb), j (adjective), r (adverb), any other character for other tags. An example is reported in the *text* folder -dsm *file_path*: the binary file which describes the distributional semantic model. A model for the English language is provided into the *resoruces/dsm* folder -lang *it|en|es|de|fr*: the language of the input text, *en* is the default value -sc *file_path*: the file which contains information about synsets distribution. A file extracted from WordNet 3.0 is provided in *resources/sense* folder -sg *true|false*: enable/disable gloss scoring function (true is the default value) -sf *wn|bn*: output synset format: "wn" uses WordNet offset, while "bn" uses BabelNet id (bn is the default value) -c *integer value|max*: indicates the context size, "max" considers the whole text -of *plain|task*: output format: "plain" uses plain text file to store word meanings, while task uses the file format defined in SemEval-2013 Task 12 -stem *true|false*: enable/disable glosses stemming
 * @param args the command line arguments
 */
public static void main(String[] args){
  try {
    Logger.getLogger(RunWSD.class.getName()).log(Level.INFO,"String_Node_Str");
    TextReader reader;
    Properties props=Utils.parseCmd(args);
    if (!props.containsKey("String_Node_Str")) {
      System.exit(1);
    }
    int mode=TextReader.SENTENCE_MODE;
    String modeS=props.getProperty("String_Node_Str");
    if (modeS != null) {
switch (modeS) {
case "String_Node_Str":
        mode=TextReader.SENTENCE_MODE;
      break;
case "String_Node_Str":
    mode=TextReader.DOC_MODE;
  break;
case "String_Node_Str":
mode=TextReader.TEXT_MODE;
break;
default :
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",modeS);
break;
}
}
String fileType=props.getProperty("String_Node_Str");
if (fileType != null && fileType.equals("String_Node_Str")) {
reader=new XMLTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
 else if (fileType != null && fileType.equals("String_Node_Str")) {
reader=new OldXMLTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
 else {
reader=new PlainTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
reader.openTextReader();
String langS=props.getProperty("String_Node_Str");
Language language=Language.EN;
if (langS != null) {
switch (langS) {
case "String_Node_Str":
language=Language.EN;
break;
case "String_Node_Str":
language=Language.ES;
break;
case "String_Node_Str":
language=Language.DE;
break;
case "String_Node_Str":
language=Language.IT;
break;
case "String_Node_Str":
language=Language.FR;
break;
default :
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",new Object[]{langS,language});
break;
}
}
String dsmFilename=props.getProperty("String_Node_Str");
RevisedLesk wsd;
if (dsmFilename == null) {
wsd=new RevisedLesk(language);
wsd.setStemming(true);
}
 else {
VectorSpace dsm=new VectorSpace(new File(dsmFilename));
dsm.init();
dsm.loadInRam();
wsd=new RevisedLesk(language,dsm);
wsd.setStemming(false);
}
String senseFreqFilename=props.getProperty("String_Node_Str");
if (senseFreqFilename != null) {
SenseFreqAPI sfapi=new SenseFreqAPI(new File(senseFreqFilename));
sfapi.init();
wsd.setSenseFreq(sfapi);
}
String projDepth=props.getProperty("String_Node_Str");
if (projDepth != null) {
wsd.setMaxDepth(Integer.parseInt(projDepth));
}
String scoreGloss=props.getProperty("String_Node_Str");
if (scoreGloss != null) {
wsd.setScoreGloss(Boolean.parseBoolean(scoreGloss));
}
String sf=props.getProperty("String_Node_Str");
if (sf == null) {
wsd.setOutType(RevisedLesk.OUT_BABELNET);
}
 else if (sf.equals("String_Node_Str")) {
wsd.setOutType(RevisedLesk.OUT_WORDNET);
}
 else if (sf.equals("String_Node_Str")) {
wsd.setOutType(RevisedLesk.OUT_BABELNET);
}
 else {
throw new Exception("String_Node_Str" + sf);
}
String cs=props.getProperty("String_Node_Str");
if (cs != null) {
if (cs.equalsIgnoreCase("String_Node_Str")) {
wsd.setContextSize(Integer.MAX_VALUE);
}
 else {
wsd.setContextSize(Integer.parseInt(cs));
}
}
 else {
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",cs);
wsd.setContextSize(5);
}
String outFormat=OUTFORMAT_PLAIN;
String of=props.getProperty("String_Node_Str");
if (of != null) {
if (outFormat.equals(OUTFORMAT_PLAIN) || outFormat.equals(OUTFORMAT_TASK)) {
outFormat=of;
}
 else {
throw new Exception("String_Node_Str" + of);
}
}
String stemming=props.getProperty("String_Node_Str");
if (stemming != null) {
wsd.setStemming(Boolean.parseBoolean(stemming));
}
 else {
wsd.setStemming(false);
}
String outFile=props.getProperty("String_Node_Str");
BufferedWriter writer=null;
if (outFile != null) {
writer=new BufferedWriter(new FileWriter(outFile));
}
wsd.init();
Logger.getLogger(RunWSD.class.getName()).log(Level.INFO,"String_Node_Str");
List<Token> tokens=reader.getTokenList();
while (tokens != null) {
wsd.disambiguate(tokens);
if (writer == null) {
for (Token token : tokens) {
System.out.println(token.print());
}
System.out.println();
}
 else {
switch (outFormat) {
case OUTFORMAT_PLAIN:
for (Token token : tokens) {
writer.append(token.print());
writer.newLine();
}
writer.newLine();
writer.flush();
break;
case OUTFORMAT_TASK:
for (Token token : tokens) {
String id=token.getId();
if (id != null && token.isToDisambiguate() && !token.getSynsetList().isEmpty()) {
writer.append(id.substring(0,id.indexOf("String_Node_Str"))).append("String_Node_Str");
writer.append(id).append("String_Node_Str");
List<SynsetOut> out=token.getSynsetList();
if (out.size() == 1) {
writer.append(out.get(0).getSynset()).append("String_Node_Str");
}
 else {
double variance=wsd.getVariance(out);
if (out.get(out.size() - 1).getScore() - out.get(out.size() - 2).getScore() <= variance) {
writer.append(out.get(out.size() - 1).getSynset()).append("String_Node_Str").append(out.get(out.size() - 2).getSynset()).append("String_Node_Str");
}
 else {
writer.append(out.get(out.size() - 1).getSynset()).append("String_Node_Str");
}
}
writer.append("String_Node_Str" + token.getLemma()).append("String_Node_Str").append(token.getPos().name());
writer.newLine();
}
}
writer.flush();
break;
}
}
tokens=reader.getTokenList();
}
reader.closeTextReader();
if (writer != null) {
writer.close();
}
System.out.println(wsd.getExecStats());
wsd.close();
}
 catch (Exception ex) {
Logger.getLogger(RunWSD.class.getName()).log(Level.SEVERE,null,ex);
}
}

Fixed version (ground truth):
/** 
 * The main class which requires the following parameters: -i *input_file*: the file which contains the text that will be disambiguated -o *output_file*: the file in which you want to save the output -cm *sent|doc|text*: indicates how the input text will be read and disambiguated. The available values are: "sent" one sentence per time, "doc" one doc per time, "text" read the full file -f *xml|oldxml|plain*: indicates the input file format. The available values are: "xml" for the SemEval-2013 Task 12 file format (http://www.cs.york.ac.uk/semeval-2013/task12/), "oldxml" old SemEval XML format, "plain" for plain text. The plain text must contain one token for each line. Each line must contains three values separated by TAB: token, pos-tag, lemma. The pos-tag has four possible values: n (noun), v (verb), j (adjective), r (adverb), any other character for other tags. An example is reported in the *text* folder -dsm *file_path*: the binary file which describes the distributional semantic model. A model for the English language is provided into the *resoruces/dsm* folder -lang *it|en|es|de|fr*: the language of the input text, *en* is the default value -sc *file_path*: the file which contains information about synsets distribution. A file extracted from WordNet 3.0 is provided in *resources/sense* folder -sg *true|false*: enable/disable gloss scoring function (true is the default value) -sf *wn|bn*: output synset format: "wn" uses WordNet offset, while "bn" uses BabelNet id (bn is the default value) -c *integer value|max*: indicates the context size, "max" considers the whole text -of *plain|task*: output format: "plain" uses plain text file to store word meanings, while task uses the file format defined in SemEval-2013 Task 12 -stem *true|false*: enable/disable glosses stemming
 * @param args the command line arguments
 */
public static void main(String[] args){
  try {
    Logger.getLogger(RunWSD.class.getName()).log(Level.INFO,"String_Node_Str");
    TextReader reader;
    Properties props=Utils.parseCmd(args);
    if (!props.containsKey("String_Node_Str")) {
      System.exit(1);
    }
    int mode=TextReader.SENTENCE_MODE;
    String modeS=props.getProperty("String_Node_Str");
    if (modeS != null) {
switch (modeS) {
case "String_Node_Str":
        mode=TextReader.SENTENCE_MODE;
      break;
case "String_Node_Str":
    mode=TextReader.DOC_MODE;
  break;
case "String_Node_Str":
mode=TextReader.TEXT_MODE;
break;
default :
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",modeS);
break;
}
}
String fileType=props.getProperty("String_Node_Str");
if (fileType != null && fileType.equals("String_Node_Str")) {
reader=new XMLTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
 else if (fileType != null && fileType.equals("String_Node_Str")) {
reader=new OldXMLTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
 else {
reader=new PlainTextReader(new File(props.getProperty("String_Node_Str")),mode);
}
reader.openTextReader();
String langS=props.getProperty("String_Node_Str");
Language language=Language.EN;
if (langS != null) {
switch (langS) {
case "String_Node_Str":
language=Language.EN;
break;
case "String_Node_Str":
language=Language.ES;
break;
case "String_Node_Str":
language=Language.DE;
break;
case "String_Node_Str":
language=Language.IT;
break;
case "String_Node_Str":
language=Language.FR;
break;
default :
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",new Object[]{langS,language});
break;
}
}
String dsmFilename=props.getProperty("String_Node_Str");
RevisedLesk wsd;
if (dsmFilename == null) {
wsd=new RevisedLesk(language);
wsd.setStemming(true);
}
 else {
String dsmType=props.getProperty("String_Node_Str");
VectorStore dsm=null;
if (dsmType != null && dsmType.equals("String_Node_Str")) {
dsm=new DataVectorStore();
}
 else {
dsm=new LuceneVectorStore();
}
dsm.init(new File(dsmFilename));
wsd=new RevisedLesk(language,dsm);
wsd.setStemming(false);
}
String senseFreqFilename=props.getProperty("String_Node_Str");
if (senseFreqFilename != null) {
SenseFreqAPI sfapi=new SenseFreqAPI(new File(senseFreqFilename));
sfapi.init();
wsd.setSenseFreq(sfapi);
}
String projDepth=props.getProperty("String_Node_Str");
if (projDepth != null) {
wsd.setMaxDepth(Integer.parseInt(projDepth));
}
String scoreGloss=props.getProperty("String_Node_Str");
if (scoreGloss != null) {
wsd.setScoreGloss(Boolean.parseBoolean(scoreGloss));
}
String sf=props.getProperty("String_Node_Str");
if (sf == null) {
wsd.setOutType(RevisedLesk.OUT_BABELNET);
}
 else if (sf.equals("String_Node_Str")) {
wsd.setOutType(RevisedLesk.OUT_WORDNET);
}
 else if (sf.equals("String_Node_Str")) {
wsd.setOutType(RevisedLesk.OUT_BABELNET);
}
 else {
throw new Exception("String_Node_Str" + sf);
}
String cs=props.getProperty("String_Node_Str");
if (cs != null) {
if (cs.equalsIgnoreCase("String_Node_Str")) {
wsd.setContextSize(Integer.MAX_VALUE);
}
 else {
wsd.setContextSize(Integer.parseInt(cs));
}
}
 else {
Logger.getLogger(RunWSD.class.getName()).log(Level.WARNING,"String_Node_Str",cs);
wsd.setContextSize(5);
}
String outFormat=OUTFORMAT_PLAIN;
String of=props.getProperty("String_Node_Str");
if (of != null) {
if (outFormat.equals(OUTFORMAT_PLAIN) || outFormat.equals(OUTFORMAT_TASK)) {
outFormat=of;
}
 else {
throw new Exception("String_Node_Str" + of);
}
}
String stemming=props.getProperty("String_Node_Str");
if (stemming != null) {
wsd.setStemming(Boolean.parseBoolean(stemming));
}
 else {
wsd.setStemming(false);
}
String outFile=props.getProperty("String_Node_Str");
BufferedWriter writer=null;
if (outFile != null) {
writer=new BufferedWriter(new FileWriter(outFile));
}
wsd.init();
Logger.getLogger(RunWSD.class.getName()).log(Level.INFO,"String_Node_Str");
List<Token> tokens=reader.getTokenList();
while (tokens != null) {
wsd.disambiguate(tokens);
if (writer == null) {
for (Token token : tokens) {
System.out.println(token.print());
}
System.out.println();
}
 else {
switch (outFormat) {
case OUTFORMAT_PLAIN:
for (Token token : tokens) {
writer.append(token.print());
writer.newLine();
}
writer.newLine();
writer.flush();
break;
case OUTFORMAT_TASK:
for (Token token : tokens) {
String id=token.getId();
if (id != null && token.isToDisambiguate() && !token.getSynsetList().isEmpty()) {
writer.append(id.substring(0,id.indexOf("String_Node_Str"))).append("String_Node_Str");
writer.append(id).append("String_Node_Str");
List<SynsetOut> out=token.getSynsetList();
if (out.size() == 1) {
writer.append(out.get(0).getSynset()).append("String_Node_Str");
}
 else {
double variance=wsd.getVariance(out);
if (out.get(out.size() - 1).getScore() - out.get(out.size() - 2).getScore() <= variance) {
writer.append(out.get(out.size() - 1).getSynset()).append("String_Node_Str").append(out.get(out.size() - 2).getSynset()).append("String_Node_Str");
}
 else {
writer.append(out.get(out.size() - 1).getSynset()).append("String_Node_Str");
}
}
writer.append("String_Node_Str" + token.getLemma()).append("String_Node_Str").append(token.getPos().name());
writer.newLine();
}
}
writer.flush();
break;
}
}
tokens=reader.getTokenList();
}
reader.closeTextReader();
if (writer != null) {
writer.close();
}
System.out.println(wsd.getExecStats());
wsd.close();
}
 catch (Exception ex) {
Logger.getLogger(RunWSD.class.getName()).log(Level.SEVERE,null,ex);
}
}