Example #1
0
        public List <Item> CategorizeItems(List <Item> itemList)
        {
            _classifier = new NaiveBayesianClassifier(_trainingData);

            var NewData = itemList.Select(x => new ItemInfo {
                Category = x.Category, Text = x.Name, Prob = 0
            }).ToList();

            NewData = _classifier.GetAllItemsWithCategories(NewData);

            foreach (Item item in itemList)
            {
                foreach (ItemInfo itemInfo in NewData)
                {
                    if (item.Name == itemInfo.Text && item.Category == String.Empty)
                    {
                        item.Category = itemInfo.Category;
                    }
                }
            }
            //TODO: add data to training is working perfectry, but I commented this part, because during
            //testing we chare a lot of trash data. So, we need to think about diferent way to update training data

            //AddNewDataToTrainingData(NewData);
            return(itemList);
        }
Example #2
0
 private void UpdateClassifier() => _classifier = new NaiveBayesianClassifier(_trainingData);