Program: 131292
Project: 131292
Buggy source:
private LFgExample getExample(AnnoSentence sent,AnnoSentence gold,boolean labeledExample){
  ObsFeatureExtractor srlFe=new SrlFeatureExtractor(prm.fePrm.srlFePrm,sent,cs);
  srlFe=new ObsFeatureCache(srlFe);
  FeatureExtractor dpFe=prm.fePrm.dpFePrm.onlyFast ? new FastDepParseFeatureExtractor(sent,cs,prm.fePrm.dpFePrm.featureHashMod) : new DepParseFeatureExtractor(prm.fePrm.dpFePrm,sent,cs,ofc.getFeAlphabet());
  dpFe=new FeatureCache(dpFe);
  ObsFeatureExtractor relFe=new RelObsFe(prm.fgPrm.relPrm,sent,ofc.getTemplates());
  relFe=new ObsFeatureCache(relFe);
  JointNlpFactorGraph fg=new JointNlpFactorGraph(prm.fgPrm,sent,cs,srlFe,ofc,dpFe,relFe);
  log.trace("String_Node_Str" + fg.getNumVars() + "String_Node_Str"+ fg.getNumFactors()+ "String_Node_Str"+ fg.getNumEdges());
  VarConfig vc=new VarConfig();
  if (prm.fgPrm.includeDp) {
    if (gold != null && gold.getParents() != null) {
      DepParseEncoder.addDepParseTrainAssignment(gold.getParents(),fg.getDpBuilder(),vc);
    }
 else     if (sent.getParents() != null && prm.fgPrm.includeDp && prm.fgPrm.dpPrm.linkVarType == VarType.OBSERVED) {
      DepParseEncoder.addDepParseTrainAssignment(sent.getParents(),fg.getDpBuilder(),vc);
    }
  }
  if (prm.fgPrm.includeSrl) {
    if (gold != null && gold.getSrlGraph() != null) {
      SrlEncoder.addSrlTrainAssignment(sent,gold.getSrlGraph(),fg.getSrlBuilder(),vc,prm.fgPrm.srlPrm.predictSense,prm.fgPrm.srlPrm.predictPredPos);
    }
  }
  if (prm.fgPrm.includeRel) {
    if (gold != null && gold.getRelLabels() != null) {
      RelationsEncoder.addRelVarAssignments(sent,gold.getRelLabels(),fg.getRelBuilder(),vc);
    }
  }
  LFgExample ex;
  FactorTemplateList fts=ofc.getTemplates();
  if (labeledExample) {
    ex=new LabeledFgExample(fg,vc,srlFe,fts);
  }
 else {
    ex=new UnlabeledFgExample(fg,vc,srlFe,fts);
  }
  dpFe.init(ex);
  relFe.init(ex,fts);
  return ex;
}

Fixed version (ground truth):
private LFgExample getExample(AnnoSentence sent,AnnoSentence gold,boolean labeledExample){
  ObsFeatureExtractor srlFe=new SrlFeatureExtractor(prm.fePrm.srlFePrm,sent,cs);
  srlFe=new ObsFeatureCache(srlFe);
  FeatureExtractor dpFe=prm.fePrm.dpFePrm.onlyFast ? new FastDepParseFeatureExtractor(sent,cs,prm.fePrm.dpFePrm.featureHashMod,ofc.getFeAlphabet()) : new DepParseFeatureExtractor(prm.fePrm.dpFePrm,sent,cs,ofc.getFeAlphabet());
  dpFe=new FeatureCache(dpFe);
  ObsFeatureExtractor relFe=new RelObsFe(prm.fgPrm.relPrm,sent,ofc.getTemplates());
  relFe=new ObsFeatureCache(relFe);
  JointNlpFactorGraph fg=new JointNlpFactorGraph(prm.fgPrm,sent,cs,srlFe,ofc,dpFe,relFe);
  log.trace("String_Node_Str" + fg.getNumVars() + "String_Node_Str"+ fg.getNumFactors()+ "String_Node_Str"+ fg.getNumEdges());
  VarConfig vc=new VarConfig();
  if (prm.fgPrm.includeDp) {
    if (gold != null && gold.getParents() != null) {
      DepParseEncoder.addDepParseTrainAssignment(gold.getParents(),fg.getDpBuilder(),vc);
    }
 else     if (sent.getParents() != null && prm.fgPrm.includeDp && prm.fgPrm.dpPrm.linkVarType == VarType.OBSERVED) {
      DepParseEncoder.addDepParseTrainAssignment(sent.getParents(),fg.getDpBuilder(),vc);
    }
  }
  if (prm.fgPrm.includeSrl) {
    if (gold != null && gold.getSrlGraph() != null) {
      SrlEncoder.addSrlTrainAssignment(sent,gold.getSrlGraph(),fg.getSrlBuilder(),vc,prm.fgPrm.srlPrm.predictSense,prm.fgPrm.srlPrm.predictPredPos);
    }
  }
  if (prm.fgPrm.includeRel) {
    if (gold != null && gold.getRelLabels() != null) {
      RelationsEncoder.addRelVarAssignments(sent,gold.getRelLabels(),fg.getRelBuilder(),vc);
    }
  }
  LFgExample ex;
  FactorTemplateList fts=ofc.getTemplates();
  if (labeledExample) {
    ex=new LabeledFgExample(fg,vc,srlFe,fts);
  }
 else {
    ex=new UnlabeledFgExample(fg,vc,srlFe,fts);
  }
  dpFe.init(ex);
  relFe.init(ex,fts);
  return ex;
}