bradley6597 commited on
Commit
9cb4940
·
1 Parent(s): f33a2c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -6,9 +6,17 @@ dictionary = pd.read_csv("corncob_lowercase.txt",
6
  names = ['word'])
7
  print(dictionary)
8
  def spell_bee_solver(no_centre, centre):
9
- print(centre)
10
  spell_bee_solver = dictionary[dictionary['word'].str.contains(str(centre), regex = False)]
11
- return(spell_bee_solver)
 
 
 
 
 
 
 
 
12
 
13
  with gr.Blocks() as app:
14
  with gr.Row():
 
6
  names = ['word'])
7
  print(dictionary)
8
  def spell_bee_solver(no_centre, centre):
9
+ no_centre_set = set(no_centre)
10
  spell_bee_solver = dictionary[dictionary['word'].str.contains(str(centre), regex = False)]
11
+ final_words = list()
12
+ for i in range(0, spell_bee_solver.shape[0]):
13
+ words = spell_bee_solver['word'].iloc[i]
14
+ words_set = set(words)
15
+ if len(words_set - no_centre_set) == 0:
16
+ final_words.append(words)
17
+
18
+ final_word_df = pd.DataFrame(final_words)
19
+ return(final_word_df)
20
 
21
  with gr.Blocks() as app:
22
  with gr.Row():