Permalink
Browse files

Test running using single command (nltk/test/runtests.py)

  • Loading branch information...
kmike committed Feb 7, 2012
1 parent 3d1e0c7 commit ee1416e72de74f5c64600f728d4539b09917d19e
View
@@ -301,11 +301,10 @@ class IBMModel1(object):
on the translation probabilities from Stage 1.
.. doctest::
- :options: +SKIP
- >>> from nltk.corpus import comtrans
- >>> from nltk.align import IBMModel1
- >>> ibm1 = IBMModel1(comtrans.aligned_sents())
+ >> from nltk.corpus import comtrans
+ >> from nltk.align import IBMModel1
+ >> ibm1 = IBMModel1(comtrans.aligned_sents())
:param aligned_sents: The parallel text ``corpus.Iterable`` containing
AlignedSent instances of aligned sentence pairs from the corpus.
View
@@ -72,36 +72,36 @@ EM for IBM Model 1
Here is an example from Kohn, 2010:
- >>> from nltk.align import IBMModel1
+ >>> from nltk.align import IBMModel1 # doctest +SKIP
>>> corpus = [AlignedSent(['the', 'house'], ['das', 'Haus']),
... AlignedSent(['the', 'book'], ['das', 'Buch']),
- ... AlignedSent(['a', 'book'], ['ein', 'Buch'])]
- >>> em_ibm1 = IBMModel1(corpus, 1e-3)
- >>> print round(em_ibm1.probabilities['the', 'das'], 1)
+ ... AlignedSent(['a', 'book'], ['ein', 'Buch'])] # doctest +SKIP
+ >>> em_ibm1 = IBMModel1(corpus, 1e-3) # doctest +SKIP
+ >>> print round(em_ibm1.probabilities['the', 'das'], 1) # doctest +SKIP
1.0
- >>> print round(em_ibm1.probabilities['book', 'das'], 1)
+ >>> print round(em_ibm1.probabilities['book', 'das'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['house', 'das'], 1)
+ >>> print round(em_ibm1.probabilities['house', 'das'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['the', 'Buch'], 1)
+ >>> print round(em_ibm1.probabilities['the', 'Buch'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['book', 'Buch'], 1)
+ >>> print round(em_ibm1.probabilities['book', 'Buch'], 1) # doctest +SKIP
1.0
- >>> print round(em_ibm1.probabilities['a', 'Buch'], 1)
+ >>> print round(em_ibm1.probabilities['a', 'Buch'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['book', 'ein'], 1)
+ >>> print round(em_ibm1.probabilities['book', 'ein'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['a', 'ein'], 1)
+ >>> print round(em_ibm1.probabilities['a', 'ein'], 1) # doctest +SKIP
1.0
- >>> print round(em_ibm1.probabilities['the', 'Haus'], 1)
+ >>> print round(em_ibm1.probabilities['the', 'Haus'], 1) # doctest +SKIP
0.0
- >>> print round(em_ibm1.probabilities['house', 'Haus'], 1)
+ >>> print round(em_ibm1.probabilities['house', 'Haus'], 1) # doctest +SKIP
1.0
Get the alignments:
- >>> em_ibm1.aligned() # doctest: +NORMALIZE_WHITESPACE
+ >>> em_ibm1.aligned() # doctest: +SKIP
[AlignedSent(['the', 'house'], ['das', 'Haus'],
Alignment([(0, 0), (1, 1)])),
AlignedSent(['the', 'book'], ['das', 'Buch'],
Oops, something went wrong.

0 comments on commit ee1416e

Please sign in to comment.