PromptSource / templates /docred /templates.yaml
mrm8488's picture
Fix routes
ab13cee
dataset: docred
templates:
02af700c-e9e9-4a84-b75c-5fb29a5b7993: !Template
answer_choices: null
id: 02af700c-e9e9-4a84-b75c-5fb29a5b7993
jinja: "Read the following text and answer the questions.\n\nText:\n{% for sent\
\ in sents -%}\n{{ sent | join(\" \") }}\n{%- endfor %} \n\nQuestion:\nFrom\
\ the above text, find people, locations, organizations, times, numbers, and\
\ miscellaneous.\n|||\n{%- set people = [] -%} \n{%- for ners in vertexSet -%}\n\
{%- for ner in ners if ner['type'] == 'PER' -%}\n{{people.append(ner['name'])\
\ | default(\"\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if people %}\n\
{{\"People: \"}}{{ people | unique | join(\", \")}}{{\".\"}}\n{% endif %}\n\n\
{%- set locations = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner in ners\
\ if ner['type'] == 'LOC' -%}\n{{locations.append(ner['name']) | default(\"\"\
, True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if locations %}\n{{\"Locations:\
\ \"}}{{ locations | unique | join(\", \")}}{{\".\"}}\n{% endif %}\n\n{%- set\
\ orgs = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner in ners if ner['type']\
\ == 'ORG' -%}\n{{orgs.append(ner['name']) | default(\"\", True)}}\n{%- endfor\
\ -%}\n{%- endfor -%}\n{% if orgs %}\n{{\"Organizations: \"}}{{ orgs | unique\
\ | join(\", \")}}{{\".\"}}\n{% endif %}\n\n{%- set times = [] -%} \n{%- for\
\ ners in vertexSet -%}\n{%- for ner in ners if ner['type'] == 'TIME' -%}\n\
{{times.append(ner['name']) | default(\"\", True)}}\n{%- endfor -%}\n{%- endfor\
\ -%}\n{% if times %}\n{{\"Times: \"}}{{ times | unique | join(\", \")}}{{\"\
.\"}}\n{% endif %}\n\n{%- set numbers = [] -%} \n{%- for ners in vertexSet -%}\n\
{%- for ner in ners if ner['type'] == 'NUM' -%}\n{{numbers.append(ner['name'])\
\ | default(\"\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if numbers %}\n\
{{\"Numbers: \"}}{{ numbers | unique | join(\", \")}}{{\".\"}}\n{% endif %}\n\
\n{%- set miscs = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner in ners\
\ if ner['type'] == 'MISC' -%}\n{{miscs.append(ner['name']) | default(\"\",\
\ True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if miscs %}\n{{\"Miscellaneous:\
\ \"}}{{ miscs | unique | join(\", \")}}{{\".\"}}\n{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: type-to-entity
reference: ''
3ab9cfc9-3ba3-41dd-959c-60182def11af: !Template
answer_choices: null
id: 3ab9cfc9-3ba3-41dd-959c-60182def11af
jinja: "Read the following text and answer the questions.\n\nText:\n{% for sent\
\ in sents -%}\n{{ sent | join(\" \") }}\n{%- endfor %} \n\nQuestion:\nAssign\
\ an entity type to the following entities. The choices are PER (Person), LOC\
\ (Location), ORG (Organization), TIME (Time), NUM (Number), and MISC (Miscellaneous).\n\
\nExample: \n{%- set names = [] -%}\n{%- set types = [] -%}\n{% for ners in\
\ vertexSet[:1] %}\n{% for ner in ners if ner['name'] not in names %}\n{{ names.append(ner['name'])\
\ | default(\"\", True) }} \n{{ types.append(ner['type']) | default(\"\", True)\
\ }} \n{% endfor %}\n{% endfor %}\n{% for name, type in zip(names, types) %}\n\
{{name}}{{\": \"}}{{type}}\n{% endfor %}\n\nNow do the same with below:\n\n\
{%- set names = [] -%}\n{%- set types = [] -%}\n{% for ners in vertexSet[1:]\
\ %}\n{% for ner in ners if ner['name'] not in names %}\n{{ names.append(ner['name'])\
\ | default(\"\", True) }} \n{{ types.append(ner['type']) | default(\"\", True)\
\ }} \n{% endfor %}\n{% endfor %}\n{% for name, type in zip(names, types) %}\n\
{{name}}{{\": \"}}\n{% endfor %}\n|||\n{% for name, type in zip(names, types)\
\ %}\n{{name}}{{\": \"}}{{type}}\n{% endfor %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: true
name: ner-type
reference: ''
412b482e-185b-48da-8aef-4a93a42e779d: !Template
answer_choices: null
id: 412b482e-185b-48da-8aef-4a93a42e779d
jinja: "{%- set locations = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner\
\ in ners if ner['type'] == 'LOC' -%}\n{{locations.append(ner['name']) | default(\"\
\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if locations %}\nFind all of\
\ the locations in the text below. \n\n{% for sent in sents -%}\n{{ sent | join(\"\
\ \") }}\n{%- endfor -%} \n|||\n{{ locations| unique | join(\", \")}}{{\".\"\
}}\n{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: find-all-locations
reference: ''
5361a8ba-8ced-4417-be21-ba13fa319e9f: !Template
answer_choices: null
id: 5361a8ba-8ced-4417-be21-ba13fa319e9f
jinja: "{%- set organizations = [] -%} \n{%- for ners in vertexSet -%}\n{%- for\
\ ner in ners if ner['type'] == 'ORG' -%}\n{{organizations.append(ner['name'])\
\ | default(\"\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if organizations\
\ %}\nFind all of the organizations in the text below.\n\n{% for sent in sents\
\ -%}\n{{ sent | join(\" \") }}\n{%- endfor -%} \n|||\n{{ organizations| unique\
\ | join(\", \")}}{{\".\"}}\n{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: find-all-organizations
reference: ''
6efa4d1a-3368-4b12-9e30-588b53801077: !Template
answer_choices: null
id: 6efa4d1a-3368-4b12-9e30-588b53801077
jinja: "{% if labels['relation_text'] %}\nGiven the following entities and relations,\
\ make a creative text. The types are PER (Person), LOC (Location), ORG (Organization),\
\ TIME (Time), NUM (Number), and MISC (Miscellaneous).\n\n{% for head, tail,\
\ relation in zip(labels['head'], labels['tail'], labels['relation_text']) %}\n\
head: {{vertexSet[head][0]['name']}}, tail: {{vertexSet[tail][0]['name']}},\
\ relation: {{relation}}\n{% endfor %}\n|||\n{% for sent in sents -%}\n{{ sent\
\ | join(\" \") }}\n{%- endfor -%} \n{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: relation-to-text
reference: ''
7458c4ed-b527-4ad5-8a04-7c87d887d5e6: !Template
answer_choices: null
id: 7458c4ed-b527-4ad5-8a04-7c87d887d5e6
jinja: "Given the following entities and their types, make a creative text. The\
\ types are PER (Person), LOC (Location), ORG (Organization), TIME (Time), NUM\
\ (Number), and MISC (Miscellaneous).\n\n{%- set names = [] -%}\n{%- set types\
\ = [] -%}\n{% for ners in vertexSet %}\n{% for ner in ners if ner['name'] not\
\ in names %}\n{{ names.append(ner['name']) | default(\"\", True) }} \n{{ types.append(ner['type'])\
\ | default(\"\", True) }} \n{% endfor %}\n{% endfor %}\n{% for name, type in\
\ zip(names, types) %}\n{{name}}{{\": \"}}{{type}}\n{% endfor %}\n|||\n{% for\
\ sent in sents -%}\n{{ sent | join(\" \") }}\n{%- endfor -%} "
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: ner-to-text
reference: ''
7f6bb96c-3661-4369-8d75-6eca07f15e6d: !Template
answer_choices: null
id: 7f6bb96c-3661-4369-8d75-6eca07f15e6d
jinja: "{%- set times = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner in\
\ ners if ner['type'] == 'TIME' -%}\n{{times.append(ner['name']) | default(\"\
\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if times %}\nFind all of the\
\ times in the text below. \n\n{% for sent in sents -%}\n{{ sent | join(\" \"\
) }}\n{%- endfor -%} \n|||\n{{ times| unique | join(\", \")}}{{\".\"}}\n{% endif\
\ %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: find-all-times
reference: ''
9ca601e9-bf97-4fba-90c9-ca502247d034: !Template
answer_choices: null
id: 9ca601e9-bf97-4fba-90c9-ca502247d034
jinja: "{%- set people = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner in\
\ ners if ner['type'] == 'PER' -%}\n{{people.append(ner['name']) | default(\"\
\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if people %}\nFind all of the\
\ people in the text below. \n\n{% for sent in sents -%}\n{{ sent | join(\"\
\ \") }}\n{%- endfor -%} \n|||\n{{ people| unique | join(\", \")}}{{\".\"}}\n\
{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: find-all-people
reference: ''
9effc9d0-bf50-4dbb-9813-02a021e8da33: !Template
answer_choices: null
id: 9effc9d0-bf50-4dbb-9813-02a021e8da33
jinja: "{% if labels['relation_text'] %}\n\nRead the following text and answer\
\ the questions.\n\nText:\n{%- for sent in sents -%}\n{{ sent | join(\" \")\
\ }}\n{%- endfor -%} \n\nQuestion: Find the named entities above and their relationships.\n\
\n{{\"For example, \"}}\n\n{% for head, tail, relation in zip(labels['head'][:1],\
\ labels['tail'][:1], labels['relation_text'][:1]) -%}\nhead: {{vertexSet[head][0]['name']}},\
\ tail: {{vertexSet[tail][0]['name']}}, relation: {{relation}}\n{%- endfor -%}\n\
{{\".\"}}\n|||\n{% for head, tail, relation in zip(labels['head'][1:], labels['tail'][1:],\
\ labels['relation_text'][1:]) %}\nhead: {{vertexSet[head][0]['name']}}, tail:\
\ {{vertexSet[tail][0]['name']}}, relation: {{relation}}\n{% endfor %}\n{% endif\
\ %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: true
name: relation
reference: ''
a31dc527-a5b9-4411-a600-ea2bbe22a9d3: !Template
answer_choices: null
id: a31dc527-a5b9-4411-a600-ea2bbe22a9d3
jinja: "{%- set numbers = [] -%} \n{%- for ners in vertexSet -%}\n{%- for ner\
\ in ners if ner['type'] == 'NUM' -%}\n{{numbers.append(ner['name']) | default(\"\
\", True)}}\n{%- endfor -%}\n{%- endfor -%}\n{% if numbers %}\nFind all of the\
\ numbers in the text below. Please do not include years.\n\n{% for sent in\
\ sents -%}\n{{ sent | join(\" \") }}\n{%- endfor -%} \n|||\n{{ numbers| unique\
\ | join(\", \")}}{{\".\"}}\n{% endif %}"
metadata: !TemplateMetadata
choices_in_prompt: null
metrics: []
original_task: false
name: find-all-numbers
reference: ''