Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
klebster2 committed Nov 19, 2024
1 parent c7fc741 commit 1a1e49b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions python/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
from collections import defaultdict
from dataclasses import dataclass
from enum import Enum
from functools import lru_cache
from typing import Dict, List, Optional, Set, Tuple, TypeVar, Union, cast

from wn import Form

# Append to path local wordsense.py
sys.path.append(".")
Expand All @@ -39,9 +35,11 @@ def install(package: str):
# This is the quick and dirty way to get packages installed if they are not already installed
try:
import wn
from wn import Form
except ImportError:
install("wn")
import wn
from wn import Form

if vim is None:
# pytest is running
Expand Down Expand Up @@ -227,7 +225,10 @@ def process_related(related_synset: "wn.Synset", relation_type: str):
relation_chains[word].extend(chains)

# Process relations based on word class
if word_class == WordClass.NOUN or word_class == WordClass.VERB:
if (
word_class == WordClass.NOUN # pylint: disable=consider-using-in
or word_class == WordClass.VERB # pylint: disable=consider-using-in
):
for hypernym in synset.hypernyms():
process_related(hypernym, "hypernym")
for hyponym in synset.hyponyms():
Expand All @@ -252,8 +253,6 @@ def build_semantic_document(
self, word: str, word_class: WordClass
) -> SemanticDocument:
"""Build a comprehensive semantic document for a word and its relations."""
from collections import defaultdict

all_definitions: t.Dict[
str, t.List[t.Tuple[str, t.List[t.Tuple[str, str]]]]
] = defaultdict(list)
Expand Down

0 comments on commit 1a1e49b

Please sign in to comment.