Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sentiment Analysis

Keith Sterling edited this pageFeb 21, 2019 ·3 revisions

Sentiment Analysis

If enabled Program-Y calculates the positivity an the subjectivity of each sentence you ask it, and also keepsa running score of the overall conversation. The more you converse with it in a specific tone, the more it will startto respond to that tone.

The sentiment analyser keeps 2 scores

  • Positivity
  • Subjectivity

Positivity

Polirity, as the name suggests refers to how positive the question and/or the running conversation is.The more positive the questions, the higher the score, the more negative the lower the score.

The positivity score is a floating point numerical value between -1.0 and 1.0. The bot returns a textual valueto support grammar processing with the following values

  • < -0.9 - EXTREMELY NEGATIVE
  • > -0.9 and score <= -0.7 - VERY NEGATIVE
  • > -0.7 and score <= -0.5 - QUITE NEGATIVE
  • > -0.5 and score <= -0.3 - NEGATIVE
  • > -0.3 and score <= -0.1 - SOMEWHAT NEGATIVE
  • > -0.1 and score <= 0.1 - NEUTRAL
  • > 0.1 and score <= 0.3 - SOMEWHAT POSITIVE
  • > 0.3 and score <= 0.5 - POSITIVE
  • > 0.5 and score <= 0.7 - QUITE POSITIVE
  • > 0.7 and score <= 0.9 - VERY POSITIVE
  • > 0.9 - EXTREMELY POSITIVE

#SubjectivityA subjectivity score refers to how subjectivity or objective is the question and/or conversation. Objective refers to the factthe questions reference actual people, places objects, where as a more subjective conversations are more based on feeling and mood.

Subjectivity is a numerical floating point value between 0.0 and 1.0. The bot returns a textual valueto support grammar processing with the following values

  • score == 0.0 - COMPLETELY OBJECTIVE
  • score > 0.0 and score <= 0.2 - MOSTLY OBJECTIVE
  • score > 0.2 and score <= 0.4 - SOMEWHAT OBJECTIVE
  • score > 0.4 and score <= 0.6 - NEUTRAL
  • score > 0.6 and score <= 0.8 - SOMEWHAT SUBJECTIVE
  • score > 0.8 and score < 1.0 - MOSTLY SUBJECTIVE
  • score == 1.0 - COMPLETELY SUBJECTIVE

Available Grammars

Variables

At anytime during the conversation you can get the current positivity and subjectivity scores.These are stored in 2 variables which can be accessed via the 'get' template tag. As an example in AIML

<category><pattern>CONVERSATION SENTIMENT</pattern><template>Current positivity is <getname="positivity" />, and subjectivity is<getname="subjectivity" />.</template></category>

Sentiment Extension

Enabled

You can check if sentiment is enabled using the following 'SENTIMENT ENABLED' grammar.This will return either 'SENTIMENT ENABLED' or 'SENTIMENT DIABLED'. For example

<category><pattern>IS SENTIMENT ENABLED</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT ENABLED</extension></template></category>

Current Text Values

To get the textual version of sentiment scores, use the extention as follows

<category><pattern>CURRENT SENTIMENT TEXT</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT CURRENT TEXT</extension></template></category>

This will return the following text

SENTIMENT SCORES POSITIVITY SUBJECTIVITY .

E.g.

SENTIMENT SCORES POSITIVITY SOMEWHAT POSITIVE SUBJECTIVITY NEUTRAL.

Current Numberic Values

To get the numeric version of sentiment scores, use the extention as follows

<category><pattern>CURRENT SENTIMENT NUMERIC</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT CURRENT NUMERIC</extension></template></category>

SENTIMENT SCORES POSITIVITY SUBJECTIVITY .

E.g.

SENTIMENT SCORES POSITIVITY 0.5 SUBJECTIVITY 0.6.

###PreviousWe can extract the sentiment of previous parts of the conversation. The following call to the extensiongives us the sentiment for the current conversation

<category><pattern>CALCULATE SENTIMENT FEELING OVERALL</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT FEELING OVERALL</extension></template></category>

Where as the following call to the extension will extract the sentiment score for the last nth sentence

<category><pattern>CALCULATE SENTIMENT FEELING LAST *</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT FEELING LAST <star /></extension></template></category>

##Adhoc Sentiment ScoreYou can get the sentiment for a specific sentence using the following call to the extension

<category><pattern>CALCULATE SENTIMENT SCORE *</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT SCORE <star /></extension></template></category>

This will return the following text string

SENTIMENT SCORES POSITIVITY SUBJECTIVITY .

E.g.

SENTIMENT SCORES POSITIVITY VERY NEGATIVE SUBJECTIVITY MOSTLY SUBJECTIVE.

###Numeric to Text ValuesIf you have the raw numeric values for positivity and/or subjectivity you can pull the text valuethrough a call to the extension with the following grammars. The numeric value should bedenormalised first so 0.1 should 0 dot 1.

<category><pattern>GET SENTIMENT POSITIVITY *</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT POSITIVITY <star /></extension></template></category><category><pattern>GET SENTIMENT SUBJECTIVITY *</pattern><template><extensionpath="programy.sentiment.extension.SentimentExtension" >SENTIMENT POSITIVITY <star /></extension></template></category>

Email:keiffster@gmail.com | Twitter:@keiffster | Facebook:keith.sterling | LinkedIn:keithsterling |My Blog

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp