Fill-in-the-blank

Fill-in-the-blank related modeling class

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

Bases: pororo.tasks.utils.base.PororoFactoryBase

Conduct fill-in-the-blank with one __ token

English (roberta.base.en)

  • dataset: N/A

  • metric: N/A

Korean (posbert.base.ko)

  • dataset: N/A

  • metric: N/A

Japanese (jaberta.base.ja)

  • dataset: N/A

  • metric: N/A

Chinese (zhberta.base.zh)

  • dataset: N/A

  • metric: N/A

Parameters

sent (str) – input sentence which contains one __ token

Returns

token candidates could be fitted into __ token

Return type

List[str]

Examples

>>> fib = Pororo(task="fib", lang="en")
>>> fib("David Beckham is a famous __ player.")
['football', 'soccer', 'basketball', 'baseball', 'sports']
>>> fib = Pororo(task="fib", lang="ko")
>>> fib("손흥민은 __의 축구선수이다.")
['대한민국', '잉글랜드', '독일', '스웨덴', '네덜란드', '덴마크', '미국', '웨일스', '노르웨이', '벨기에', '프랑스', '국적', '일본', '한국']
>>> fib = Pororo(task="fib", lang="ja")
>>> fib("日本の首都は__である。")
['東京', '大阪', '仙台', '釧路', '北海道']
>>> fib = Pororo(task="fib", lang="zh")
>>> fib("三__男子在街上做同样的舞蹈。")
['个', '名', '位', '女', '组']
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.fill_in_the_blank.PororoBertBlank(model, config)[source]

Bases: pororo.tasks.utils.base.PororoSimpleBase

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

Conduct fill-in-the-blank with one __ token

Parameters

sent (str) – input sentence which contains one __ token

Returns

token candidates could be fitted into __ token

Return type

List[str]