-
Notifications
You must be signed in to change notification settings - Fork 0
/
WSD.py
39 lines (29 loc) · 991 Bytes
/
WSD.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class WSD:
'''
Word Sense Disambiguation
In this class we define some classes to implement different kinds os disambiguation.
Methods
--------------
disambiguation(synsets):
returns the appropriate synset after disambiguation process
'''
def disambiguation(self, synsets):
raise NotImplementedError("Subclass must implement abstract method")
class FirstSynset(WSD):
'''
This class returns the first synset of a list of synsets for a word on wordnet.
The first synset is the most common sense of the word in a list of synsets.
Methods
--------------
disambiguation(synsets):
returns the appropriate synset after disambiguation process
'''
def disambiguation(self, synsets):
'''
Returns the appropriate synset after disambiguation process.
parameteres
-----------
synsets: list
a list of synsets
'''
return synsets[0]