From a2d46b906bed910ad42b7a05ec0c7c34ee9acf13 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Wed, 16 Oct 2024 10:27:39 +0200 Subject: [PATCH] Update according to precedent changes --- README.md | 2 +- src/cemantix.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e10737e..ff9cf2f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Basic use ```bash -python cemantix.py -m +python src/cemantix.py -m > # input your guess > # help() to get an hint > # clear() to remove words that are not useful diff --git a/src/cemantix.py b/src/cemantix.py index a5820aa..9e8b9cf 100644 --- a/src/cemantix.py +++ b/src/cemantix.py @@ -17,12 +17,12 @@ def random_word(model, k=5, dist=100): complete_list += [i[0] for i in model.most_similar(word, topn=dist)] rk_words = model.rank_by_centrality(complete_list) - return rk_words[random.randint(0,5)][1] + return rk_words[random.randint(0,5)%len(rk_words)][1] def cemantix(model, word=None): while word is None or len(word) < 5 or '-' in word or '_' in word: - word = random_word(model, k=1, dist=1) # augment numbers to try a "smooth selection" + word = random_word(model, k=1, dist=0) # augment dist for a "smoother selection" nearest = [word]+[i[0] for i in model.most_similar(word, topn=1000)] guesses = [] # guess, temp, rank @@ -96,7 +96,7 @@ def main(): parser.add_argument("-w", "--word", dest="word", action="store", help="Specify goal word") parser.add_argument("-m", "--model", dest="model", action="store", - default="frWac_non_lem_no_postag_no_phrase_200_skip_cut100.bin", + default="models/selected_word2vec_model.bin", help="Specify model to use") args = parser.parse_args()