Cachoups commited on
Commit
8ed5868
·
verified ·
1 Parent(s): cd94c7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -171,7 +171,9 @@ def find_sentences_with_keywords(text, keywords):
171
  # Main function to process both PDFs based on the Excel file names and the sheet name
172
  def process_pdfs_and_analyze_sentiment(file1, file2, sheet):
173
  # Extract text from both PDFs based on the file name
174
- text1, text2 =extract_and_paragraph(file1, file2, False)
 
 
175
  # Use sheet name as the keyword to find relevant sentences
176
  keywords = {
177
  'GDP': ['GDP'],
@@ -187,8 +189,8 @@ def process_pdfs_and_analyze_sentiment(file1, file2, sheet):
187
  sentences2 = find_sentences_with_keywords(text2, selected_keywords)
188
 
189
  # Concatenate all sentences for each PDF
190
- text_pdf1 = " ".join(sentences1)
191
- text_pdf2 = " ".join(sentences2)
192
 
193
  # Perform sentiment analysis on the extracted sentences for each PDF
194
  result_pdf1 = fin_ext_bis(text_pdf1)
 
171
  # Main function to process both PDFs based on the Excel file names and the sheet name
172
  def process_pdfs_and_analyze_sentiment(file1, file2, sheet):
173
  # Extract text from both PDFs based on the file name
174
+ pdf_file1 = file1.replace(".xlsx", ".pdf")
175
+ pdf_file2 = file2.replace(".xlsx", ".pdf")
176
+ text1, text2 =extract_and_paragraph(pdf_file1, pdf_file2, False)
177
  # Use sheet name as the keyword to find relevant sentences
178
  keywords = {
179
  'GDP': ['GDP'],
 
189
  sentences2 = find_sentences_with_keywords(text2, selected_keywords)
190
 
191
  # Concatenate all sentences for each PDF
192
+ text_pdf1 = "\n".join(sentences1)
193
+ text_pdf2 = "\n".join(sentences2)
194
 
195
  # Perform sentiment analysis on the extracted sentences for each PDF
196
  result_pdf1 = fin_ext_bis(text_pdf1)