Semantic Role Labeling

Semantic Role Labeling related modeling class

class pororo.tasks.semantic_role_labeling.PororoSrlFactory(task: str, lang: str, model: Optional[str])[source]

Bases: pororo.tasks.utils.base.PororoFactoryBase

Conduct semantic role labeling

Korean (charbert.base.ko.srl)

Parameters

sent – (str) sentence to be parsed dependency

Returns

token index, token label, token head and its relation

Return type

List[Tuple[int, str, int, str]]

Examples

>>> srl = Pororo(task="srl", lang="ko")
>>> srl("카터는 역삼에서 카카오브레인으로 출근한다.")
[[('카터는', 'AGT'), ('역삼에서', 'LOC'), ('카카오브레인으로', 'GOL'), ('출근한다.', 'PREDICATE')]]
>>> srl("피고인은 거제에서 400만 원 상당의 순금목걸이를 피해자로부터 강취하였다.")
[[('피고인은', 'AGT'), ('거제에서', '-'), ('400만', '-'), ('원', '-'), ('상당의', '-'), ('순금목걸이를', 'THM'), ('피해자로부터', 'SRC'), ('강취하였다.', 'PREDICATE')]]
static get_available_langs()[source]
static get_available_models()[source]
load(device: str)[source]

Load user-selected task-specific model

Parameters

device (str) – device information

Returns

User-selected task-specific model

Return type

object

class pororo.tasks.semantic_role_labeling.PororoBertSRL(model, tagger, config)[source]

Bases: pororo.tasks.utils.base.PororoSimpleBase

predict(sent: str, **kwargs)[source]

Conduct semantic role labeling

Parameters

sent – (str) sentence to be parsed dependency

Returns

token index, token label, token head and its relation

Return type

List[Tuple[int, str, int, str]]