From e8570da8560331e47678b24c67ab4add0b7f1947 Mon Sep 17 00:00:00 2001
From: YC <ychuang.cn@gmail.com>
Date: Wed, 17 Apr 2024 19:48:11 +0800
Subject: [PATCH] Update table.py to convert clmns to string (#414)

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
---
 rag/app/table.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rag/app/table.py b/rag/app/table.py
index 29fa254..c090080 100644
--- a/rag/app/table.py
+++ b/rag/app/table.py
@@ -199,7 +199,7 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000,
                 re.sub(
                     r"(/.*|([^()]+?)|\([^()]+?\))",
                     "",
-                    n),
+                    str(n)),
                 '_')[0] for n in clmns]
         clmn_tys = []
         for j in range(len(clmns)):
@@ -208,7 +208,7 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000,
             df[clmns[j]] = cln
             if ty == "text":
                 txts.extend([str(c) for c in cln if c])
-        clmns_map = [(py_clmns[i].lower() + fieds_map[clmn_tys[i]], clmns[i].replace("_", " "))
+        clmns_map = [(py_clmns[i].lower() + fieds_map[clmn_tys[i]], str(clmns[i]).replace("_", " "))
                      for i in range(len(clmns))]
 
         eng = lang.lower() == "english"  # is_english(txts)
-- 
GitLab