KevinHuSh
commited on
Commit
·
4bfd3a5
1
Parent(s):
a68b28a
examples empty in categorize (#1422)
Browse files### What problem does this PR solve?
Examples empty in categorize
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- graph/component/categorize.py +1 -1
- rag/nlp/term_weight.py +1 -1
graph/component/categorize.py
CHANGED
@@ -43,7 +43,7 @@ class CategorizeParam(GenerateParam):
|
|
43 |
def get_prompt(self):
|
44 |
cate_lines = []
|
45 |
for c, desc in self.category_description.items():
|
46 |
-
for l in desc
|
47 |
if not l: continue
|
48 |
cate_lines.append("Question: {}\tCategory: {}".format(l, c))
|
49 |
descriptions = []
|
|
|
43 |
def get_prompt(self):
|
44 |
cate_lines = []
|
45 |
for c, desc in self.category_description.items():
|
46 |
+
for l in desc.get("examples", "").split("\n"):
|
47 |
if not l: continue
|
48 |
cate_lines.append("Question: {}\tCategory: {}".format(l, c))
|
49 |
descriptions = []
|
rag/nlp/term_weight.py
CHANGED
@@ -107,7 +107,7 @@ class Dealer:
|
|
107 |
if re.match(p, t):
|
108 |
tk = "#"
|
109 |
break
|
110 |
-
tk = re.sub(r"([\+\\-])", r"\\\1", tk)
|
111 |
if tk != "#" and tk:
|
112 |
res.append(tk)
|
113 |
return res
|
|
|
107 |
if re.match(p, t):
|
108 |
tk = "#"
|
109 |
break
|
110 |
+
#tk = re.sub(r"([\+\\-])", r"\\\1", tk)
|
111 |
if tk != "#" and tk:
|
112 |
res.append(tk)
|
113 |
return res
|