@@ -125,7 +125,11 @@ def _process_single_sample(
125125
126126 for metric_name , metric in metrics_dict .items ():
127127 reference = sample .reference
128- kwargs = sample .extra_info
128+ kwargs = dict (sample .extra_info )
129+
130+ # Use metric_keywords for metric calculation if available, falling back to dictionary
131+ if "metric_keywords" in kwargs :
132+ kwargs ["dictionary" ] = kwargs .pop ("metric_keywords" )
129133
130134 # The metric returns a dictionary that is also stored in the metric object as a state to compute the global result
131135 # We copy to avoid any side effects that may happen while interacting with dictionary for reporting
@@ -254,10 +258,15 @@ def _run_pipeline_on_dataset_parallel(
254258 # Update metric with all results
255259 for sample_result in per_sample_results :
256260 sample = dataset [sample_result .sample_id ]
257- # Get UEM from extra_info if available
258261 kwargs = {}
259- if hasattr (sample , "extra_info" ) and "uem" in sample .extra_info :
260- kwargs ["uem" ] = sample .extra_info ["uem" ]
262+ if hasattr (sample , "extra_info" ):
263+ if "uem" in sample .extra_info :
264+ kwargs ["uem" ] = sample .extra_info ["uem" ]
265+ # Use metric_keywords for metric calculation if available, falling back to dictionary
266+ if "metric_keywords" in sample .extra_info :
267+ kwargs ["dictionary" ] = sample .extra_info ["metric_keywords" ]
268+ elif "dictionary" in sample .extra_info :
269+ kwargs ["dictionary" ] = sample .extra_info ["dictionary" ]
261270
262271 metric (hypothesis = sample_result .prediction , reference = sample .reference , detailed = True , ** kwargs )
263272
0 commit comments