浏览代码

Artiklide eksport "relevance_score" osa

Ardo Kubjas 4 月之前
父节点
当前提交
2f216f94a2
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      save_articles_to_pdf.py

+ 2 - 3
save_articles_to_pdf.py

@@ -524,12 +524,11 @@ def create_pdf_from_articles(articles, output_filename):
                     elements.append(Paragraph("<b>PIIRANGUD:</b>", normal_style))
                     elements.append(Paragraph(context_text, normal_style))
             # Proovi leida relevance_score regex'iga
-            match = re.search(r'"relevance_score":\s*"([^"]*(?:\\"[^"]*)*)"', analysis_text)
+            match = re.search(r'"relevance_score":\s*(\d+(?:\.\d+)?)', analysis_text)
             if match:
                 context_text = match.group(1)
                 if context_text:
-                    elements.append(Paragraph("<b>RELEVANTSUSE SKOOR:</b>", normal_style))
-                    elements.append(Paragraph(context_text, normal_style))
+                    elements.append(Paragraph("<b>RELEVANTSUSE SKOOR:</b> " + context_text, normal_style))
         
         # Allikfail ja töötlemise info
         footer_info = []