thaitextaug.lm

Modules

class thaitextaug.lm.FastTextAug(model_path: str)

Text Augment from FastText

augment(sentence: str, n_sent: int = 1, p: float = 0.7)List[Tuple[str]]

Text Augment from FastText

You wants to download thai model from https://fasttext.cc/docs/en/crawl-vectors.html.

Parameters
  • sentence (str) – thai sentence

  • n_sent (int) – number sentence

  • p (float) – Probability of word

Returns

list of synonyms

Return type

List[Tuple[str]]

modify_sent(sent, p=0.7)List[List[str]]
Parameters
  • sent (str) – text sentence

  • p (float) – probability

Return type

List[List[str]]

tokenize(text: str)List[str]

Thai text tokenize for fasttext

Parameters

text (str) – thai text

Returns

list of word

Return type

List[str]

class thaitextaug.lm.Thai2transformersAug
augment(sentence: str, num_replace_tokens: int = 3)List[str]

Text Augment from wangchanberta

Parameters
  • sentence (str) – thai sentence

  • num_replace_tokens (int) – number replace tokens

Returns

list of text augment

Return type

List[str]