Skip to content

Commit 3e91f48

Browse files
committed
Improve readability
1 parent a69e418 commit 3e91f48

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

nltk/corpus/reader/wordnet.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ def _load_lang_data(self, lang):
13271327
self.add_omw()
13281328

13291329
if lang not in self.langs():
1330-
raise WordNetError("Language is not supported.")
1330+
raise WordNetError(f"Language {lang} is not supported.")
13311331

13321332
if self._exomw_reader and lang not in self.omw_langs:
13331333
reader = self._exomw_reader
@@ -1452,11 +1452,14 @@ def _next_token():
14521452
# map lemmas and parts of speech to synsets
14531453
self._lemma_pos_offset_map[lemma][pos] = synset_offsets
14541454
if pos == ADJ:
1455-
# Filter adjective satellites:
1455+
# index.adj uses only the ADJ pos, so identify ADJ_SAT using satellites set
14561456
satellite_offsets = [
1457-
of for of in synset_offsets if of in self.satellite_offsets
1457+
# Keep the ordering from index.adj
1458+
offset
1459+
for offset in synset_offsets
1460+
if offset in self.satellite_offsets
14581461
]
1459-
# Duplicate only real satellites
1462+
# Duplicate only a (possibly empty) list of real satellites
14601463
self._lemma_pos_offset_map[lemma][ADJ_SAT] = satellite_offsets
14611464

14621465
def _load_exception_map(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy