get_obj_structure_8.txt 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. # -*- coding: utf-8 -*-
  2. """
  3. 针对单项填空、完形填空、阅读理解三种题目结构化,主要思路:
  4. 1.对每行打标签,这一步打标签只打非常确定的标签,不太确定的就暂打标签N:
  5. A:A选项 B:B选项 C:C选项 D:D选项 @:题干 N:其他(一般完型阅读的短文,还有其他非确定的都暂打标签为N)
  6. 2.这种打标签的方式需要把A.XXX B.XXXX C.XXX D.XXX四个选项两行分布或者四行分布的拆分成4行,这样更方便前后推理
  7. 3.推理修正标签:
  8. (1)对于ABND-->ABCD,对于ANBCD-->AABCD
  9. (2)对于完型和阅读,前面一定是短文,标签一定是:
  10. 阅读理解:NNNNN@ABCD@@ABCD...
  11. 完形填空:NNNNABCDABCDABCD...
  12. 如果出现NNANNNABCD--->修正为:NNNNNNABCD
  13. 4.每行的标签修正好了以后,再直接结构化提取就好了,思路是:
  14. (1)先把短文提取出来
  15. (2)后面的选项分组,一个小题一组,然后组内结构化
  16. 5.对于题号做的处理:
  17. (1)如果最大的序号60在topic_no列表里,且59,58都在topic_no列表里,认为最大序号是正确可靠序号,题目序号用最大序号+slave个数共同生成
  18. (2)同理,如果最小的序号21在topic_no列表里,且22,23都在topic_no列表里,认为最小序号是正确可靠序号,题目序号用最小序号+slave个数共同生成
  19. (3)如果最大最小序号都不可靠,就使用最长连续序列题号+slave个数去推理生成整个题号序列:max_len_series
  20. """
  21. import re
  22. from pprint import pprint
  23. from util import max_len_series
  24. def error_B_find_and_rep(con_list):
  25. """
  26. 在list中,通过多行连续性,发现A (8|3|13|l3) C D,这样的连续序列,然后将 其替换为B
  27. 原地修改,不用返回值,使用的时候也不需要赋值
  28. :param con_list:
  29. :return:
  30. """
  31. for i in range(1, len(con_list) - 2):
  32. is_b = re.match(r"([^\d]{0,3}(8|13|3)[,.。、])", con_list[i].replace("(", "").replace(")", ""))
  33. if is_b:
  34. is_a = re.match(r".{0,3}A[,.。、]", con_list[i - 1].replace("(", "").replace(")", ""))
  35. is_c = re.match(r".{0,3}[CcG][,.。、]", con_list[i + 1].replace("(", "").replace(")", ""))
  36. is_d = re.match(r".{0,3}D[,.。、]", con_list[i + 2].replace("(", "").replace(")", ""))
  37. is_cd = re.match(r".{0,3}[CcG][,.。、].*?D[,.。、].+?",
  38. con_list[i + 1].replace("(", "").replace(")", "")) # CD可能在同一行
  39. if is_a and is_c and (is_d or is_cd):
  40. con_list[i] = is_b.group(1).replace(is_b.group(2), "B") + con_list[i][is_b.end():]
  41. def infer_abcd_cloze(opt_label_str,is_oneline=False):
  42. """
  43. 根据下文来推理前面一个不确定的选项
  44. :param label_str:
  45. :return:
  46. """
  47. count = 0
  48. while re.search(r"N[B-D]", opt_label_str) and count < len(opt_label_str):
  49. opt_label_str = opt_label_str.replace("NAA", "DAA") \
  50. .replace("NB", "AB") \
  51. .replace("NC", "BC") \
  52. .replace("ND", "CD")
  53. count += 1
  54. opt_label_str = re.sub(r"([^N])NA", "\1\1A", opt_label_str)
  55. count2 = 0
  56. if is_oneline: #同一行根据前面往后推
  57. while re.search(r"[A-C]N", opt_label_str) and count2 < len(opt_label_str):
  58. opt_label_str = opt_label_str.replace("AN", "AB"). \
  59. replace("BN", "BC"). \
  60. replace("CN", "CD")
  61. count2 += 1
  62. else:
  63. if opt_label_str.endswith("N"):
  64. opt_label_str = opt_label_str[:-1] + "D"
  65. return opt_label_str
  66. def infer_abcd_rs(opt_label_str,is_oneline=False):
  67. """
  68. 阅读和单选,标签序列和完型不一样,@ABCD,所以推理有点不一样,就分开写了
  69. """
  70. count = 0
  71. while re.search(r"N[A-D]|([A-D])N@|@N+@", opt_label_str) and count < len(opt_label_str):
  72. opt_label_str = opt_label_str.replace("NA", "@A") \
  73. .replace("NB", "AB") \
  74. .replace("NC", "BC") \
  75. .replace("ND", "CD")
  76. opt_label_str = re.sub(r"([A-D])N@", r"\1\1@", opt_label_str)
  77. count += 1
  78. if is_oneline: #同一行根据前面往后推
  79. count2 = 0
  80. while re.search(r"[A-C]N", opt_label_str) and count2 < len(opt_label_str):
  81. opt_label_str = opt_label_str.replace("AN", "AB").replace("BN", "BC").replace("CN", "CD")
  82. count2 += 1
  83. else: #基于整个序列替换
  84. def rub_mode_2(m):
  85. return "@" * len(m.group(0))
  86. opt_label_str = re.sub(r"@([N]+)[@A]", rub_mode_2, opt_label_str) # 两个题干之间的都为N,那就把中间都当作题干
  87. ######经过上面替换,N[A-D]肯定都没了,但会存在N$的情况
  88. if opt_label_str.endswith("N"):
  89. opt_label_str = opt_label_str[:-1] + "D"
  90. #####单项选择前面第一个A前面如果存在N,就全部换成A
  91. return opt_label_str
  92. def label_abcd(one_item, ty):
  93. """
  94. 每个字符串文本,判断其标签类别,@:内容行(题干行) A,B,C,D,N(其他)
  95. """
  96. i = re.sub(r"[()]", "", one_item)[:5]
  97. if re.search(r"^[^A-D]{0,3}\d[,,。.、]", i):
  98. if ty != "完形填空":
  99. label = "@"
  100. else:
  101. label = "A"
  102. else:
  103. label = re.search(r"([A-Dc])\s*[,,.。、]", i).group(1) if re.search(r"([A-Dc])\s*[,,.。、]", i) else "N"
  104. if label=="N":
  105. #但有[A-D]\s[A-Z]
  106. label = re.search(r"([A-D])\s+[A-Z]", i).group(1) if re.search(r"([A-D])\s+[A-Z]", i) else "N"
  107. return label.upper()
  108. def essay_label_correct(all_label_str):
  109. """
  110. 只有阅读和完型使用这个,label_str这个题所有行的label序列
  111. """
  112. def rub_mode_1(m):
  113. return "N" * len(m.group(1))
  114. count = 0
  115. while re.search(r"([^N]N{4,})", all_label_str[:10]) and count < 10: # 对于完形填空,前10行大胆这样替换
  116. # 确定短文,把短文中的N先整理好,方便后面按照N块取essay
  117. all_label_str = re.sub(r"([^N]N{4,})", rub_mode_1, all_label_str[:10]) + all_label_str[10:]
  118. count += 1
  119. all_label_str = re.sub(r"(N{4,}[^N]N{3,})", rub_mode_1, all_label_str) # 10行以后还有漏网之鱼
  120. return all_label_str
  121. def sub_item_group(label, con, ty):
  122. """
  123. 注意:只对ABCD选项按小题分组,所以完型和阅读输进来的items_all是去掉esssy以后的序列
  124. items_all:[("A","see"),("B":"later"),("C","right"),("D":"part")]
  125. ty: 只能是 单项填空,完形填空,阅读理解 三个题型,其中,完型的选项只有ABCD,阅读和单选多了一个@标签
  126. """
  127. slave = []
  128. flag = "0"
  129. one_item = {"A": "", "B": "", "C": "", "D": "", "topic_no": "0", "answer": ""}
  130. if ty in ["阅读理解", "单项填空"]:
  131. one_item["content"] = ""
  132. topic_no = []
  133. label_list = list(label)
  134. label_list.append("0")
  135. con.append("END_MARK")
  136. for abcd, con in zip(label_list, con):
  137. if abcd > flag and abcd != "N":
  138. one_item[abcd.replace("@", "content")] = con # 拿到内容
  139. flag = abcd
  140. elif abcd == flag:
  141. one_item[flag.replace("@", "content")] = (one_item[flag.replace("@", "content")] + " " + con)
  142. else:
  143. tn = 0
  144. for k, v in one_item.items():
  145. if k == "content":
  146. tn = re.search(r"(\d+)", v).group(1) if re.search(r"(\d+)", v) else 0
  147. one_item["topic_no"] = str(tn)
  148. one_item["content"] = re.sub(r"[^a-zA-Z]", "", v[:8].replace(str(tn), "")) + v[8:]
  149. elif re.match(r"[A-D]", k): # 选项内容,把A.xxxx前面的A.去掉
  150. if k == "A" and ty == "完形填空": #完型的题号和A选项在同一行
  151. tn = re.search("(\d+)", v[:5]).group(1) if re.search("(\d+)", v[:5]) else 0
  152. v = re.sub(str(tn) + "[,,。.]", "", v)
  153. v = re.sub(r".*?[,,。.]", "", v, count=1).strip()
  154. one_item[k] = v
  155. if len([one_item[i] for i in ['A', 'B', 'C', 'D'] if one_item[i] != ""]) > 0: # 一个选选项都没有,就不要添加了
  156. topic_no.append(int(tn))
  157. slave.append(one_item)
  158. one_item = {"A": "", "B": "", "C": "", "D": "", "topic_no": "0", "answer": ""}
  159. if ty in ["阅读理解", "单项填空"]:
  160. one_item["content"] = ""
  161. one_item[abcd.replace("@","content")] = con # 拿到内容
  162. flag = abcd
  163. return slave, topic_no #是int
  164. def single_filling_structure(con_list):
  165. ty = "单项填空"
  166. con_list = [i for i in con_list if len(re.findall(r"[a-zA-Z0-9]", i)) > 0 and \
  167. len(re.findall(r"[\u4e00-\u9fa5]",i))<5] # 没有英文字母的行去掉
  168. items_all = []
  169. error_B_find_and_rep(con_list)
  170. for k, line in enumerate(con_list):
  171. one_line_label = ""
  172. line = re.sub(r"([B-D][,。.,、])", r" \1", line)
  173. one_line_con = [i for i in re.split(r"\s{3,}",line) if len(i.replace(" ",""))>=4] #即要求A、as至少4各字符,因为可能又噪声被分出来了A. Open up to othrs.D.oB. Depend on cach other.
  174. for i in (one_line_con):
  175. i = re.sub(r"[()]","",i)[:5]
  176. one_line_label += label_abcd(i, ty)
  177. if len(one_line_label)>1:
  178. one_line_label = infer_abcd_rs(one_line_label,is_oneline=True)
  179. one_line_label = list(one_line_label)
  180. # 保证每一行内部排序是按照ABCD这样的顺序,因为确实遇到过一行,OCR识别出来CD在前面
  181. h = sorted(zip(one_line_label, one_line_con), key=lambda x: x[0])
  182. items_all.extend(h)
  183. label_all = [i[0] for i in items_all]
  184. con_all = [i[1] for i in items_all]
  185. label_str = "".join(label_all)
  186. label_str = essay_label_correct(label_str)
  187. def sub_start_A(m):
  188. return "A" * len(m.group(0))
  189. label_str = re.sub(r"(^N{1,3}A)", sub_start_A, label_str)
  190. slave, topic_no = sub_item_group(label_str, con_all, ty)
  191. topic_no = max_len_series(topic_no)
  192. for i, s in enumerate(slave):
  193. s["topic_no"] = str(topic_no[i])
  194. s["topic_type_name"] = ty
  195. s["topic_type_id"] = 1
  196. s["parse"]=""
  197. return slave
  198. def cloze_structure(con_list):
  199. ty = "完形填空"
  200. items_all = []
  201. error_B_find_and_rep(con_list)
  202. for k, line in enumerate(con_list):
  203. one_line_label = ""
  204. ######判断一下是否是选项行,是否要将BCD分开(OCR识别,选项都粘在一起了)
  205. if k > 5 and re.search(r"(?<![a-z])\d",line[5:])==None:
  206. word_n = len(re.findall(r"[a-zA-Z]+", line))
  207. opt_n = len(re.findall(r'[B-D][,。.,、]', line))
  208. if opt_n>=3 or word_n <= (opt_n+1)*3:
  209. line = re.sub(r"([B-D][,。.,、])", r" \1",line)
  210. one_item_con = [i for i in re.split("\s{3,}", line) if i != ""]
  211. for i in one_item_con: # 一行内部再分开
  212. one_line_label += label_abcd(i, ty)
  213. if len(one_line_label)>1:
  214. one_line_label = infer_abcd_cloze(one_line_label,is_oneline=True)
  215. one_line_label = list(one_line_label)
  216. # 保证每一行内部排序是按照ABCD这样的顺序,因为确实遇到过一行,OCR识别出来CD在前面
  217. h = sorted(zip(one_line_label, one_item_con),key=lambda x: x[0])
  218. items_all.extend(h)
  219. label_all = [i[0] for i in items_all]
  220. con_all = [i[1] for i in items_all]
  221. label_str = "".join(label_all)
  222. label_str = essay_label_correct(label_str)
  223. ij = re.search(r"N{5,}[^N]", label_str[3:])
  224. if ij:
  225. essay = con_all[:3 + ij.end() - 1]
  226. opt = con_all[3 + ij.end() - 1:] # 拿到阅读题干
  227. label_str = label_str[3 + ij.end() - 1:] # 题干对应标签
  228. else:
  229. ###随便取,取前3行当短文
  230. print("完形填空短文少于3行:{}".format(con_all))
  231. essay = con_all[:3]
  232. opt = con_all[3:] # 拿到阅读题干
  233. label_str = label_str[3:] # 题干对应标签
  234. ##基于整篇文章序列再推理一遍
  235. label_str = infer_abcd_cloze(label_str)
  236. slave, topic_no = sub_item_group(label_str, opt, ty)
  237. ########小题筛选
  238. count = -1
  239. while len(slave) > 20 and count < 5:
  240. count += 1
  241. if topic_no[0] in topic_no[-5:]: # 可能是把短文最后几句话中的题号当作选项了
  242. essay.append("\n".join([slave[0][i] for i in ['A', 'B', 'C', 'D'] if slave[0][i] != ""]))
  243. del slave[0]
  244. del topic_no[0]
  245. else:
  246. break
  247. topic_no = max_len_series(topic_no)
  248. for i, s in enumerate(slave):
  249. s["topic_no"] = str(topic_no[i])
  250. if len(topic_no) > 2 and topic_no[-1] - topic_no[0] + 1 == len(slave):
  251. s_topic_no = "{}-{}".format(topic_no[0], topic_no[-1])
  252. else:
  253. s_topic_no = "{}-{}".format(101, 100 + len(slave))
  254. return {'content': "\n".join(essay), 'topic_type_name': '完形填空', 'slave': slave,
  255. 'topic_type_id': 2, 'topic_no': s_topic_no}
  256. def reading_structure(con_list):
  257. ty = "阅读理解"
  258. reading_content_list = [i for i in con_list if len(re.findall(r"[a-zA-Z0-9]", i)) > 0 and \
  259. len(re.findall(r"[\u4e00-\u9fa5]",i))<8] # 没有英文字母的行去掉
  260. items_all = []
  261. error_B_find_and_rep(reading_content_list)
  262. for k, line in enumerate(reading_content_list):
  263. one_line_label = ""
  264. if k > 5 :#and re.search(r"\d",line[5:])==None:
  265. word_n = len(re.findall(r"[a-zA-Z]+", line))
  266. opt_n = len(re.findall(r'[B-D][,。.,、]', line))
  267. if word_n <= (opt_n+1)*8 and len(line) <= max(map(len,con_list[:10])):
  268. line = re.sub(r"([B-D][,。.,、])", r" \1",line)
  269. one_line_con = [i for i in re.split(r"\s{3,}",line) if len(i.replace(" ",""))>=4] #即要求A、as至少4各字符,因为可能又噪声被分出来了A. Open up to othrs.D.oB. Depend on cach other.
  270. for i in (one_line_con):
  271. i = re.sub(r"[()]","",i)[:5]
  272. one_line_label += label_abcd(i, ty)
  273. if len(one_line_label)>1:
  274. one_line_label = infer_abcd_rs(one_line_label,is_oneline=True)
  275. one_line_label = list(one_line_label)
  276. # 保证每一行内部排序是按照ABCD这样的顺序,因为确实遇到过一行,OCR识别出来CD在前面
  277. h = sorted(zip(one_line_label, one_line_con), key=lambda x: x[0])
  278. items_all.extend(h)
  279. label_all = [i[0] for i in items_all]
  280. con_all = [i[1] for i in items_all]
  281. label_str = "".join(label_all)
  282. label_str = essay_label_correct(label_str)
  283. ij = re.search(r"N{5,}[^N]", label_str)
  284. if ij:
  285. essay = con_all[:ij.end() - 1]
  286. opt = con_all[ij.end() - 1:] # 拿到阅读题干
  287. label_str = label_str[ij.end() - 1:] # 题干对应标签
  288. else:
  289. ###随便取,取前3行当短文
  290. print("阅读理解短文少于3行:{}".format(con_all))
  291. essay = con_all[:3]
  292. opt = con_all[3:] # 拿到阅读题干
  293. label_str = label_str[3:] # 题干对应标签
  294. label_str = infer_abcd_rs(label_str)
  295. slave, topic_no = sub_item_group(label_str, opt, ty)
  296. try:
  297. max_id = max(topic_no)
  298. min_id = min(topic_no)
  299. num_items = len(slave)
  300. s_topic_no = "{}-{}".format(min_id, max_id)
  301. if max_id - min_id + 1 != num_items:
  302. if max_id - 1 in topic_no or max_id - 2 in topic_no: # 说明max是对的,min是错的
  303. n_min_id = max_id - num_items + 1
  304. s_topic_no = "{}-{}".format(n_min_id, max_id)
  305. slave[0]["topic_no"] = str(n_min_id) # 用新的id把原来的最小值topic_no改掉
  306. elif min_id + 1 in topic_no or min_id + 2 in topic_no: # 说明min是对的
  307. n_max_id = min_id + num_items - 1
  308. s_topic_no = "{}-{}".format(min_id, n_max_id)
  309. slave[-1]["topic_no"] = str(n_max_id)
  310. else:
  311. topic_no = max_len_series(topic_no)
  312. if len(topic_no) >= 2:
  313. s_topic_no = "{}-{}".format(topic_no[0], topic_no[-1])
  314. else:
  315. s_topic_no = "{}-{}".format(100, 100 + len(slave))
  316. print("阅读理解的题号严重有问题:{}".format(topic_no))
  317. return {'content': '\n'.join(essay), 'slave': slave, 'topic_type_id': 3,
  318. 'topic_type_name': '阅读理解', 'topic_no': s_topic_no}
  319. except:
  320. return {'content': '\n'.join(essay), 'slave': slave, 'topic_type_id': 3,
  321. 'topic_type_name': '阅读理解', 'topic_no': "{}-{}".format(100, 100 + len(slave) - 1)}
  322. if __name__ == '__main__':
  323. # con_list = [ "A ship that sank off the coast of California decades ago was recently reconstructed in remarkable detail.The 3D digital model even included hundreds\xa0of sponges(海绵动物) that have gathered on the ship's' surface in the years\xa0Since it sank\n", 'Named A merican Heritage, the boat-a supply ship that once serviced\n', "oil platforms-sank in Santa Monica Bay on May 4, 1995, and for decades\xa0\xa0its precise location(位置) was unknown. Researchers with the Monterey Bay Aquarium Research Institute (MBARI) spotted a strange shape in that area in\xa02008. But it wasn't until May 2018 that MBARI scientists identified its precise\xa0location and mapped the site in greater detail, showing what appeared to be a\xa0shipwreck(失事船只). It measured197 feet long and rested nearly2300 feet\xa0\xa0below the surface.\n", 'Even then, the identity of the shipwreck was uncertain. Yet another MBARI team revisited the location to do further exploration.They sent remotely operated\xa0vehicles (ROVs) and took photos of the damaged ship. Though it was covered\xa0with deep-sea sponges and other animals, the scientists were able to spot\xa0\xa0letters spelling out its name, confirming that the shipwreck was American\xa0Heritage.\n', 'As one of the MBARI scientists who found American Heritage, chief\n', 'ROV pilot Knute Brekke had previously worked on the ship. And he was\xa0 on duty with the diving company American Pacific Marine\n', '-the owner of\xa0American Heritage -the night the ship began taking on water and eventually\xa0sank.\n', 'MBARI spokesperson Kim Fulton-Bennett said to Live Science about the\xa0discovery, "The model is not complete, as floating ropes and poor visibility\xa0kept the pilots from getting too close to the wreck. Nevertheless, the 3D\xa0\xa0reconstruction is detailed enough to show that American Hertage is now home\xa0\xa0to potentially thousands of sponges. Shipwrecks- accidental and intentional-often transform into the shelter for diverse communities of ocean life.\n', '12.what is the main idea of the text?\n', 'A.A valuable treasure was discovered.\n', 'B.Special sponges were found under sea.\n', 'C.3D model reconstructed sunken ship.\n', 'D.A sunken ship was gotten out of water.\n', '13.which is the right order of the following events?\n', '① something strange was found in the area\n', '②ROVs were sent under sea to take photos.\n', '③A ship sank in Santa Monica Bay.\n', '④The identity of the ship was confirmed.\n', '⑤Scientists tried to locate the shipwreck\n', 'A.②③⑤④①B.③①⑤②④C.⑤③①④②D.④③①②⑤\n', '14. What can we learn about Knute Brekke?\n', 'A. He was familiar with the sunken ship.\n', 'B\xa0He was in charge of diving company.\n', 'C He was responsible for the rescue work\n', 'D\xa0\xa0He was the first one to witness the accident.\n', "15. What's Kim Fulton-Bennett's attitude towards the 3D model?\n", 'A. Critical.\n', 'B. Doubtful.\n', 'C.Amazed\n', 'D.Objective\n', '.\n', '.\n']
  324. # con_list = ['Washington, D.C. Bicycle Tours\n', 'Cherry Blossom Bike Tour in Washington, D.C.\n',
  325. # 'Duration Tour\n',
  326. # 'This small group bike tour is a fantastic way to see a world-famous cherry trees with beautiful flowers of Washington, D.C. Your guide will provide a history lesson about the trees and the famous monuments where they blossom. Reserve your spot before availability — the cherry blossoms—disappear!\n',
  327. # 'Washington Capital Monuments Bicycle Tour\n', 'Duration:3 hours (4 miles)\n',
  328. # 'Join a guided bike tour and view some of the most popular monuments in Washington, D.C. Explore the monuments and memorials on the National Mall as your guide shares unique facts and history at each stop. Guided tour includes bike, helmet, cookies and bottled water.\n',
  329. # 'Capital City Bike Tour in Washington, D.C.\n', 'Duration:3 hours\n',
  330. # 'Morning or Afternoon, this bike tour is the perfect tour for D. C. newcomers and locals looking to experience Washington, D.C. in a healthy way with minimum effort. Knowledgeable guides will entertain you with the most ,interesting stories about Presidents, Congress, memorials, and parks. Comfortable bikes and a smooth tour route(路线)make cycling between the sites fun and relaxing.zxxk\n',
  331. # 'Washington Capital Sites at Night Bicycle Tour\n', 'Duration:3 hours(7miles)\n',
  332. # 'Join a small group bike tour for an evening of exploration in the heart of Washington, D.C. Get up close to the monuments and memorials as you bike the sites of Capitol Hill and the National Mall. Frequent stops are made for photo taking as your guide offers unique facts and history. Tour includes bike, helmet, and bottled water. All riders are equipped with reflective vests and safety lights.\n',
  333. # '21.Which tour do you need to book in advance?\n',
  334. # 'A. Cherry Blossom Bike Tour in Washington, D.C.\n',
  335. # 'B. Washington Capital Monuments Bicycle Tour.\n',
  336. # 'C. Capital City Bike Tour in Washington, D.C.\n',
  337. # 'D. Washington Capital Sites at Night Bicycle Tour.\n',
  338. # '22.What will you do on the Capital City Bike Tour?\n',
  339. # 'A. Meet famous people. \xa0 \xa0B. Go to a national park.\n',
  340. # 'C. Visit well-known museums. \xa0 \xa0D. Enjoy interesting stories.\n',
  341. # '23.Which of the following does the bicycle tour at night provide?\n',
  342. # 'a. City maps. \xa0 \xa0 \xa0b. Cameras.\n', 'c. Meals. d. Safety lights.\n', 'A.b->a->a->d->c\n',
  343. # 'B.c->b->a->d\n', 'C.d->c->b->a\n', 'D.a->b->d->c\n']
  344. # con_list =
  345. # res = reading_structure(con_list)
  346. # pprint(res)
  347. con_list = ["Somebody might say, “I want to be a big fish, as big as Bill Gates, in a ",
  348. "big pool, as large as Microsoft.” However, we all know it is   __1__   for a green",
  349. "hand (生手,没经验的人,即菜鸟)in the field. Then you have to   __2__   the",
  350. "question carefully. Certainly no matter  __3__   side you choose to take, you have",
  351. "your chance to succeed. Now the problem is which can provide you more  __4__  ."
  352. "I choose to be a big fish in a small pool. A big company may provide you a ",
  353. " __5__ starting point, but a small company offers you opportunity to practice",
  354. "various   __6__  . During the   __7__  , you may  __ 8__   yourself, recognize your   __9__",
  355. "points and find your potentiality(潜力). What’s more,   __10__  so many",
  356. "limitations and rules in a small company, if you are ready competent(有能力的)",
  357. "you have   __11__   chances to climb to a higher point. Finally, being a big fish",
  358. "(although) in a small pool, gives a green hand   __12__   self-confidence which is",
  359. "quite important for   __13__  .",
  360. "__14__  , you should not be confined(限制,使局限) to your small pool, and be",
  361. "__15__   with being a big fish there. You should always dream of being a big fish",
  362. "in a big pool!",
  363. "1. A. impossible B. uninteresting C. unnecessary D. uncorrectable",
  364. "2. A. think B. recognize C. weigh D. realize",
  365. "3. what B. whether C. how D. which",
  366. "4. A. help B. chance C. advice D. money",
  367. "5. A. high B. proper C. rich D. practical",
  368. "6. A. jobs B. tools C. skills D. topics",
  369. "7. A. success B. perform C. products D. process",
  370. "8. A. increase B. improve C. impress D. encourage",
  371. "9. A. weak B. reasonable C. strong D. amazing",
  372. "10. without B. because of C. except for D. with",
  373. "11. A. less B. equal C. no D. more",
  374. "12. A. various B. serious C. precious D. previous",
  375. "13. A. future B. success C. boss D. market",
  376. "14. A. Finally B. Certainly C. Immediately D. Generally",
  377. "15. A. satisfied B. proud C. relaxed D. regretted"]
  378. res = cloze_structure(con_list)
  379. pprint(res)