Commit 3c895d56 authored by lintangsutawika's avatar lintangsutawika
Browse files

reformat

parent 3262fb74
...@@ -7,7 +7,7 @@ output_type: multiple_choice ...@@ -7,7 +7,7 @@ output_type: multiple_choice
training_split: train training_split: train
validation_split: validation validation_split: validation
test_split: null test_split: null
template_aliases: "{% set gold = label %}{% set answer_choices = endings|map('regex_replace', '\\[.*?\\]', '')|map('replace', ' [title]', '. ')|map('replace', ' ', ' ')|list %}" template_aliases: "{% set gold = label %}{% set answer_choices = endings|map('regex_replace', '\\[.*?\\]', '')|map('replace', ' [title]', '. ')|map('replace', ' ', ' ')|list %}"
doc_to_text: "{% set text = activity_label ~ ': ' ~ ctx_a ~ ' ' ~ ctx_b.capitalize() %}{{text|regex_replace('\\[.*?\\]', '')|replace(' [title]', '. ')|replace(' ', ' ')}}" doc_to_text: "{% set text = activity_label ~ ': ' ~ ctx_a ~ ' ' ~ ctx_b.capitalize() %}{{text|regex_replace('\\[.*?\\]', '')|replace(' [title]', '. ')|replace(' ', ' ')}}"
doc_to_target: "{{answer_choices[gold]}}" doc_to_target: "{{answer_choices[gold]}}"
gold_alias: "{{gold}}" gold_alias: "{{gold}}"
......
...@@ -398,10 +398,12 @@ def load_yaml_config(yaml_path): ...@@ -398,10 +398,12 @@ def load_yaml_config(yaml_path):
return final_yaml_config return final_yaml_config
return yaml_config return yaml_config
def regex_replace(string, pattern, repl, count=0): def regex_replace(string, pattern, repl, count=0):
"""Implements the `re.sub` function as a custom Jinja filter.""" """Implements the `re.sub` function as a custom Jinja filter."""
return re.sub(pattern, repl, string, count=count) return re.sub(pattern, repl, string, count=count)
env = Environment(loader=BaseLoader, undefined=StrictUndefined) env = Environment(loader=BaseLoader, undefined=StrictUndefined)
env.filters["regex_replace"] = regex_replace env.filters["regex_replace"] = regex_replace
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment