Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -117,7 +117,20 @@ def upload():
|
|
117 |
st.write("دیتا فریم مربوط به فایل اکسل:")
|
118 |
st.write(df)
|
119 |
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
def main():
|
122 |
st.set_page_config(
|
123 |
page_title="Chat Bot PDFs",
|
|
|
117 |
st.write("دیتا فریم مربوط به فایل اکسل:")
|
118 |
st.write(df)
|
119 |
|
120 |
+
################################################################################################################
|
121 |
+
def sentences_f(sentence,df2):
|
122 |
+
words = sentence.split()
|
123 |
+
df1 = pd.DataFrame(words, columns=['کلمات'])
|
124 |
+
df1['معادل'] = ''
|
125 |
+
for i, word in df1['کلمات'].items():
|
126 |
+
match = df2[df2['کلمات'] == word]
|
127 |
+
if not match.empty:
|
128 |
+
df1.at[i, 'معادل'] = match['معادل'].values[0]
|
129 |
+
df1['معادل'] = df1.apply(lambda row: row['کلمات'] if row['معادل'] == '' else row['معادل'], axis=1)
|
130 |
+
translated_sentence = ' '.join(df1['معادل'].tolist())
|
131 |
+
return translated_sentence
|
132 |
+
|
133 |
+
####################################################################################################################
|
134 |
def main():
|
135 |
st.set_page_config(
|
136 |
page_title="Chat Bot PDFs",
|