(et_list, text)
| 42 | return source_list, target_list |
| 43 | |
| 44 | def et_text2tri(et_list, text): |
| 45 | source_list = [] |
| 46 | target_list = [] |
| 47 | # 遍历event |
| 48 | for event_type in et_list: |
| 49 | source_text = event_type + " </s> " + text |
| 50 | target_text = "" |
| 51 | |
| 52 | source_list.append(source_text) |
| 53 | target_list.append(target_text) |
| 54 | |
| 55 | # 在所有的target 上统一加上起始位置 |
| 56 | for i in range(len(target_list)): |
| 57 | target_list[i] = f'{type_start} ' + target_list[i] + f' {type_end}' |
| 58 | |
| 59 | return source_list, target_list |
| 60 | |
| 61 | |
| 62 | if __name__ == "__main__": |