Skip to content

Commit 1a43cb2

Browse files
authored
Update tweet_gen.py
1 parent 1bb5ca6 commit 1a43cb2

File tree

1 file changed

+3
-43
lines changed

1 file changed

+3
-43
lines changed

tweet_gen.py

+3-43
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,7 @@
99

1010

1111

12-
# print("\n Dla jakiej partii chcesz wygenerować tweet?")
13-
# party = (str(input())).upper()
1412

15-
# filename = "models/" + party + "_15-iter_trained_model.sav"
16-
# loaded_model = pickle.load(open(filename, "rb"))
17-
18-
19-
# print("\n Podaj liczbę słów wejciowych:")
20-
# input_words_num = int(input())
21-
22-
# print("\n Podaj oczekiwaną liczbę słów w zdaniu:")
23-
# total_words_num = int(input())
24-
25-
# print("\n Które w kolejnoci najbliższe słowo ma zostać wygenerowane jako następne? Podaj liczbę większą od 0.")
26-
# n = int(input())
27-
28-
29-
# word_list = []
30-
31-
# if input_words_num == 1:
32-
33-
# print("\n Podaj pierwsze słowo:")
34-
35-
# first_word = str(input())
36-
# word_list.append(first_word)
37-
38-
# elif input_words_num > 1:
39-
40-
# for i in range(0, input_words_num):
41-
42-
# print("\n Podaj " + str(i+1) + " słowo:")
43-
44-
# word = str(input())
45-
# word_list.append(word)
4613

4714
class Tweet_generator():
4815

@@ -61,13 +28,13 @@ def tweet_gen(input_words_num, total_words_num, word_list, similar_num, party):
6128

6229

6330
predicted_word = loaded_model.wv.most_similar (positive=word_list)
64-
# print(predicted_word)
31+
6532
next_word = predicted_word[similar_num-1][0]
6633
if next_word in word_list:
6734
next_word = predicted_word[similar_num][0]
6835

6936
word_list.append(next_word)
70-
# print(word_list)
37+
7138

7239

7340
elif input_words_num > 1:
@@ -86,13 +53,6 @@ def tweet_gen(input_words_num, total_words_num, word_list, similar_num, party):
8653
sentence = sentence + word + " "
8754

8855
return sentence
89-
# print("\n" + sentence)
90-
91-
92-
93-
94-
95-
#Tweet_generator.tweet_gen(input_words_num, total_words_num, word_list)
96-
56+
9757

9858

0 commit comments

Comments
 (0)