For various reasons, companies like to know the emotional dispositions of their customers and, sometimes, their employees. One common way to determine these states is through a technique called Sentiment Analysis.
One challenge with sentiment analysis is simply knowing how to score words, one way or another. Our brains know that the word “happy” is usually associated with a positive sentiment because we have a dictionary of sorts in our brains that associates “happy” to a favorable emotional state. Computers don’t immediately know these associations, so you usually have to supply them such mappings, often in the form of simple lists of words.
Now, suppose you want to maintain the appearance of positivity with an organization with whom you interact–maybe through online reviews, email, chat, or some other written medium. Here’s an idea you can try.
Step 1: Downlist a list of positive words
Positive (and negative) word lists are easily available on the Internet. Here’s one I downloaded.
Step 2: Write some PowerShell to extract some random, positive words you can use in your correspondence
If you’re running Microsoft Windows, you’ll likely have PowerShell installed, which is a convenient tool to parse the file you downloaded and provide back a few random words. Here’s a one-liner I wrote:
((cat c:\positive-words.txt|? {!$_.startswith(';') -and $_.length -gt 0}|get-random -count 3) -join '. ') + '.'|set-clipboard
In this code, I load in the word file into memory and then filter out lines that start with semicolons–in the file I downloaded, the author used semicolons to denote comment lines I need to exclude–and empty lines. Next, I select three random lines as each word is on a new line. Next, I put a period between words. Finally, I send the results to the Windows clipboard for easy pasting into the editor in which you are communicating–email, chat window, etc. The result is something like this:
pleasantly. enthralled. idolize.
But wait, there’s more
The above is great, but to get your words, you’ll have to execute the code in a PowerShell command shell. Who has time for that? How about executing your PowerShell from a batch file? Add the following to a new bat file:
set c="((cat c:\positive-words.txt|? {!$_.startswith(';') -and $_.length -gt 0}|get-random -count 3) -join '. ') + '.'|set-clipboard "
powershell -command %c%
Now, place that bat file on your desktop or in a convenient area where you can double-click on it to get your words easily. Even better: make a shortcut to it with a tool like Slickrun.
Now, you can easily leverage positive words in your correspondence and maintain a positive persona to the watchers.
Recent Comments