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:
@@ -61,6 +61,7 @@ from .general import (
|
||||
check_json,
|
||||
check_list,
|
||||
exact_match,
|
||||
match_in_list,
|
||||
is_in_list,
|
||||
fuzzy_match,
|
||||
check_include_exclude,
|
||||
|
||||
@@ -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"
|
||||
}}))
|
||||
}}))
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user