Skip to content

Commit

Permalink
Add multi-language support (Chinese)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixing76 committed May 13, 2024
1 parent 9a3bb4e commit 3be43d1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions script/minimal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
reset = "\033[0m"


def minimal_test():
def minimal_test(lang="en"):
# Initialize the FactCheck class
factcheck = FactCheck()
prompt = "chatgpt_prompt"
match lang:
case "zh":
prompt = "chatgpt_prompt_zh"
factcheck = FactCheck(prompt=prompt)

def atom_test(instance):
response = instance["response"]
Expand All @@ -27,7 +31,7 @@ def atom_test(instance):
except: # noqa E722
return False

with open("minimal_test.json") as f:
with open(f"minimal_test_{lang}.json", encoding='utf-8') as f:
test_data = json.load(f)
num_tests = len(test_data)

Expand All @@ -52,4 +56,4 @@ def atom_test(instance):


if __name__ == "__main__":
minimal_test()
minimal_test("zh")

0 comments on commit 3be43d1

Please sign in to comment.