Skip to content

code for paper "Event Argument Extraction with Enriched Prompts"

Notifications You must be signed in to change notification settings

cs-liangchen-work/EAEPrompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EAEPrompt

code for paper "Event Argument Extraction with Enriched Prompts"

1.运行代码

(同RAMS原始数据集建议评估方式):

nohup python3 -u code_1.py --gold_file dev.jsonlines --pred_file 1.json --ontology_file event_role_multiplicities.txt  --do_all --reuse_gold_format > r_1.txt 2>&1 &

2.代码说明

  • role-prompt:

3. 损失增强

def dice_loss(target, predictive, ep=1e-8):
    t = 0.0
    for i in range(len(target)):
        intersection = 2 * torch.sum(predictive[i] * target[i]) + ep
        union = torch.sum(predictive[i]) + torch.sum(target[i]) + ep
        t += 1 - intersection / union
    loss = t/len(target)
    return loss

loss = weight1 * (loss_func(out_1.cuda(), label_begin.cuda()) + loss_func(out_2.cuda(), label_end.cuda())) + weight2 * dice_loss(target=label.cuda(), predictive=(out_1.softmax(dim=-1).cuda()+out_2.softmax(dim=-1).cuda())/2)

4.LLM prompt

You are now an expert in event argument extraction for natural language processing tasks. Below is a news document, and your task is to extract the arguments based on the roles:

【document】

Now, you need to extract the arguments for the event type 【event_type】, where the event trigger is 【trigger】. The roles to extract include 【role1】, 【role2】, and 【role3】. Please note the following:

Some roles may not have corresponding arguments; in such cases, return null.
The extracted arguments should consist of one or more consecutive words that can be found in the news document.
The format of your output should be {}.

About

code for paper "Event Argument Extraction with Enriched Prompts"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages