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
701f8ea1
Commit
701f8ea1
authored
Nov 03, 2014
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typos, credit authorship
parent
481a8cec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
nltk/wsd.py
+9
-7
No files found.
nltk/wsd.py
View file @
701f8ea1
# Natural Language Toolkit: Word Sense Disambiguation Algorithms
#
# Author: Liling Tan <alvations@gmail.com>
# Authors: Liling Tan <alvations@gmail.com>,
# Dmitrijs Milajevs <dimazest@gmail.com>
#
# Copyright (C) 2001-2014 NLTK Project
# URL: <http://nltk.org/>
...
...
@@ -15,7 +16,7 @@ def lesk(context_sentence, ambiguous_word, pos=None, synsets=None):
:param context_sentence: The context sentence where the ambiguous word occurs.
:param ambiguous_word: The ambiguous word that requires WSD.
:param pos: A specified Part-of-Speech (POS).
:param iter sy
s
nsets: Possible synsets of the ambiguous word.
:param iter synsets: Possible synsets of the ambiguous word.
:return: ``lesk_sense`` The Synset() object with the highest signature overlaps.
This function is an implementation of the original Lesk algorithm (1986) [1].
...
...
@@ -25,12 +26,13 @@ def lesk(context_sentence, ambiguous_word, pos=None, synsets=None):
>>> lesk(['I', 'went', 'to', 'the', 'bank', 'to', 'deposit', 'money', '.'], 'bank', 'n')
Synset('savings_bank.n.02')
[1] Lesk, Michael. "Automatic sense disambiguation using machine
readable
dictionaries: how to tell a pine cone from an ice cream cone." Proceedings
of the 5th annual international conference on Systems documentation. ACM,
1986. http://dl.acm.org/citation.cfm?id=318728
[1] Lesk, Michael. "Automatic sense disambiguation using machine
readable dictionaries: how to tell a pine cone from an ice cream
cone." Proceedings of the 5th Annual International Conference on
Systems Documentation. ACM, 1986.
http://dl.acm.org/citation.cfm?id=318728
"""
context
=
set
(
context_sentence
)
if
not
synsets
:
synsets
=
wordnet
.
synsets
(
ambiguous_word
)
...
...
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