Fix minor bugs caused from merging in setupcontroller; Initialize vscode example loading
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from typing import Dict
|
||||
|
||||
|
||||
def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
"""
|
||||
Args:
|
||||
@@ -7,7 +10,7 @@ def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
|
||||
|
||||
with open(actual) as f1:
|
||||
actual_text = f1.read()
|
||||
with open(expected) as f2:
|
||||
@@ -17,24 +20,17 @@ def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
return 1.0
|
||||
return 0.0
|
||||
|
||||
def compare_config(actual: str, expected: str, **options) -> float:
|
||||
"""
|
||||
Args:
|
||||
actual (str): path to result text file
|
||||
expected (str): gold string
|
||||
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
|
||||
def compare_config(actual: str, rules: Dict, **options) -> float:
|
||||
with open(actual) as f1:
|
||||
actual_text = f1.read()
|
||||
|
||||
if actual_text == expected:
|
||||
if actual_text == rules['expect']:
|
||||
return 1.0
|
||||
return 0.0
|
||||
|
||||
def compare_answer(actual: str, expected: str, **options) -> float:
|
||||
|
||||
def compare_answer(actual: str, rules: Dict, **options) -> float:
|
||||
"""
|
||||
Args:
|
||||
actual (str): result string
|
||||
@@ -44,11 +40,8 @@ def compare_answer(actual: str, expected: str, **options) -> float:
|
||||
float: the score
|
||||
"""
|
||||
|
||||
if actual == expected:
|
||||
if actual == rules['expect']:
|
||||
return 1.0
|
||||
|
||||
|
||||
# TODO: can use text embedding to get non-zero return
|
||||
return 0.0
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(compare_text_file("README.md", "README.md"))
|
||||
Reference in New Issue
Block a user