nltk reference

Before trying any of these commands, you need do type the following line, once:

from nltk.book import *

concordance
shows every occurrence of a given word in the text

text1.concordance("whales");

similar
words appearing in similar context

text1.similar("ocean");

common context
context shared by two or more words

text1.dispersion_plot(["ocean","whale"]);

count all characters in the text
counts all characters including spaces and punctuation in a text

len(text1);

counts all words

len(set(text1));

count the number of times a word appeared in the the text

text1.count("outset")