Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Text Generator CLI

Release Package PyPI version

  • マルコフ連鎖を使った文章自動生成プログラム(日本語のみ) + コマンドラインインターフェース
  • ohshige15/TextGeneratorのForkのForkの Fork

インストール

1. 事前に mecab をセットアップしておく

  • Mac:
brew install mecab
brew install mecab-ipadic
  • Linux(Ubuntu):
sudo apt install mecab libmecab-dev mecab-ipadic-utf8 -y

2. TextGenerator-cliを PyPI からダウンロード

pip install TextGenerator-cli

ヘルプ

$ textgen
usage: textgen [-V] [-h] {prepare,p,generate,g,help,h} ...

マルコフ連鎖を使った文章自動生成プログラム

positional arguments:
  {prepare,p,generate,g,help,h}
    prepare (p)         モデルをテキストから作成する
    generate (g)        文章を生成する
    help (h)            ヘルプを表示する

optional arguments:
  -V, --version         バージョン情報を表示する
  -h, --help            ヘルプを表示する
$ textgen help p
usage: textgen prepare [-o DB] [-h] [FILE [FILE ...]]

positional arguments:
  FILE             テキストファイル (default: stdin)

optional arguments:
  -o DB, --out DB  出力DBファイル名 (default: chain.db)
  -h, --help       ヘルプを表示する
$ textgen help g
usage: textgen generate [-s NL] [-b BYTE] [-n TIME] [-t LIM] [-d DB] [-h]

optional arguments:
  -s NL, --sentence NL  生成する文数(>=0) (default: 5)
  -b BYTE, --byte BYTE  指定byte数以下の文生成を試行(>=0) (default: None)
  -n TIME, --time TIME  生成する回数(>=0) (default: 1)
  -t LIM, --try LIM     試行回数の上限(>=0) (default: 100)
  -d DB, --db DB        チェインDBファイル (default: chain.db)
  -h, --help            ヘルプを表示する
$ textgen help h
usage: textgen help [-h] command

positional arguments:
  command     ヘルプが表示されるコマンド名

optional arguments:
  -h, --help  ヘルプを表示する

使い方

# 吾輩は猫であるを青空文庫からダウンロード
$ curl 'http://pubserver2.herokuapp.com/api/v0.1/books/789/content?format=txt' -o wagahai.txt
# モデル作成(chain.dbに出力する, -oで変更可能)
$ textgen p wagahai.txt
# 文章生成(chain.dbを入力とする, -dで変更可能)
# -nで回数, -sで1回につなげる文の数を指定
$ textgen g -n 2 -s 3
忘れまいと思って、小供だの、いろいろ用事があっては近頃材料払底の為め、黒石を取っては黒を見て、図書館へは寄りつかない男だ」失敬な、下駄屋はいつ御催しがありました。「そうでございましょう」と考えて見たら分るでしょうから吹き付ける、非常に体育を重んじたものは自分の容貌《ようば》へ置く。
この鏡を見ねえ。しかるにこのパラドックスを道破《どうは》えに眼窩《がんなべ》の声だけにしろと、烈しい光線で瞳孔《どうこう》の根本へ吹き寄せつつある。「質朴剛健でたのもしい気風だ」

Fork 元

Metadata

Release files for TextGenerator-cli 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TextGenerator-cli 0.1.7
File Size Uploaded
TextGenerator-cli-0.1.7.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for TextGenerator-cli 0.1.7
File Interpreter ABI Platform
TextGenerator_cli-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / TextGenerator-cli-0.1.7.tar.gz

Download URL TextGenerator-cli-0.1.7.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9932106df23cad59b5b385b7ee3365e4962f4c9607fa44395644d8b1e3892f69
BLAKE2b-256 checksum
How to use checksums
bc579a27e801fab62876c1c3fa2038d2c7ea9b49bb14db5d9321fd153fcfbdcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / TextGenerator_cli-0.1.7-py3-none-any.whl

Download URL TextGenerator_cli-0.1.7-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f711e1bdb5c9d57cbc860baca110a1764daf23e679e10c681babb2b75806298
BLAKE2b-256 checksum
How to use checksums
f7895e7e2673ece5386384efc66cc65e8cce5a2d76c9e6fedad36cb3b7ee3ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page