static public void ObtainBinaryResult(Sij sij, string algorithm, int groupIndex) { switch (algorithm) { case "JDDS": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].JDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "SDDS": foreach (Sentence sentence in Variable.Sentences) { if (sentence.ID < SupervisedVariable.NumberOfTraningSentences) { continue; } sentence.AnnotaitonGroups[groupIndex].SDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "IDDS": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].IDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "DTDDS": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].DTDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "TDDS": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].TDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "NDDS": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].NDDSResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; case "PeT": foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups[groupIndex].PeTResult = new Result(sij.CalculateJointBestLabelset(sentence)); } break; } }
//得到一种情感结果 static private void ObtainLabelResult(Sij sij, int group) { foreach (Sentence sentence in sij.Value.Keys) { //得到numeric结果 foreach (Labelset Labelset in sij.Value[sentence].Keys) { foreach (Label label in Labelset.Labels.Keys)//其实就一个Label { if (Labelset.Labels[label]) { sentence.AnnotaitonGroups[group].IDSNumResult.Labels[label] = sij.Value[sentence][Labelset]; } } } //得到binary结果 KeyValuePair <Labelset, double> resultAndProbability = sij.CalculateJointBestLabelset(sentence); foreach (Label label in resultAndProbability.Key.Labels.Keys) { sentence.AnnotaitonGroups[group].IDSResult.Labels[label] = resultAndProbability.Key.Labels[label]; } sentence.AnnotaitonGroups[group].IDSResult.Probability *= resultAndProbability.Value; } }