示例#1
0
        /// <summary>
        /// Create a sentence as a List of
        /// <c>CoreLabel</c>
        /// objects from
        /// a List of other label objects.
        /// </summary>
        /// <param name="words">The words to make it from</param>
        /// <returns>The Sentence</returns>
        public static IList <CoreLabel> ToCoreLabelList <_T0>(IList <_T0> words)
            where _T0 : IHasWord
        {
            IList <CoreLabel> sent = new List <CoreLabel>(words.Count);

            foreach (IHasWord word in words)
            {
                CoreLabel cl = new CoreLabel();
                if (word is ILabel)
                {
                    cl.SetValue(((ILabel)word).Value());
                }
                cl.SetWord(word.Word());
                if (word is IHasTag)
                {
                    cl.SetTag(((IHasTag)word).Tag());
                }
                if (word is IHasLemma)
                {
                    cl.SetLemma(((IHasLemma)word).Lemma());
                }
                sent.Add(cl);
            }
            return(sent);
        }
示例#2
0
 public virtual void SetLemma(string lemma)
 {
     label.SetLemma(lemma);
 }