Esempio n. 1
0
        public void BuildVocab(string corpus)
        {
            Debug.WriteLine($"{DateTime.Now:yyyy-MM-dd hh:mm:ss.fffff} {nameof(Word2Vec)} Start BuildVocab");

            AssignCorpus(corpus);

            var vocab = _allText.Distinct().ToList();
            var dict  = new Dictionary <string, int>();

            foreach (var v in vocab)
            {
                if (String.IsNullOrWhiteSpace(v))
                {
                    continue;
                }
                var cn = _allText.Count(a => a == v);
                dict.Add(v, cn);
            }
            Vocab = new HuffmanEncoding(dict);
            Debug.WriteLine($"{DateTime.Now:yyyy-MM-dd hh:mm:ss.fffff} {nameof(Word2Vec)} End BuildVocab");
        }
Esempio n. 2
0
 public void BuildVocab(Dictionary <string, int> vocab)
 {
     Vocab = new HuffmanEncoding(vocab);
 }