You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where word is the word being passed to these functions.
The exact command structure can be changed if a better alternative is found.
!syn:word would erase the command and paste the first synonym. The command would remain in progress and the up/down arrow would shuffle through the other synonyms up to a certain limit. Pressing space, tab, or enter would exit the command.
!def:word would erase the command and paste the definition of the word.
The text was updated successfully, but these errors were encountered:
This needs to be moved to a future update. This is a much larger feature than I anticipated and may require a functional GUI first.
The below class can be added once this feature is ready to be created.
import nltk
from Logger import Logger
from nltk.corpus import wordnet
class WordTools:
def __init__(self, _log):
nltk_dir = './nltk/'
nltk.download('wordnet', download_dir=nltk_dir)
nltk.data.path.append(nltk_dir)
def get_synonym_list(self, word):
_synsets = wordnet.synsets(word)
_synonyms = []
for syn in _synsets:
for item in syn.lemmas():
_synonyms.append(item.name())
# Todo: Determine some sort of sorting. Sort by popularity would be ideal. Otherwise, alphabetical is another option
return _synonyms
if __name__ == "__main__":
# Debugging
# Creates instance of Logger
L = Logger()
L.log.debug("Program started from WordTools.py. Debugging.")
word = WordTools(L)
word.get_synonym_list("fall")
Create new command functions such as:
Where word is the word being passed to these functions.
The exact command structure can be changed if a better alternative is found.
!syn:word would erase the command and paste the first synonym. The command would remain in progress and the up/down arrow would shuffle through the other synonyms up to a certain limit. Pressing space, tab, or enter would exit the command.
!def:word would erase the command and paste the definition of the word.
The text was updated successfully, but these errors were encountered: