Skip to content

Conversation

@JoseManuelPintoLozano
Copy link
Collaborator

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

Imported in the main.py file to use it
In Board.py change the method to load the words file using utf8
Copy link
Owner

@ikeinyyo ikeinyyo left a 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

return similarity


def __get_first_common_hypernym(self, word1, word2, lang = 'spa'):
Copy link
Owner

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

Copy link
Owner

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


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()))
Copy link
Owner

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


def __get_path_similarity(self, synset1, synset2):
similarity = wn.path_similarity(synset1, synset2)
similarity = similarity if similarity else 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return similarity or 0



def __get_first_common_hypernym(self, word1, word2, lang = 'spa'):
try:
Copy link
Owner

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.

@ikeinyyo
Copy link
Owner

ikeinyyo commented Sep 9, 2022

Fran approved this code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants