示例#1
0
        public virtual void TestFromList()
        {
            IList <ICoreMap>  sentences = Generics.NewArrayList();
            ICoreMap          sentence  = new ArrayCoreMap();
            IList <CoreLabel> words     = SentenceUtils.ToCoreLabelList("This", "is", "a", "test", ".");

            sentence.Set(typeof(CoreAnnotations.TokensAnnotation), words);
            sentences.Add(sentence);
            Annotation annotation = new Annotation(sentences);

            NUnit.Framework.Assert.AreEqual("This is a test .", annotation.ToString());
            sentence.Set(typeof(CoreAnnotations.TextAnnotation), "This is a test.");
            annotation = new Annotation(sentences);
            NUnit.Framework.Assert.AreEqual("This is a test.", annotation.ToString());
        }