32 lines
772 B
Python
32 lines
772 B
Python
def compare_text_file(actual: str, expected: str, **options) -> float:
|
|
"""
|
|
Args:
|
|
actual (str): path to result xlsx
|
|
expected (str): path to gold xlsx
|
|
options (Dict[str, List[str]]): dict like
|
|
{
|
|
}
|
|
|
|
Return:
|
|
float: the score
|
|
"""
|
|
|
|
with open(actual) as f1:
|
|
actual_text = f1.read()
|
|
with open(expected) as f2:
|
|
expected_text = f2.read()
|
|
|
|
if actual_text == expected_text:
|
|
return 1.0
|
|
return 0.0
|
|
|
|
def compare_answer(actual: str, expected: str, **options) -> float:
|
|
|
|
if actual == expected:
|
|
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")) |