Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d856a73

Browse files
committed
Repair a crucial Copilot omission
1 parent c6a1911 commit d856a73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nltk/corpus/reader/wordnet.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070

7171
POS_LIST = [NOUN, VERB, ADJ, ADV]
7272

73+
# Convert from Universal Tags (Petrov et al., 2012) to Wordnet Pos
74+
UTAG2WN_POS = {"NOUN": "n", "VERB": "v", "ADJ": "a", "ADV": "r"}
75+
7376
# A table of strings that are used to express verb frames.
7477
VERB_FRAME_STRINGS = (
7578
None,
@@ -2108,7 +2111,7 @@ def filter_forms(forms):
21082111
# 2. Return all that are in the database (and check the original too)
21092112
return filter_forms([form] + forms)
21102113

2111-
def tag2pos(self, tag, tagset="en-ptb") -> Optional[str]:
2114+
def tag2pos(self, tag, tagset="en-ptb"):
21122115
"""
21132116
Convert a tag from one of the tagsets in nltk_data/taggers/universal_tagset to a
21142117
WordNet Part-of-Speech, using Universal Tags (Petrov et al., 2012) as intermediary.
@@ -2119,7 +2122,7 @@ def tag2pos(self, tag, tagset="en-ptb") -> Optional[str]:
21192122
tagset (str): The tagset of the input tag. Defaults to "en-ptb".
21202123
21212124
Returns:
2122-
Optional[str]: The corresponding WordNet POS tag ('n', 'v', 'a', 'r') or None
2125+
The corresponding WordNet POS tag ('n', 'v', 'a', 'r') or None
21232126
if the tag cannot be mapped to a WordNet POS.
21242127
21252128
Example:

0 commit comments

Comments
 (0)