Skip to content

Commit

Permalink
added indents so comments aren't included in the doctest results
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Xu committed May 18, 2014
1 parent 93dac6c commit 520148f
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions nltk/test/bnc.doctest
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
.. Copyright (C) 2001-2014 NLTK Project
.. For license information, see LICENSE.TXT

>>> from nltk.corpus.reader.bnc import BNCCorpusReader
>>> bnc = BNCCorpusReader(root='.', fileids=r'FX8.xml')
>>> from nltk.corpus.reader.bnc import BNCCorpusReader
>>> bnc = BNCCorpusReader(root='.', fileids=r'FX8.xml')

Checking the word access.
-------------------------

>>> len(bnc.words())
151
>>> len(bnc.words())
151

>>> bnc.words()[:6]
['Ah', 'there', 'we', 'are', ',', '.']
>>> bnc.words(stem=True)[:6]
['ah', 'there', 'we', 'be', ',', '.']
>>> bnc.words()[:6]
['Ah', 'there', 'we', 'are', ',', '.']
>>> bnc.words(stem=True)[:6]
['ah', 'there', 'we', 'be', ',', '.']

>>> bnc.tagged_words()[:6]
[('Ah', 'INTERJ'), ('there', 'ADV'), ('we', 'PRON'), ('are', 'VERB'), (',', 'PUN'), ('.', 'PUN')]
>>> bnc.tagged_words()[:6]
[('Ah', 'INTERJ'), ('there', 'ADV'), ('we', 'PRON'), ('are', 'VERB'), (',', 'PUN'), ('.', 'PUN')]

>>> bnc.tagged_words(c5=True)[:6]
[('Ah', 'ITJ'), ('there', 'AV0'), ('we', 'PNP'), ('are', 'VBB'), (',', 'PUN'), ('.', 'PUN')]
>>> bnc.tagged_words(c5=True)[:6]
[('Ah', 'ITJ'), ('there', 'AV0'), ('we', 'PNP'), ('are', 'VBB'), (',', 'PUN'), ('.', 'PUN')]

Testing access to the sentences.
--------------------------------

>>> len(bnc.sents())
15
>>> len(bnc.sents())
15

>>> bnc.sents()[0]
['Ah', 'there', 'we', 'are', ',', '.']
>>> bnc.sents(stem=True)[0]
['ah', 'there', 'we', 'be', ',', '.']
>>> bnc.sents()[0]
['Ah', 'there', 'we', 'are', ',', '.']
>>> bnc.sents(stem=True)[0]
['ah', 'there', 'we', 'be', ',', '.']

>>> bnc.tagged_sents()[0]
[('Ah', 'INTERJ'), ('there', 'ADV'), ('we', 'PRON'), ('are', 'VERB'), (',', 'PUN'), ('.', 'PUN')]
>>> bnc.tagged_sents(c5=True)[0]
[('Ah', 'ITJ'), ('there', 'AV0'), ('we', 'PNP'), ('are', 'VBB'), (',', 'PUN'), ('.', 'PUN')]
>>> bnc.tagged_sents()[0]
[('Ah', 'INTERJ'), ('there', 'ADV'), ('we', 'PRON'), ('are', 'VERB'), (',', 'PUN'), ('.', 'PUN')]
>>> bnc.tagged_sents(c5=True)[0]
[('Ah', 'ITJ'), ('there', 'AV0'), ('we', 'PNP'), ('are', 'VBB'), (',', 'PUN'), ('.', 'PUN')]

A not lazy loader.
-----------------

>>> eager = BNCCorpusReader(root='.', fileids=r'FX8.xml', lazy=False)
>>> eager = BNCCorpusReader(root='.', fileids=r'FX8.xml', lazy=False)

>>> len(eager.words())
151
>>> eager.words(stem=True)[6:17]
['right', 'abdominal', 'wound', ',', 'she', 'be', 'a', 'wee', 'bit', 'confuse', '.']
>>> len(eager.words())
151
>>> eager.words(stem=True)[6:17]
['right', 'abdominal', 'wound', ',', 'she', 'be', 'a', 'wee', 'bit', 'confuse', '.']

>>> eager.tagged_words()[6:11]
[('Right', 'ADV'), ('abdominal', 'ADJ'), ('wound', 'SUBST'), (',', 'PUN'), ('she', 'PRON')]
>>> eager.tagged_words(c5=True)[6:17]
[('Right', 'AV0'), ('abdominal', 'AJ0'), ('wound', 'NN1'), (',', 'PUN'), ('she', 'PNP'), ("'s", 'VBZ'), ('a', 'AT0'), ('wee', 'AJ0-NN1'), ('bit', 'NN1'), ('confused', 'VVN-AJ0'), ('.', 'PUN')]
>>> len(eager.sents())
15
>>> eager.tagged_words()[6:11]
[('Right', 'ADV'), ('abdominal', 'ADJ'), ('wound', 'SUBST'), (',', 'PUN'), ('she', 'PRON')]
>>> eager.tagged_words(c5=True)[6:17]
[('Right', 'AV0'), ('abdominal', 'AJ0'), ('wound', 'NN1'), (',', 'PUN'), ('she', 'PNP'), ("'s", 'VBZ'), ('a', 'AT0'), ('wee', 'AJ0-NN1'), ('bit', 'NN1'), ('confused', 'VVN-AJ0'), ('.', 'PUN')]
>>> len(eager.sents())
15

0 comments on commit 520148f

Please sign in to comment.