Commit ad792140 authored by lintangsutawika's avatar lintangsutawika
Browse files

removed

parent 0348ed97
......@@ -10,7 +10,6 @@ FILTER_REGISTRY = {
"majority_vote": selection.MajorityVoteFilter,
"take_first_k": selection.TakeKFilter,
"remove_whitespace": extraction.WhitespaceFilter,
"cot_filter": extraction.CoTFilter,
"lowercase": transformation.LowercaseFilter,
"uppercase": transformation.UppercaseFilter,
"map": transformation.MapFilter,
......
......@@ -60,45 +60,3 @@ class WhitespaceFilter(Filter):
filtered_resps = [filter_set(resp) for resp in resps]
return filtered_resps
class CoTFilter(Filter):
""" """
def __init__(self):
pass
def apply(self, resps):
def filter_set(inst):
filtered_resp = []
for resp in inst:
resp = resp.strip()
if resp[-1] in [".", ",", "?", " ", "\n"]:
resp = resp[:-1].strip()
if resp[0] == "(" and resp[-1] == ")":
resp = resp[1:-1].strip()
return resp
else:
resp = resp.split("resp is")[-1].strip()
resp = resp.split("final resp")[-1].strip()
resp = resp.split("Final resp")[-1].strip()
resp = resp.split("resp:")[-1].strip()
resp = resp.split("resp:")[-1].strip()
if resp and resp[0] in [".", ",", "?", " ", "\n", ":"]:
resp = resp[1:].strip()
if resp and resp[-1] in [".", ",", "?", " ", "\n", ":"]:
resp = resp[:-1].strip()
# corner case 2: is prediction is (B), should processed into B.
if resp and resp[0] == "(" and resp[-1] == ")":
resp = resp[1:-1].strip()
filtered_resp.append(resp)
return filtered_resp
filtered_resps = [filter_set(resp) for resp in resps]
return filtered_resps
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment