static private void getCombination(ref IList <Annotator[]> list, IList <Annotator> t, int n, int m, int[] b, int M) { for (int i = n; i >= m; i--) { b[m - 1] = i - 1; if (m > 1) { getCombination(ref list, t, i - 1, m - 1, b, M); } else { if (list == null) { list = new List <Annotator[]>(); } Annotator[] temp = new Annotator[M]; for (int j = 0; j < b.Length; j++) { temp[j] = t[b[j]]; } list.Add(temp); } } }
static private void initializeAnnotation(int startIndex, int endIndex, Story currentStory) { string[] data = null; switch (currentStory) { case Story.Masatyan: data = File.ReadAllLines("政ちゃんと赤いりんご/" + Variable.NumberOfAnnotationsPerSentence + "人数据/data" + startIndex + "-" + endIndex + ".csv"); break; case Story.Bokutati: data = File.ReadAllLines("僕たちは愛するけれど/data.csv"); break; case Story.BokutatiSample: data = File.ReadAllLines("僕たちは愛するけれど/data-sample.csv"); break; case Story.SnowFestival: data = File.ReadAllLines("雪祭り1/data.csv"); break; } foreach (string datum in data) { string[] labels = datum.Split(','); //labels[0]是用户名 Annotator annotator = new Annotator(labels[0]); if (!Variable.Annotators.Contains(annotator)) //重复的人不再添加 { Variable.Annotators.Add(annotator); Variable.Data.Add(annotator, new Dictionary <Sentence, List <Annotation> >()); } Annotation annotation = new Annotation(); if (currentStory != Story.SnowFestival) { for (int i = 1; i <= (endIndex - startIndex + 1) * (Variable.LabelArray.Length + 1); ++i) { switch (labels[i]) { case "happiness": annotation.Labels[Label.happiness] = true; break; case "fondness": annotation.Labels[Label.fondness] = true; break; case "relief": annotation.Labels[Label.relief] = true; break; case "anger": annotation.Labels[Label.anger] = true; break; case "sadness": annotation.Labels[Label.sadness] = true; break; case "fear": annotation.Labels[Label.fear] = true; break; case "shame": annotation.Labels[Label.shame] = true; break; case "disgust": annotation.Labels[Label.disgust] = true; break; case "excitement": annotation.Labels[Label.excitement] = true; break; case "surprise": annotation.Labels[Label.surprise] = true; break; } if (i % (Variable.LabelArray.Length + 1) == 0) { Sentence sentence = Variable.Sentences[startIndex + (i - 1) / (Variable.LabelArray.Length + 1)]; if (!Variable.Data[annotator].ContainsKey(sentence)) { Variable.Data[annotator].Add(sentence, new List <Annotation>()); } Variable.Data[annotator][sentence].Add(annotation); annotation = new Annotation(); } } } else { for (int i = 1; i <= (endIndex - startIndex + 1) * Variable.LabelArray.Length; ++i) { if (labels[i] == "1") { switch (i % 4) { case 1: annotation.Labels[Label.WantToGo] = true; break; case 2: annotation.Labels[Label.ConfirmToGo] = true; break; case 3: annotation.Labels[Label.HaveBeenThereBefore] = true; break; case 0: annotation.Labels[Label.NoIntention] = true; break; } } if (i % Variable.LabelArray.Length == 0) { //多页面时(不同批人完成所有任务):没有Mu的可以放在一个data.csv里(SnowFestival),此时该人对该句没数据就表示没标;有Mu的必须分开放(Masa) if (annotation.Mu != true) { Variable.Data[annotator][Variable.Sentences[startIndex + (i - 1) / Variable.LabelArray.Length]].Add(annotation); annotation = new Annotation(); } } } } } }