-
Book Overview & Buying
-
Table Of Contents
F# for Machine Learning Essentials
By :
The following code finds the semantic orientation of a list of words. The variable posi holds the total positive semantic orientation while the variable negi holds the total negative semantic orientation. If posi is greater than negi then the phrase (comprising these words) is considered to have a positive polarity; otherwise it is considered to have a negative sentiment.

The following function encapsulates the logic above such that it can be called with pWords and nWords from a function (soPMI) that calculates the semantic orientation values for each element in a review.

The function soPMI
calculates semantic orientation for each of the reviews. Each review is represented as a list of words as shown below. Let's say that the first element of the reviews list represents the review about a bank called Bank1 and the second element represents the list of review items for the review of a bank called Bank2:

The following call calculates semantic orientation...
Change the font size
Change margin width
Change background colour