awacke1 commited on
Commit
4ee3288
β€’
1 Parent(s): 369a349

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -84,4 +84,21 @@ st.write(clue_result4)
84
  st.write(clue_result5)
85
  st.write(clue_result6)
86
  st.write(clue_result7)
87
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  st.write(clue_result5)
85
  st.write(clue_result6)
86
  st.write(clue_result7)
87
+
88
+
89
+ import requests
90
+ from bs4 import BeautifulSoup as bs
91
+ import lxml.etree as xml
92
+ import lxml
93
+
94
+ word = input('enter the word: ')
95
+ url = f'https://www.dictionary.com/browse/{word}?s=t'
96
+ web_page = bs(requests.get(url, {}).text, "lxml")
97
+ meanings = web_page.find_all('div', attrs={'class': 'css-1ghs5zt e1q3nk1v2'})
98
+ print('\nThe meaning(s) of the word is: ')
99
+ # for all the meanings
100
+ for meaning in meanings:
101
+ st.write('* '+ meaning.text)
102
+ st.write('\n')
103
+ # for most common meaning
104
+ st.write(meanings[0].text)