Word Sense Disambiguation¶
Word Sense Disambiguation related modeling class
-
class
pororo.tasks.word_sense_disambiguation.
PororoWsdFactory
(task: str, lang: str, model: Optional[str])[source]¶ Bases:
pororo.tasks.utils.base.PororoFactoryBase
Conduct Word Sense Disambiguation
- Korean (transformer.large.ko.wsd)
dataset: https://corpus.korean.go.kr/ 어휘 의미 분석 말뭉치
metric: TBU
- Parameters
text (str) – sentence to be inputted
- Returns
list of token and its disambiguated meaning tuple
- Return type
Examples
>>> wsd = Pororo(task="wsd", lang="ko") >>> wsd("머리에 이가 있나봐.") [detail(morph='머리', pos='NNG', sense_id='01', original=None, meaning='사람이나 동물의 목 위의 부분', english='head'), detail(morph='에', pos='JKB', sense_id=None, original=None, meaning=None, english=None), detail(morph='▁', pos='SPACE', sense_id=None, original=None, meaning=None, english=None), detail(morph='이', pos='NNG', sense_id='01', original=None, meaning='이목의 곤충을 통틀어 이르는 말', english='louse'), detail(morph='가', pos='JKS', sense_id=None, original=None, meaning=None, english=None), detail(morph='▁', pos='SPACE', sense_id=None, original=None, meaning=None, english=None), detail(morph='있', pos='VA', sense_id='01', original=None, meaning='사람이나 동물이 어느 곳에서 떠나거나 벗어나지 아니하고 머물다', english='be; stay'), detail(morph='나', pos='EC', sense_id=None, original=None, meaning=None, english=None), detail(morph='보', pos='VX', sense_id=None, original=None, meaning=None, english=None), detail(morph='아', pos='EF', sense_id=None, original=None, meaning=None, english=None), detail(morph='.', pos='SF', sense_id=None, original=None, meaning=None, english=None)]
-
class
pororo.tasks.word_sense_disambiguation.
PororoTransformerWsd
(model, morph2idx, tag2idx, query2origin, query2meaning, query2eng, config)[source]¶ Bases:
pororo.tasks.utils.base.PororoTaskGenerationBase