Code Monkey home page Code Monkey logo

augly-jp's Introduction

AugLy-jp

Data Augmentation for Japanese Text on AugLy

PyPI Version Python Version Python Test Test Coverage Code Quality Python Style Guide

Augmenter

base_text = "あらゆる現実をすべて自分のほうへねじ曲げたのだ"

Augmenter Augmented Description
SynonymAugmenter あらゆる現実をすべて自身のほうへねじ曲げたのだ Substitute similar word according to Sudachi synonym
WordEmbsAugmenter あらゆる現実をすべて関心のほうへねじ曲げたのだ Leverage word2vec, GloVe or fasttext embeddings to apply augmentation
FillMaskAugmenter つまり現実を、未来な未来まで変えたいんだ Using masked language model to generate text
BackTranslationAugmenter そして、ほかの人たちをそれぞれの道に安置しておられた Leverage two translation models for augmentation

Prerequisites

Software Install Command
Python 3.8.11 pyenv install 3.8.11
Poetry 1.1.* curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

Get Started

Installation

pip install augly-jp

Or clone this repository:

git clone https://github.com/chck/AugLy-jp.git
poetry install

Test with reformat

poetry run task test

Reformat

poetry run task fmt

Lint

poetry run task lint

Inspired

License

This software includes the work that is distributed in the Apache License 2.0 [1].

augly-jp's People

Contributors

chck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

augly-jp's Issues

BackTranslationAugmenter cause `IndexError: index out of range in self`

  The replica master 0 exited with a non-zero status of 1.
  Traceback (most recent call last):
    [...]
    File "/root/.local/lib/python3.7/site-packages/transformers/pipelines/text2text_generation.py", line 135, in _generate
      **generate_kwargs,
    File "/root/.local/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
      return func(*args, **kwargs)
    File "/root/.local/lib/python3.7/site-packages/transformers/generation_utils.py", line 922, in generate
      model_kwargs = self._prepare_encoder_decoder_kwargs_for_generation(input_ids, model_kwargs)
    File "/root/.local/lib/python3.7/site-packages/transformers/generation_utils.py", line 417, in _prepare_encoder_decoder_kwargs_for_generation
      model_kwargs["encoder_outputs"]: ModelOutput = encoder(input_ids, return_dict=True, **encoder_kwargs)
    File "/root/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
      return forward_call(*input, **kwargs)
    File "/root/.local/lib/python3.7/site-packages/transformers/models/marian/modeling_marian.py", line 727, in forward
      embed_pos = self.embed_positions(input_shape)
    File "/root/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
      return forward_call(*input, **kwargs)
    File "/root/.local/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
      return func(*args, **kwargs)
    File "/root/.local/lib/python3.7/site-packages/transformers/models/marian/modeling_marian.py", line 139, in forward
      return super().forward(positions)
    File "/root/.local/lib/python3.7/site-packages/torch/nn/modules/sparse.py", line 160, in forward
      self.norm_type, self.scale_grad_by_freq, self.sparse)
    File "/root/.local/lib/python3.7/site-packages/torch/nn/functional.py", line 2043, in embedding
      return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
  IndexError: index out of range in self

Input texts

['初見だった頃、かよちん加入の時になじめてラブライブ!で泣いたし、でもその時は「フン!感動したけど学園ものなんて苦手だ!こうやって綺麗なんだ!現実とは違う!」とか言ってたなぁ……友達、少なかったし本気で頑張る経験なかったもんでよ……', 'モヒニちゃんかわいい', 'ちょこっとお仕事するぞ????? (? ?ω? )? ??', '闇が広がる素晴らしかった', '牛乳と水を混ぜてからプロテイン入れるとダマにならないってのをやってみたら狙い通りだったんだけど、豊橋のまっずい水道水が入ってると思うと急に変な味に感じる', 'やっぱりsecret honeyかわいい!!\\\\nでも高いよー(´;ω;`)', '録画していた「監獄のお姫様」今さらながら鑑賞。面白かった?!さすがクドカン(*???*)!!来週からも楽しみ。爆笑ヨーグルト姫殺人事件ってワードが強すぎる。。夏帆ちゃん本当に可愛いです。', '交通費かけてでも和歌山に帰ったのは判断としてはよかったと思っています。停電、断水、浸水、家屋崩壊……何が起こるか分かりません。避難所や食料は1人分でも多く確保されるべきです。その1人分を「奪わない」ことが、今私ができる防災です。\\\\n\\\\n']
['本日のお夕飯は全部昨日の残りものですが、ポトフ、納豆、ブロッコリー、きゅうりのお漬物なので体にめちゃくちゃ良いのでは…朝はプロテインだし痩せる未来しか見えないなHAHAHA', 'ナンバガを聴くと強くなれる気がする。', 'キンスパたしかに楽しかったんだけど。前回の楽しさを知っているから微妙かなと思ってしまった', 'キモさを金に変えるで笑ってしまった ', 'キャス来てくれた方、ありがとうございました。またよろしくお願いします。', 'お風呂から配信している人を見たのは神聖かまってちゃんのの子ちゃんのニコ生以来ですわ\\n\\nの子は何回かそれで局部出しちゃってBANされてた気がするんだけどかねち気を付けてwww', '爽やかすぎる(笑)', 'カレーにルーを投入。ハウス「プライムカロリー50%オフ」のバーモントカレー甘口とジャワカレー中辛を程よくブレンド。。ジャワカレー辛いなあ…。', 'そっか花火上がるのか忘れてた!', '9/1アニサマ当選うれしみ', '高速道路じゃないけど最近国道45号線の中野坂の動画を見た\u3000特殊な標識と設備おもしろい', 'どっちも好きやから応援したい', 'ワンピやっとチョッパーのとこまで読んだけど、ルフィの「いい奴だ!おもしれえ!サンジ、あいつ仲間にしよう!」の辺りでもう号泣してるからこれ以上読むの耐えられなさそう', 'おれの師匠の師匠の師匠ジャコパストリアス', 'either/or, xo, figure8を久しぶりに聴いて、ひたっています。うちではプレイヤーが壊れたら聴けなくなってしまう状態だから、何とか対策をとらねば。今年の夏、エリオット・スミスのドキュメンタリーがDVD化する予定のよう。', 'タイVPセンスしかないからええなぁとなってる', 'ラブライブ!新シリーズ、横断歩道の絵で気になってた親切な金髪ちゃんとスタイル抜群のポニテちゃんがいてにっこり。', '「ハァ…」♪白いため息で~曇ったまぁどににーじむ、イールーミーネイションっ♪', 'セトリのネタバレって誰得だよと思ってたけど、とても恩恵を受けてる今。とりあえず1週間だけ嵐オタになる\(^o^)/', '甲子園、熱戦が続いていますね。いいね!', '午前の仕事終わりー', 'お昼に上沼恵美子を見ると日曜だな―と感じる。', '新しいラーメン屋開拓することにした\\n有名なんだろうけど、初', 'これで無駄なストレスが1つ消えた', '突然のリプ送るのめっちゃ緊張するやつ。でも去りゆく人にこそ送りたいものである', 'マイボスマイヒーローのガッキーかわいすぎるな', '音楽聞くのも好き 最近は作業中ずっとYoutube musicでルポールかビル・エヴァンスのリストをエンドレスで流してる ', '約束って大事だよね。', '仕事頑張ろ!\\nわたしには仕事がある!\\n幸せな仕事がある!', 'かわいい…枕の下にスペアポケット…足元に4次元ゴミ箱…', 'マンガパークダウンロードしてEXITラジオ聞いた!\\nもっと聞きたい!!', '自分が女の子と普通に話しとる奇跡( ´????ω????`)']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.