srl

srl

Semantic Role Labeling (SRL) is one shallow semantic parsing that produces predicate-argument structures which are semantic roles (or participants) such as agent, patient, and theme associated with verbs.

Inputs to SRL are tokenized sentences:

import hanlp

srl = hanlp.load(hanlp.pretrained.srl.CPB3_SRL_ELECTRA_SMALL)
srl(['男孩', '希望', '女孩', '相信', '他', '。'])
[[('男孩', 'ARG0', 0, 1), ('希望', 'PRED', 1, 2), ('女孩相信他', 'ARG1', 2, 5)],
 [('女孩', 'ARG0', 2, 3), ('相信', 'PRED', 3, 4), ('他', 'ARG1', 4, 5)]]

All the pre-trained labelers and their details are listed below.

hanlp.pretrained.srl.CPB3_SRL_ELECTRA_SMALL = 'https://file.hankcs.com/hanlp/srl/cpb3_electra_small_crf_has_transform_20220218_135910.zip'

Electra small model (Clark et al. 2020) trained on CPB3. P=75.87% R=76.24% F1=76.05%.