Doing sentiment analysis in node.js

A form of natural language processing can be referred to as Sentiment analysis, which can be thought of as a way to get a sense of the attitude of a speaker, or writer when it comes to text content. The subject can get a little involved, but working out a basic system for getting some kind of emotional index of some text does not have to be to hard. It can just involve a database of values for common words, and use that as a way to get some kind of index value.

In a node.js environment there is an npm package called sentiment that can be used to get an emotional index value for some text content. It is very easy to use, just feed it some text, and a score can be retrieve that will help give an idea of what the emotional impact of that text is. As of the last time that I edited this post it would seem that this package is not maintained anymore. However that is not always just a bad thing, depending on what needs to happen with Sentiment analysis in a nodejs project this package might still work okay to get the job done.

Read More

Finding Standard Deviation in javaScript

In Statistics it seems like standard deviation is something that comes up often. In Statistics standard deviation is a way to go abound measuring the variation or dispersion of a collection of values when it comes to some data. For example take the set of numbers [50,51], and compare them to [49, 89]. It would go without saying that the numbers [50,51] are closer together than [49, 89], but how should one go about measuring that? Standard deviation is one way to go about doing just this, but there are of course many ways of going about doing so, and even when it comes to Standard deviation it would seem that it is not so Standard actually as it would appear that there is more than one standard for Standard deviation actually.

JavaScript might not be the ideal language for this sort of thing compared to some other programing languages, for example in python there is a built in standard library that contains a statistics library with several standard deviation methods. However if I just research what the proper expressions are, it is not too time consuming to come up with my own simple copy and paste methods for many statistics related tasks in a javaScript environment. While I am at it I might get around to working out some additional related code examples when it comes to just working various things out with a set of numbers. I think in order to really understand what is going on with this I should work out some kind of visual thing because that just seems to be the best way that learn about these things speaking from my experience.

Read More

More than one mean however for the most part there is just one

I am always looking for new things to learn, and write about, in the process of doing so I have decided to write a few posts on statistics. From what I have gathered data science is getting pretty hot these days, and companies can not seem to find enough people, so I started looking into what I need to know to start going in that direction. Turns out there is a lot to know in order to hack it as a data scientist, a whole lot of heavy math is involved, but I am down for giving it a try at least.

This is what has lead me to reading a whole bunch of Wikipedia articles the relate to the subject of statistics, one of which is the article on what a mean. A mean is more or less another word for an average and for most of us we know that an average is just the sum of a set of numbers divided by the number of numbers. So one would think that this topic id fairly simple, and as such I can just get back up to something that I learned in grade school and move on. However it turns out that doing so is not that simple, the kind of average that I described just now is called an Arithmetic mean, and there are at least two other kinds of means that I am aware of these far. So even when it comes to a mean it turns out that there is more than one, and as such this subject can get a little involved.

So in this post I will just be outlining the various kinds of means that I will end up running into if I start teaching myself more about statistics.

Read More

The fs.stat method and getting stats of a file and directory in nodejs

Getting the stats of a file is quick and easy in node.js with just the nodejs built in core file system module, and the fs.stat method. A stat object contains useful information about a file such as when it was last modified, and the data size of it. A stat object also contains methods that can be used to find if the current file is in fact a file, or a directory. So in this post I will be going over a few quick examples of using the fs.stat method in a nodejs environment.

Read More