Beispiel #1
0
 public ClusterItem(string id, string content, ClusteringVocabulary vocabulary)
 {
     this.Id         = id;
     this.TextLength = content?.Length ?? 0;
     this.TokenIndex = vocabulary.GetTokens(content);
     this.Content    = content;
     this.Hash       = Clustering.PlatformGetStringHash(content);
 }
Beispiel #2
0
        public virtual bool InitIfPending(ClusteringVocabulary vocabulary)
        {
            if (this.m_initPending && this.TokenIDs != null)
            {
                this.m_initPending = false;
                foreach (Token token in this.TokenIDs.Select(tid => vocabulary.GetToken(tid)))
                {
                    this.TokenIndex.Append(token);
                }

                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public virtual bool InitIfPending(Clustering clustering, ClusteringVocabulary vocabulary)
        {
            if (this.m_initPending)
            {
                this.m_initPending = false;

                foreach (ClusterItem item in this.Items.Values)
                {
                    item.InitIfPending(vocabulary);
                    if (!string.IsNullOrEmpty(item.Hash))
                    {
                        this.ItemContentHashes.Add(item.Hash);
                    }
                }

                return(true);
            }

            return(false);
        }
Beispiel #4
0
 public Clustering(ClusteringConfig config)
 {
     this.Config       = config;
     this.m_vocabulary = new ClusteringVocabulary(config);
 }