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
75a201f7
Commit
75a201f7
authored
May 17, 2014
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new doctest for word sense disambiguation
parent
aca50bcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
nltk/test/wsd.doctest
+9
-3
No files found.
nltk/test/
lesk
.doctest
→
nltk/test/
wsd
.doctest
View file @
75a201f7
...
...
@@ -3,9 +3,14 @@
.. -*- coding: utf-8 -*-
==============
=========================
Word Sense Disambiguation
=========================
Lesk Algorithm
==============
--------------
Performs the classic Lesk algorithm for Word Sense Disambiguation (WSD) using
a the definitions of the ambiguous word.
...
...
@@ -14,10 +19,11 @@ Given an ambiguous word and the context in which the word occurs, Lesk returns
a Synset with the highest number of overlapping words between the context
sentence and different definitions form each Synset.
>>> from nltk.wsd import lesk
>>> sent = "I went to the bank to deposit money."
>>> word = "bank"
>>> pos = "n"
>>> print
wsd
(sent, word, pos)
>>> print
lesk
(sent, word, pos)
Synset('depository_financial_institution.n.01')
The definitions for "bank" are:
...
...
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