-
Notifications
You must be signed in to change notification settings - Fork 0
feat(new bot): Added HypernymBot to the game #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Imported in the main.py file to use it In Board.py change the method to load the words file using utf8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, refactor the code
src/bots/HypernymBot.py
Outdated
| return similarity | ||
|
|
||
|
|
||
| def __get_first_common_hypernym(self, word1, word2, lang = 'spa'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass lang at the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change and use a converter to translate language to wn_language
src/bots/HypernymBot.py
Outdated
|
|
||
| def give_answer(self, clue): | ||
| clue = str.lower(clue) | ||
| triple_list = list(map(lambda word: (word, self.__get_first_common_hypernym(clue, word)), self._board.get_available_words())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change triple_list by a better name
src/bots/HypernymBot.py
Outdated
|
|
||
| def __get_path_similarity(self, synset1, synset2): | ||
| similarity = wn.path_similarity(synset1, synset2) | ||
| similarity = similarity if similarity else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return similarity or 0
src/bots/HypernymBot.py
Outdated
|
|
||
|
|
||
| def __get_first_common_hypernym(self, word1, word2, lang = 'spa'): | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to review this code. Please, refactor this code using better names, methods, and other techniques. Then we can talk.
Add Pylint fix all pylint warnings Add dataclass Add types annotations Fix pylint Change name
Imported in the main.py file to use it In Board.py change the method to load the words file using utf8 Rebase branch into refactor to include pylint and the last changes
…reviously with uppercase now with lowercase
|
Fran approved this code |
Added HypernymBot to the game
Imported in the main.py file to use it
In Board.py change the method to load the words file using utf8