ver Dec18th
Browse filesupdated WikiHow task set with new subsets
- README.md +6 -10
- instruction_rewriting/annotations/merged_doccano.json +82 -0
- instruction_rewriting/annotations/pattern-question.txt +8 -0
- instruction_rewriting/instruction_rewriting_wrapper.py +2 -0
- instruction_rewriting/target_handlers.py +21 -7
- wikihow-canonical.tar.xz +2 -2
- wikihow-extended.tar.xz +0 -3
- wikihow-microcanon.tar.xz +2 -2
README.md
CHANGED
|
@@ -16,16 +16,12 @@ task set, 107,448 pages are crawled, and the dumped website data occupy about
|
|
| 16 |
88 GiB totally.
|
| 17 |
|
| 18 |
Several task definition templates are designed according to the functions of
|
| 19 |
-
WikiHow app and
|
| 20 |
-
|
| 21 |
-
(`wikihow-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
(`wikihow-canonical.tar.xz`). Owing to the limit of the budgets, only 70 tasks
|
| 26 |
-
are tested using the proposed LLM-based agent in the corresponding pager.
|
| 27 |
-
These 70 tasks are given in `wikihow-microcanon.tar.xz`. We call it the
|
| 28 |
-
*canonical subset* or the *micro canonical set*.
|
| 29 |
|
| 30 |
### Website Data Replay
|
| 31 |
|
|
|
|
| 16 |
88 GiB totally.
|
| 17 |
|
| 18 |
Several task definition templates are designed according to the functions of
|
| 19 |
+
WikiHow app and task definitions are instantiated through the template toolkit
|
| 20 |
+
in Mobile-Env. 577 tasks are sampled from the extended set, which is named the
|
| 21 |
+
*canonical set* (`wikihow-canonical.tar.xz`). Owing to the limit of the
|
| 22 |
+
budgets, only 150 tasks are tested using the proposed LLM-based agent. These
|
| 23 |
+
150 tasks are given in `wikihow-microcanon.tar.xz`. We call it the *canonical
|
| 24 |
+
subset* or the *micro canonical set*.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
### Website Data Replay
|
| 27 |
|
instruction_rewriting/annotations/merged_doccano.json
CHANGED
|
@@ -2310,5 +2310,87 @@
|
|
| 2310 |
"Open the article \"Buy Stocks (for Beginners)\".",
|
| 2311 |
"The target article is \"Buy Stocks (for Beginners)\"."
|
| 2312 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2313 |
}
|
| 2314 |
]
|
|
|
|
| 2310 |
"Open the article \"Buy Stocks (for Beginners)\".",
|
| 2311 |
"The target article is \"Buy Stocks (for Beginners)\"."
|
| 2312 |
]
|
| 2313 |
+
},
|
| 2314 |
+
{
|
| 2315 |
+
"id": 1302,
|
| 2316 |
+
"text": "Read the article and summarize the needed ingredients.",
|
| 2317 |
+
"task": "constant",
|
| 2318 |
+
"index": "0",
|
| 2319 |
+
"label": [
|
| 2320 |
+
"Read the article and give a summary of the needed ingredients.",
|
| 2321 |
+
"Give a summary of the needed ingredients according to the article.",
|
| 2322 |
+
"After reading the article, list the necessary ingredients.",
|
| 2323 |
+
"Read through the article and encapsulate the needed ingredients.",
|
| 2324 |
+
"Upon reading the article, note down the essential ingredients."
|
| 2325 |
+
]
|
| 2326 |
+
},
|
| 2327 |
+
{
|
| 2328 |
+
"id": 1303,
|
| 2329 |
+
"text": "Read the article and summarize the needed items for the task.",
|
| 2330 |
+
"task": "constant",
|
| 2331 |
+
"index": "0",
|
| 2332 |
+
"label": [
|
| 2333 |
+
"Read the article and give a summary of the needed items.",
|
| 2334 |
+
"Give a summary of the needed items according to the article.",
|
| 2335 |
+
"After reading the article, list all the matierials required for this job.",
|
| 2336 |
+
"Read through the article and encapsulate the needed items.",
|
| 2337 |
+
"Upon reading the article, note down the necessary matierials."
|
| 2338 |
+
]
|
| 2339 |
+
},
|
| 2340 |
+
{
|
| 2341 |
+
"id": 1304,
|
| 2342 |
+
"text": "Read the article and give a summary of each steps.",
|
| 2343 |
+
"task": "constant",
|
| 2344 |
+
"index": "0",
|
| 2345 |
+
"label": [
|
| 2346 |
+
"Read the article and summarize each steps.",
|
| 2347 |
+
"Give a summary of each steps according to the article.",
|
| 2348 |
+
"After reading the article, summarize each steps.",
|
| 2349 |
+
"Read through the article and provide a concise overview of every step.",
|
| 2350 |
+
"Upon reading the article, summarize the steps one by one.",
|
| 2351 |
+
"Following your reading of the article, summarize the steps outlined within it."
|
| 2352 |
+
]
|
| 2353 |
+
},
|
| 2354 |
+
{
|
| 2355 |
+
"id": 1305,
|
| 2356 |
+
"text": "The summary should be given in an unnumbered list.",
|
| 2357 |
+
"task": "constant",
|
| 2358 |
+
"index": "0",
|
| 2359 |
+
"label": [
|
| 2360 |
+
"Please summarize in the form of an unnumbered list.",
|
| 2361 |
+
"It is best to present the summary as an unnumbered list.",
|
| 2362 |
+
"Present the summary in a list format without numbering.",
|
| 2363 |
+
"Depict your summary in the form of a bullet list.",
|
| 2364 |
+
"An unnumbered list should be used to present the summary.",
|
| 2365 |
+
"Create a bullet list to provide the summary.",
|
| 2366 |
+
"Present the summary by listing it without numerical order.",
|
| 2367 |
+
"Use a list format without numbering to present the summary."
|
| 2368 |
+
]
|
| 2369 |
+
},
|
| 2370 |
+
{
|
| 2371 |
+
"id": 1306,
|
| 2372 |
+
"text": "The summary should be given in a numbered list.",
|
| 2373 |
+
"task": "constant",
|
| 2374 |
+
"index": "0",
|
| 2375 |
+
"label": [
|
| 2376 |
+
"Please summarize in the form of a numbered list.",
|
| 2377 |
+
"It is best to present the summary as a numbered list.",
|
| 2378 |
+
"Present the summary in a list format with numbers.",
|
| 2379 |
+
"A numbered list should be used to present the summary.",
|
| 2380 |
+
"Create a numbered list to provide the summary.",
|
| 2381 |
+
"Present the summary by listing it in numerical order.",
|
| 2382 |
+
"Use a list format with numbers to present the summary."
|
| 2383 |
+
]
|
| 2384 |
+
},
|
| 2385 |
+
{
|
| 2386 |
+
"id": 1307,
|
| 2387 |
+
"text": "Read the article and answer the question concisely.",
|
| 2388 |
+
"task": "constant",
|
| 2389 |
+
"index": "0",
|
| 2390 |
+
"label": [
|
| 2391 |
+
"Read the article and offer a concise answer for my question.",
|
| 2392 |
+
"Read the article, then succinctly respond to the question.",
|
| 2393 |
+
"After reading the article, answer the question concisely"
|
| 2394 |
+
]
|
| 2395 |
}
|
| 2396 |
]
|
instruction_rewriting/annotations/pattern-question.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
My question is: {<title>...}?
|
| 2 |
+
Answer my question: {<title>...}?
|
| 3 |
+
The question I wonder is: {<title>...}(?/.)
|
| 4 |
+
What I (wonder/want to (know/ask)) is: {<title>...}(?/.)
|
| 5 |
+
I (wonder/want to (know/ask)): {<title>...}(?/.)
|
| 6 |
+
(Tell/Answer) me: {<title>...}?
|
| 7 |
+
(Give/Offer) (me the answer/the answer to me): {<title>...}.
|
| 8 |
+
Provide me with the answer: {<title>...}.
|
instruction_rewriting/instruction_rewriting_wrapper.py
CHANGED
|
@@ -22,6 +22,7 @@ class InstructionRewritingWrapper(base_wrapper.BaseWrapper):
|
|
| 22 |
, article_command_pattern_file: str
|
| 23 |
, categ_pattern_file: str
|
| 24 |
, author_pattern_file: str
|
|
|
|
| 25 |
, doccano_file: str
|
| 26 |
):
|
| 27 |
# method __init__ {{{ #
|
|
@@ -35,6 +36,7 @@ class InstructionRewritingWrapper(base_wrapper.BaseWrapper):
|
|
| 35 |
, article_command_pattern_file
|
| 36 |
, categ_pattern_file
|
| 37 |
, author_pattern_file
|
|
|
|
| 38 |
, doccano_file
|
| 39 |
, rng
|
| 40 |
)
|
|
|
|
| 22 |
, article_command_pattern_file: str
|
| 23 |
, categ_pattern_file: str
|
| 24 |
, author_pattern_file: str
|
| 25 |
+
, question_pattern_file: str
|
| 26 |
, doccano_file: str
|
| 27 |
):
|
| 28 |
# method __init__ {{{ #
|
|
|
|
| 36 |
, article_command_pattern_file
|
| 37 |
, categ_pattern_file
|
| 38 |
, author_pattern_file
|
| 39 |
+
, question_pattern_file
|
| 40 |
, doccano_file
|
| 41 |
, rng
|
| 42 |
)
|
instruction_rewriting/target_handlers.py
CHANGED
|
@@ -192,19 +192,22 @@ class TransformerSet:
|
|
| 192 |
, article_command_pattern_file: str
|
| 193 |
, categ_pattern_file: str
|
| 194 |
, author_pattern_file: str
|
|
|
|
| 195 |
, doccano_file: str
|
| 196 |
, rng: np.random.Generator
|
| 197 |
):
|
| 198 |
# method __init__ {{{ #
|
| 199 |
"""
|
| 200 |
Args:
|
| 201 |
-
search_pattern_file:
|
| 202 |
-
article_pattern_file:
|
| 203 |
-
article_command_pattern_file:
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
| 208 |
"""
|
| 209 |
|
| 210 |
self._search_template_lib: List[sentence_pattern.Item]
|
|
@@ -212,6 +215,7 @@ class TransformerSet:
|
|
| 212 |
self._article_command_template_lib: List[sentence_pattern.Item]
|
| 213 |
self._categ_template_lib: List[sentence_pattern.Item]
|
| 214 |
self._author_template_lib: List[sentence_pattern.Item]
|
|
|
|
| 215 |
|
| 216 |
self._search_template_regex: List[Pattern[str]]
|
| 217 |
#self._article_template_regex: List[Pattern[str]]
|
|
@@ -225,6 +229,7 @@ class TransformerSet:
|
|
| 225 |
self._article_command_template_lib, _ = parse_file(article_command_pattern_file)
|
| 226 |
self._categ_template_lib, _ = parse_file(categ_pattern_file)
|
| 227 |
self._author_template_lib, _ = parse_file(author_pattern_file)
|
|
|
|
| 228 |
|
| 229 |
self._annotation_dict: Dict[str, List[str]] = {}
|
| 230 |
with open(doccano_file) as f:
|
|
@@ -260,6 +265,8 @@ class TransformerSet:
|
|
| 260 |
transformed = self._transform_categ(sentence)
|
| 261 |
elif sentence.startswith("Check the author"):
|
| 262 |
transformed = self._transform_author(sentence)
|
|
|
|
|
|
|
| 263 |
|
| 264 |
elif sentence in self._annotation_dict:
|
| 265 |
candidates = self._annotation_dict[sentence]
|
|
@@ -299,6 +306,8 @@ class TransformerSet:
|
|
| 299 |
if template is None:
|
| 300 |
return sentence
|
| 301 |
|
|
|
|
|
|
|
| 302 |
target_pattern = template.get_targets()
|
| 303 |
if not match_target(target_pattern[0], target_str):
|
| 304 |
return sentence
|
|
@@ -338,6 +347,11 @@ class TransformerSet:
|
|
| 338 |
and sentence.endswith(".")
|
| 339 |
target_str = sentence[25:-1]
|
| 340 |
return self._apply_new_template(target_str, self._author_template_lib)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
|
| 342 |
def _apply_new_template( self
|
| 343 |
, target_str: str
|
|
|
|
| 192 |
, article_command_pattern_file: str
|
| 193 |
, categ_pattern_file: str
|
| 194 |
, author_pattern_file: str
|
| 195 |
+
, question_pattern_file: str
|
| 196 |
, doccano_file: str
|
| 197 |
, rng: np.random.Generator
|
| 198 |
):
|
| 199 |
# method __init__ {{{ #
|
| 200 |
"""
|
| 201 |
Args:
|
| 202 |
+
search_pattern_file (str): pattern file for search instructions
|
| 203 |
+
article_pattern_file (str): pattern file for article instructions
|
| 204 |
+
article_command_pattern_file (str): pattern file for article
|
| 205 |
+
instructions in "command" field
|
| 206 |
+
categ_pattern_file (str): pattern file for category instructions
|
| 207 |
+
author_pattern_file (str): pattern file for author instructions
|
| 208 |
+
question_pattern_file (str): pattern file for WikiHowNFQA questions
|
| 209 |
+
doccano_file (str): the path to the json file exported by doccano
|
| 210 |
+
rng (np.random.Generator): used to generate random indices
|
| 211 |
"""
|
| 212 |
|
| 213 |
self._search_template_lib: List[sentence_pattern.Item]
|
|
|
|
| 215 |
self._article_command_template_lib: List[sentence_pattern.Item]
|
| 216 |
self._categ_template_lib: List[sentence_pattern.Item]
|
| 217 |
self._author_template_lib: List[sentence_pattern.Item]
|
| 218 |
+
self._question_template_lib: List[sentence_pattern.Item]
|
| 219 |
|
| 220 |
self._search_template_regex: List[Pattern[str]]
|
| 221 |
#self._article_template_regex: List[Pattern[str]]
|
|
|
|
| 229 |
self._article_command_template_lib, _ = parse_file(article_command_pattern_file)
|
| 230 |
self._categ_template_lib, _ = parse_file(categ_pattern_file)
|
| 231 |
self._author_template_lib, _ = parse_file(author_pattern_file)
|
| 232 |
+
self._question_template_lib, _ = parse_file(question_pattern_file)
|
| 233 |
|
| 234 |
self._annotation_dict: Dict[str, List[str]] = {}
|
| 235 |
with open(doccano_file) as f:
|
|
|
|
| 265 |
transformed = self._transform_categ(sentence)
|
| 266 |
elif sentence.startswith("Check the author"):
|
| 267 |
transformed = self._transform_author(sentence)
|
| 268 |
+
elif sentence.startswith("My question is"):
|
| 269 |
+
transformed: str = self._transform_question(sentence)
|
| 270 |
|
| 271 |
elif sentence in self._annotation_dict:
|
| 272 |
candidates = self._annotation_dict[sentence]
|
|
|
|
| 306 |
if template is None:
|
| 307 |
return sentence
|
| 308 |
|
| 309 |
+
# if the template seems to match the sentence according to the regex,
|
| 310 |
+
# but the target isn't consistent, we should ignore it.
|
| 311 |
target_pattern = template.get_targets()
|
| 312 |
if not match_target(target_pattern[0], target_str):
|
| 313 |
return sentence
|
|
|
|
| 347 |
and sentence.endswith(".")
|
| 348 |
target_str = sentence[25:-1]
|
| 349 |
return self._apply_new_template(target_str, self._author_template_lib)
|
| 350 |
+
def _transform_question(self, sentence: str) -> str:
|
| 351 |
+
assert sentence.startswith("My question is: ")\
|
| 352 |
+
and sentence.endswith("?")
|
| 353 |
+
target_str: str = sentence[16:-1]
|
| 354 |
+
return self._apply_new_template(target_str, self._question_template_lib)
|
| 355 |
|
| 356 |
def _apply_new_template( self
|
| 357 |
, target_str: str
|
wikihow-canonical.tar.xz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e00499008ec1043ecdf8d3d33c5fac6ad5faee4ca5a9fc0676011fc065dcdee7
|
| 3 |
+
size 123828
|
wikihow-extended.tar.xz
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:df7650423ada1a94689f0b30d0d11a186da5749dff5167924716bf109c16ef3c
|
| 3 |
-
size 946740
|
|
|
|
|
|
|
|
|
|
|
|
wikihow-microcanon.tar.xz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a94694a43657122d19a9acb8e426c28b7de6dc52e255a69562b194d3a0fe806
|
| 3 |
+
size 14484
|