Skip to content
May 10, 2012 / tninja1980msn

showoff.org

Do some text-mining work

import nltk

s = 'I love my wife pengpeng.'

print nltk.pos_tag(s.split(' '))

[('I', 'PRP'), ('love', 'VBP'), ('my', 'PRP$'), ('wife', 'NN'), ('pengpeng.', 'NNP')]

plot a histogram

x=rnorm(100)
hist(x)

https://tninja1980msn.files.wordpress.com/2012/05/wpid-test.png

do a linear regression

x <- runif(1000)
y <- x^2 * 3 + x * 5 + rnorm(1000)
library(ggplot2)
g <- ggplot(data.frame(x, y), aes(x=x,y=y)) + geom_point() + geom_smooth()
print(g)

https://tninja1980msn.files.wordpress.com/2012/05/wpid-lm.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: