Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
16ed592c
Commit
16ed592c
authored
May 18, 2014
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed import statement
parent
d0059a05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
nltk/test/align.doctest
+2
-2
No files found.
nltk/test/align.doctest
View file @
16ed592c
...
@@ -78,7 +78,7 @@ EM for IBM Model 1
...
@@ -78,7 +78,7 @@ EM for IBM Model 1
Here is an example from Koehn, 2010:
Here is an example from Koehn, 2010:
>>> from nltk.align
.ibm1
import IBMModel1
>>> from nltk.align import IBMModel1
>>> corpus = [AlignedSent(['the', 'house'], ['das', 'Haus']),
>>> corpus = [AlignedSent(['the', 'house'], ['das', 'Haus']),
... AlignedSent(['the', 'book'], ['das', 'Buch']),
... AlignedSent(['the', 'book'], ['das', 'Buch']),
... AlignedSent(['a', 'book'], ['ein', 'Buch'])]
... AlignedSent(['a', 'book'], ['ein', 'Buch'])]
...
@@ -106,7 +106,7 @@ Here is an example from Koehn, 2010:
...
@@ -106,7 +106,7 @@ Here is an example from Koehn, 2010:
>>> print(round(em_ibm1.probabilities['book'][None], 1))
>>> print(round(em_ibm1.probabilities['book'][None], 1))
0.5
0.5
And using an NLTK corpus. We train on only 10 sentences, since it is so
incredibly
slow:
And using an NLTK corpus. We train on only 10 sentences, since it is so slow:
>>> from nltk.corpus import comtrans
>>> from nltk.corpus import comtrans
>>> com_ibm1 = IBMModel1(comtrans.aligned_sents()[:10], 20)
>>> com_ibm1 = IBMModel1(comtrans.aligned_sents()[:10], 20)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment