Skip to main content

A simple Markov chain library that learns from URLs.

Project description

markov-learner

言語レベルでのマルコフ連鎖を簡単に体験できるライブラリです。 指定したURLからテキストを学習し、それに基づいた文章を生成します。

インストール

pip install markov-learner

使い方

# ライブラリをダウンロードする。
import markov

# URLから学習する。
## 同じ階層のみを学習する。
markov.learn.add("https://example.com")
markov.learn.add("https://en.wikipedia.org/wiki/Markov_chain")

# 文章を生成する。
markov.output
## 変数に保存したり、表示したりできる。
x = markov.output
print(markov.output)

# 学習データをリセットする。
markov.learn.reset

# 設定を変更する。
## 最大単語数を変更する。
## default = 100
markov.config.max = 100

## 最小単語数を変更する。
## default = 10
markov.config.min = 10

アップデート

1.1.0

  • 「。」が来た時点で文章を終了するようにしました。

1.2.0

  • 生成時のループ(繰り返しの多い文章)を抑制する機能を追加しました。
  • 最小・最大単語数を設定できる markov.config を追加しました。

1.3.0

  • JavaScriptで構成されたサイト(Twitter/X, YouTubeなど)からのテキスト取得に対応しました。
    • 初回実行時にブラウザのインストールが必要な場合があります。

作者

Atsuki

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markov_learner-1.3.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markov_learner-1.3.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file markov_learner-1.3.1.tar.gz.

File metadata

  • Download URL: markov_learner-1.3.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for markov_learner-1.3.1.tar.gz
Algorithm Hash digest
SHA256 e0cb7516ec1ba8759d145a45a9ec6bdd94c19fab0e39cce67c63d6b5240014ee
MD5 38ca3eaac60089a3369aaf213fcec1b0
BLAKE2b-256 a16445e2dec13b132ffa0f1b6573934e40019e9d47ee7d2c1505c18058f12415

See more details on using hashes here.

File details

Details for the file markov_learner-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: markov_learner-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for markov_learner-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cddfaa8c33d0ec0de10e44d93dc61b16b3bc3be2caeae969da2e8806430c3472
MD5 182289349dd1d58d86cb8dbfb9137074
BLAKE2b-256 7a8889ebfcd78ca28c913ff666bd767c06bbd23b5cdab5ecc924f449cf6c996f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page