Skip to content

Instantly share code, notes, and snippets.

@katylava
Created October 26, 2011 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katylava/1316377 to your computer and use it in GitHub Desktop.
Save katylava/1316377 to your computer and use it in GitHub Desktop.
nltk spaceships
In [21]: texts = [text1, text2, text3, text4, text5, text6, text7, text8, text9]
In [22]: for t in texts:
....: print "%d spaceship(s) in %s" % (t.count('spaceship'), t)
....:
0 spaceship(s) in <Text: Moby Dick by Herman Melville 1851>
0 spaceship(s) in <Text: Sense and Sensibility by Jane Austen 1811>
0 spaceship(s) in <Text: The Book of Genesis>
0 spaceship(s) in <Text: Inaugural Address Corpus>
0 spaceship(s) in <Text: Chat Corpus>
0 spaceship(s) in <Text: Monty Python and the Holy Grail>
0 spaceship(s) in <Text: Wall Street Journal>
0 spaceship(s) in <Text: Personals Corpus>
0 spaceship(s) in <Text: The Man Who Was Thursday by G . K . Chesterton 1908>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment