File size: 1,110 Bytes
743de20 5dc8409 743de20 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import streamlit as st # this is for web app
import nltk # nltk for english words
from nltk.corpus import words # nltk words is to get five letter words
st.title("Word Solver")
@st.cache # cache the download process
def download():
nltk.download('words')
download()
five_letters = [word for word in words.words() if len(word)==5 ]
[a,b,c,d,e] = st.columns(5)
with a:
first_letter = st.text_input(label="1st",value = 'a')
with b:
second_letter = st.text_input(label="2nd", value = 'b')
with c:
third_letter = st.text_input(label="3rd", value = 'e')
with d:
fourth_letter = st.text_input(label="4th", value = '')
with e:
fifth_letter = st.text_input(label="5th", value = 't')
clue = first_letter+second_letter+third_letter+fourth_letter+fifth_letter
st.markdown("### clue")
st.write(clue)
st.markdown("### Exclusion letters")
exclusions = st.text_input(label="exclusions")
st.markdown("# Wordle Clues")
clue_result = []
for word in five_letters:
if all(c in word for c in clue) and not any(c in word for c in exclusions):
clue_result.append(word)
st.write(clue_result)
|