IEPrompt
IEPrompt
is the class for information extraction prompt. We are now supporting Named Entity Recognition (ner), Relation Extraction (re), Event Extraction (ee), Relational Triple Extraction (rte) and Data Augmentation (da) for re.
Constructor
Parameters
task
(str): The task name, should be in one of ["ner", "re", "ee", "rte", "da"].
Example
build_index
In the Named Entity Recognition (ner) task,
prompt
parameter is the prediction text;domain
is the domain of the prediction text, which can be empty;labels
is the entity label set, which can also be empty.In the Relation Extraction (re) task,
prompt
parameter is the text;domain
indicates the domain to which the text belongs, and it can be empty;labels
is the set of relationship type labels. If there is no custom label set, this parameter can be empty;head_entity
andtail_entity
are the head entity and tail entity of the relationship to be predicted, respectively;head_type
andtail_type
are the types of the head and tail entities to be predicted in the relationship.In the Event Extraction (ee) task,
prompt
parameter is the prediction text;domain
is the domain of the prediction text, which can also be empty.In the Relational Triple Extraction (rte) task,
prompt
parameter is the prediction text;domain
is the domain of the prediction text, which can also be empty.The specific meanings of other parameters are as follows:
language
indicates the language of the task, whereen
represents English extraction tasks, andch
represents Chinese extraction tasks;in_context
indicates whether in-context learning is used. When it is set toFalse
, only the instruction prompt model is used for information extraction, and when it is set toTrue
, in-context form is used for information extraction;instruction
parameter is used to specify the user-defined prompt instruction, and the default instruction is used when it is empty;examples
are the in-context examples used for in-context learning. The formats are defined as follows:ner re ee
re da
Examples
(Please see Deepke llm for more details)
Last updated