Skip to main content

NeXov Enables eXtensible Observation of Vertices

Project description

NeXov

"NeXov Enables eXtensible Observation of Vertices"

NeXovは、非常に高密度のマルコフ連鎖モデルの構築や生成、可視化、またそれをサポートするデータ処理をNetworkXで実現するツールです。

Install

いくつか前提ソフトがあるので先にインストールします。

MeCab

形態素解析を行うMeCabはNeXovのデータ前処理に使われています。MeCabをインストールするには、以下のサイトからインストーラーをダウンロードし、インストーラーの指示に従います。

https://github.com/ikegami-yukino/mecab/releases

Debian系ディストリは以下のコマンドを実行します。

$ sudo apt install mecab libmecab-dev mecab-ipadic-utf8

NEologd

NEologdは、MeCabを固有名詞に強くするためのシステム辞書です。
Windowsであれば、以下のサイトを参考にインストールしてください。

https://qiita.com/xi_guisheng/items/40ee7da516de05e5894f

また、Debian系ディストリであれば以下のサイトが参考になります。

https://blog.forestberrypi.com/tools-services/linux/mecab-in-ubuntu/#toc7

Graphviz

Graphvizは、グラフの可視化を行うライブラリです。以下のサイトを参考にインストールしてください。

https://graphviz.org/download/

Install

NeXovをインストールするには、以下のコマンドを実行します。

$ pip install nexov

Usage

NeXovには以下のような機能があり、それぞれ対応するコマンドがあります。

Command Feature
tokenize テキストのトークン化
generate モデルの構築・生成...etc
visualize モデルの可視化
usage: nexov [-h] {tokenize,generate,visualize} ...

NeXov Enables eXtensible Observation of Vertices

positional arguments:
  {tokenize,generate,visualize}
    tokenize            テキストをトークンに分割
    generate            モデルまたはテキストを生成
    visualize           モデルを画像として可視化

options:
  -h, --help            show this help message and exit

tokenize

tokenizeは、自動でテキストをトークン化するコマンドです。

オプション

usage: nexov tokenize [-h] -i INPUT [-o OUTPUT] [--method {mecab,char}]

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        入力ファイル
  -o OUTPUT, --output OUTPUT
                        出力ファイル
  --method {mecab,char}
                        分割方法

$ cat input.txt
ぐっもーにん!
もにもに!
もーにん!!
もにもに!!!!
おはですー!!
おはですー!
おはようです!!!!!!
$ nexov tokenize -i input.txt -o tokens.txt
[+] Wrote tokenized data to tokens.txt
$ cat tokens.txt
ぐっも    !
も    !
も     !
も       !
お  です   !
お  です  !
おはよう です      

generate

generateは、モデルの構築と生成、またインポート・エクスポートも行うコマンドです。

オプション

usage: nexov generate [-h] -i INPUT [-s START] [-l LENGTH] [-e EXPORT] [-v VISUALIZE]

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        モデルまたはトークン済みデータファイル
  -s START, --start START
                        開始トークン
  -l LENGTH, --length LENGTH
                        生成するトークン数
  -e EXPORT, --export EXPORT
                        生成後のモデルをファイルにエクスポート
  -v VISUALIZE, --visualize VISUALIZE
                        生成と同時に可視化を実行(拡張子を除く出力ファイル名を指定)

$ cat tokens.txt
ぐっも    !
も    !
も     !
も       !
お  です   !
お  です  !
おはよう です      !
$ nexov generate -i tokens.txt -s  -l 100
もにもにもにもーにもにん!おはです!おはですー!!!!もに!もにん!!もにん!おはですー!!!おはですー!!もー!おはようです!!!おはようです!!おはですーにもにもー!もに!!!!もにもーにん!!!おは です!!おはようですー!もにん!!

$ nexov generate -i tokens.txt -e model.json
[+] The model was exported to model.json
$ nexov generate -i model.json -s  -l 100
もーにん!おはですーにもにん!!!!おはですー!!!もにん!もにもにもー!もにん!!!!!もにもにん!!もーにもにん!!!!おはようですー!おはです!!!!!!おはようですーに!おはですーに!!!!おはよ うですー!もにもにもにん!おは

visualize

visualizeは、モデルを画像で可視化するコマンドです。

オプション

usage: nexov visualize [-h] -i INPUT -o OUTPUT [--font FONT]

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        モデルファイル
  -o OUTPUT, --output OUTPUT
                        出力ファイル(拡張子を除くファイル名を指定)
  --font FONT           使用するフォント

$ nexov visualize -i model.json -o output
[+] The model visualization was saved to output.png

output.png

LICENSE

NeXovはMITライセンスで配布されています。

ただし、以下の外部ソフト・ライブラリを利用しています。これらはNeXovに含まれていませんが、別途インストールが必要です。

  • MeCab (形態素解析器) : BSD License
  • mecab-ipadic-NEologd (日本語辞書) : Apache License 2.0
  • Graphviz (グラフ描画ツール) : Eclipse Public License 1.0
  • mecab-python3 (Pythonバインディング) : MIT License
  • networkx : BSD License
  • graphviz (Pythonラッパー) : MIT License
  • matplotlib : Matplotlib License (BSDスタイル)

それぞれのライセンス条件に従ってご利用ください。

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

nexov-1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

nexov-1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file nexov-1.0.tar.gz.

File metadata

  • Download URL: nexov-1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for nexov-1.0.tar.gz
Algorithm Hash digest
SHA256 76447467b30f864cc2ed8df11f6b34805be3dde22d9a1fc9c2b42f144899fa9c
MD5 cb16f70285ff97b4cd2abb030636bd93
BLAKE2b-256 f0f95d3362c8c3d10e95b00fb438e3617c1ecc12f4b20e0d86a644b745cf4d6f

See more details on using hashes here.

File details

Details for the file nexov-1.0-py3-none-any.whl.

File metadata

  • Download URL: nexov-1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for nexov-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f98209f8f64b1374ee25244d4ea9f0296c16e32784e0686c89c373d48591be13
MD5 52d3d8d31ed7cb2a9d898d8696451d62
BLAKE2b-256 4c540ba43a067774f7161cdd4dfd169920e8264ab277b81ffb0fc1b7f591ddf6

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