MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / must_include

Method must_include

webarena/evaluation_harness/evaluators.py:98–111  ·  view source on GitHub ↗
(ref: str, pred: str, tokenize: bool = False)

Source from the content-addressed store, hash-verified

96 @staticmethod
97 @beartype
98 def must_include(ref: str, pred: str, tokenize: bool = False) -> float:
99 clean_ref = StringEvaluator.clean_answer(ref)
100 clean_pred = StringEvaluator.clean_answer(pred)
101 # tokenize the answer if the ref is a single word
102 # prevent false positive (e.g, 0)
103 if (
104 tokenize
105 and len(clean_ref) == 1
106 and len(word_tokenize(clean_ref)) == 1
107 ):
108 tok_pred = word_tokenize(clean_pred)
109 return float(clean_ref in tok_pred)
110 else:
111 return float(clean_ref in clean_pred)
112
113 @staticmethod
114 @beartype

Callers 2

__call__Method · 0.95
__call__Method · 0.80

Calls 1

clean_answerMethod · 0.80

Tested by

no test coverage detected