static void Main() { const string url = "http://www.engadget.com/2014/02/19/nokia-lumia-icon-review/"; //These evidences are used as training data for the Dragon Classigfier var positiveReviews = new Evidence("Positive", "Repository\\Positive.Evidence.csv"); var negativeReviews = new Evidence("Negative", "Repository\\Negative.Evidence.csv"); var testData = GetWebpageContents(url); var classifier = new Classifier(positiveReviews, negativeReviews); var scores = classifier.Classify(testData, DragonHelper.DragonHelper.ExcludeList); Console.WriteLine("Positive Score for " + url + " - " + scores["Positive"]); }
public static string GetSentiment(string testData) { var scores = Classifier.Classify(testData, DragonHelper.DragonHelper.ExcludeList); //Console.WriteLine("Positive Score for " + url + " - " + scores["Positive"]); //Console.ReadKey(); var ordered = scores.OrderByDescending(x => x.Value); var sentiment = ordered.FirstOrDefault().Key; return(sentiment); }
static void Main() { const string url = "http://www.engadget.com/2014/02/19/nokia-lumia-icon-review/"; //These evidences are used as training data for the Dragon Classigfier var positiveReviews = new Evidence("Positive", "Repository\\Positive.Evidence.csv"); var negativeReviews = new Evidence("Negative", "Repository\\Negative.Evidence.csv"); var testData = GetWebpageContents(url); var classifier = new Classifier(positiveReviews, negativeReviews); var scores = classifier.Classify(testData, DragonHelper.DragonHelper.ExcludeList); Console.WriteLine("Positive Score for " + url + " - " + scores["Positive"]); }
private static async void DoWork(Classifier classifier) { var items = await DataManager.GetSongsWithLyrics(); foreach (var song in items) { var scores = classifier.Classify(song.Lyrics, DragonHelper.DragonHelper.ExcludeList); var positive = scores["Positive"]; var negative = scores["Negative"]; var filter = Builders <DbEntry> .Filter.Eq(x => x.Id, song.Id); var updateQuery = Builders <DbEntry> .Update.Set(x => x.Positive, positive).Set(x => x.Negative, negative); var result = await DataManager.Collection.UpdateOneAsync(filter, updateQuery); } Console.Out.WriteLine("Done!"); }