Fix Search Engine Detection Discrepancy in Chrome Evaluation (#172)

* Update bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json

* Update __init__.py

* Update general.py
This commit is contained in:
Xubin Ren
2025-04-10 17:24:50 +08:00
committed by GitHub
parent eb24584098
commit 1d10514125
3 changed files with 12 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ from .general import (
check_json,
check_list,
exact_match,
match_in_list,
is_in_list,
fuzzy_match,
check_include_exclude,

View File

@@ -47,6 +47,14 @@ def exact_match(result, rules) -> float:
else:
return 0.
def match_in_list(result, rules) -> float:
expect = rules["expected"]
print(result, expect)
if result in expect:
return 1.
else:
return 0.
def literal_match(result: Any, expected: Any, **options) -> float:
literal_type = options.get('type', 'str')
@@ -495,4 +503,4 @@ if __name__ == '__main__':
"end": "NYC",
"time": "{DoW}, {Month} {DayD}, {Year}",
"category": "Miles"
}}))
}}))

View File

@@ -29,14 +29,14 @@
"chrome"
],
"evaluator": {
"func": "exact_match",
"func": "match_in_list",
"result": {
"type": "default_search_engine"
},
"expected": {
"type": "rule",
"rules": {
"expected": "Bing"
"expected": ["Microsoft Bing", "Bing"]
}
}
}