public Lexicon(List <DictionaryItem> dictionary, Grabo graboData)
        {
            Terms = new List <Term>();
            var reviews = graboData.Businesses.Select(ss => ss.ReviewList).SelectMany(m => m.Reviews).ToList();

            dictionary.ForEach(s => Terms.Add(CalculatePMI(s, reviews)));
        }
示例#2
0
        public static Grabo ReadData()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Grabo));

            using (FileStream fileStream = new FileStream("grabo.xml", FileMode.Open))
            {
                Grabo result = (Grabo)serializer.Deserialize(fileStream);
                return(result);
            }
        }
示例#3
0
        private static List <DictionaryItem> CreateDictionary(Grabo data)
        {
            var words = data.Businesses
                        .Select(s => s.ReviewList)
                        .SelectMany(s => s.Reviews)
                        .Select(s => s.TokenizedMessage)
                        .SelectMany(str => str)
                        .GroupBy(g => g)
                        .Select(gr => new DictionaryItem
            {
                Word = gr.Key,
                NumberOfOccurances = gr.Count()
            })
                        .Where(w => w.NumberOfOccurances >= 5)
                        .ToList();

            return(words);
        }
 public Lexicon(List <DictionaryItem> dictionary, Grabo graboData, string forCategory)
 {
 }