We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff77605 commit 557c2d0Copy full SHA for 557c2d0
wordnet/nltk.py
@@ -2,7 +2,7 @@
2
from nltk.corpus.reader.wordnet import Synset
3
import re
4
5
-format_regexp = r'^\W*\((?P<pos>\w+)\)\W+(?P<stem>\w+)\W*\#\W*(?P<num>\d+)\W*\Z'
+format_regexp = r'^\W*\((?P<pos>\w+)\)\W+(?P<stem>\w.*)\W*\#\W*(?P<num>\d+)\W*\Z'
6
7
def candidates(keyword):
8
if not keyword:
@@ -18,7 +18,8 @@ def candidates(keyword):
18
19
def name_format(synset : Synset):
20
data = synset.name().split(".")
21
- return f"({data[1]}) {data[0]}#{int(data[2])}"
+ entry = ".".join(data[0:-2])
22
+ return f"({data[-2]}) {entry}#{int(data[-1])}"
23
24
def normalize_keyword(keyword: str) -> str:
25
matches = re.match(format_regexp, keyword)
0 commit comments