Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import nltk
|
|
|
|
|
|
|
|
|
|
| 3 |
from nltk.corpus import words
|
|
|
|
| 4 |
|
| 5 |
st.markdown("π² Word Games π - Enter two to seven letters to get a high score of as many words as you can of that length. Leave a letter blank to confine word search to a smaller number of letters.")
|
| 6 |
|
|
@@ -88,37 +92,30 @@ for word in seven_letters:
|
|
| 88 |
if all(c in word for c in clue7) and not any(c in word for c in exclusions):
|
| 89 |
score7+=1
|
| 90 |
clue_result7.append(word)
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
st.markdown("### Words and Scores for Selected Letters")
|
|
|
|
|
|
|
| 93 |
st.write("Words for ",clue2, clue_result2)
|
| 94 |
-
tscore2=score2 * 2
|
| 95 |
st.write("Score for 2 letter words = ", (tscore2))
|
| 96 |
st.write("Words for ",clue3, clue_result3)
|
| 97 |
-
tscore3=score3 * 4
|
| 98 |
st.write("Score for 3 letter words = ", (tscore3))
|
| 99 |
st.write("Words for ",clue4, clue_result4)
|
| 100 |
-
tscore4=score4 * 8
|
| 101 |
st.write("Score for 4 letter words = ", (tscore4))
|
| 102 |
st.write("Words for ",clue5, clue_result5)
|
| 103 |
-
tscore5=score5 * 16
|
| 104 |
st.write("Score for 5 letter words = ", (tscore5))
|
| 105 |
st.write("Words for ",clue6, clue_result6)
|
| 106 |
-
tscore6=score6 * 32
|
| 107 |
st.write("Score for 6 letter words = ", (tscore6))
|
| 108 |
st.write("Words for ",clue7, clue_result7)
|
| 109 |
-
tscore7=score7 * 64
|
| 110 |
st.write("Score for 7 letter words = ", (tscore7))
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
totalScore =tscore2 + tscore3 + tscore4 + tscore5 + tscore6 + tscore7
|
| 114 |
-
st.write("Total Score = ", (totalScore))
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
import requests
|
| 118 |
-
from bs4 import BeautifulSoup as soup
|
| 119 |
-
import lxml
|
| 120 |
-
import lxml.etree as xml
|
| 121 |
-
|
| 122 |
|
| 123 |
@st.cache # cache download processes so they only execute once with same inputs
|
| 124 |
def define(word):
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import nltk
|
| 3 |
+
import requests
|
| 4 |
+
import lxml
|
| 5 |
+
import lxml.etree as xml
|
| 6 |
from nltk.corpus import words
|
| 7 |
+
from bs4 import BeautifulSoup as soup
|
| 8 |
|
| 9 |
st.markdown("π² Word Games π - Enter two to seven letters to get a high score of as many words as you can of that length. Leave a letter blank to confine word search to a smaller number of letters.")
|
| 10 |
|
|
|
|
| 92 |
if all(c in word for c in clue7) and not any(c in word for c in exclusions):
|
| 93 |
score7+=1
|
| 94 |
clue_result7.append(word)
|
| 95 |
+
|
| 96 |
+
tscore2=score2 * 2
|
| 97 |
+
tscore3=score3 * 4
|
| 98 |
+
tscore4=score4 * 8
|
| 99 |
+
tscore5=score5 * 16
|
| 100 |
+
tscore6=score6 * 32
|
| 101 |
+
tscore7=score7 * 64
|
| 102 |
+
totalScore =tscore2 + tscore3 + tscore4 + tscore5 + tscore6 + tscore7
|
| 103 |
+
|
| 104 |
st.markdown("### Words and Scores for Selected Letters")
|
| 105 |
+
st.write("Total Score = ", (totalScore))
|
| 106 |
+
|
| 107 |
st.write("Words for ",clue2, clue_result2)
|
|
|
|
| 108 |
st.write("Score for 2 letter words = ", (tscore2))
|
| 109 |
st.write("Words for ",clue3, clue_result3)
|
|
|
|
| 110 |
st.write("Score for 3 letter words = ", (tscore3))
|
| 111 |
st.write("Words for ",clue4, clue_result4)
|
|
|
|
| 112 |
st.write("Score for 4 letter words = ", (tscore4))
|
| 113 |
st.write("Words for ",clue5, clue_result5)
|
|
|
|
| 114 |
st.write("Score for 5 letter words = ", (tscore5))
|
| 115 |
st.write("Words for ",clue6, clue_result6)
|
|
|
|
| 116 |
st.write("Score for 6 letter words = ", (tscore6))
|
| 117 |
st.write("Words for ",clue7, clue_result7)
|
|
|
|
| 118 |
st.write("Score for 7 letter words = ", (tscore7))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
@st.cache # cache download processes so they only execute once with same inputs
|
| 121 |
def define(word):
|