コード例 #1
0
        public virtual SimpleMatrix GetDocumentEmbedding(Document document)
        {
            if (!conll)
            {
                return(new SimpleMatrix(staticWordEmbeddings.GetEmbeddingSize(), 1));
            }
            IList <CoreLabel> words         = new List <CoreLabel>();
            ICollection <int> seenSentences = new HashSet <int>();

            foreach (Mention m in document.predictedMentionsByID.Values)
            {
                if (!seenSentences.Contains(m.sentNum))
                {
                    seenSentences.Add(m.sentNum);
                    Sharpen.Collections.AddAll(words, m.sentenceWords);
                }
            }
            return(GetAverageEmbedding(words));
        }