In [6]:
import nltk
sentence = "Hello my name is joe."
tokens = nltk.word_tokenize(sentence)
tokens


Out[6]:
['Hello', 'my', 'name', 'is', 'joe', '.']

In [7]:
tagged = nltk.pos_tag(tokens)

In [8]:
tagged


Out[8]:
[('Hello', 'NNP'),
 ('my', 'PRP$'),
 ('name', 'NN'),
 ('is', 'VBZ'),
 ('joe', 'NN'),
 ('.', '.')]

In [9]:
entities = nltk.chunk.ne_chunk(tagged)

In [15]:
type(entities)


Out[15]:
nltk.tree.Tree

In [11]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['info', 'linalg', 'random', 'fft', 'power']
`%matplotlib` prevents importing * from pylab and numpy

In [16]:
from nltk.corpus import treebank

In [17]:
t = treebank.parsed_sents('wsj_0001.mrg')[0]

In [18]:
t.draw()

In [2]:
from pylab import *


x = linspace(0, 5, 10)
y = x ** 2
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()



In [ ]: