文自在変換ツール(Convert Sentences at Will)
これは平叙文肯定や平叙文否定、疑問文、命令文など、様々な文型からなる日本語の文章を互いに変換することができるツールです。
文章の形態素解析を行い、変換をルールベースによって実現しています。
コマンド終了後、ImportError: cannot import name 'main' from 'csw.csw' のようなエラーが出力されますが、動作には問題ありません。
Google Colaboratoryでの実行も可能です。
環境
Linux OS もしくは Google Colaboratory
Python 3系
MeCab
ipadic-utf8(/var/lib/mecab/dic/ にインストールされていること)
使い方
n:平叙文肯定, d:平叙文否定, q:疑問文, o:命令文
--n2d:平叙文肯定から平叙文否定への変換
--n2q:平叙文肯定から疑問文への変換
--n2o:平叙文肯定か命令文への変換
--d2n:平叙文否定から平叙文肯定への変換
--d2q:平叙文否定から疑問文への変換
--d2o:平叙文否定から命令文への変換
--q2n:疑問文から平叙文肯定への変換
--q2d:疑問文から平叙文否定への変換
--q2o:疑問文から命令文への変換
--o2n:命令文から平叙文肯定への変換
--o2d:命令文から平叙文否定への変換
--o2q:命令文から疑問文への変換
--n:平叙文肯定への変換
--d:平叙文否定への変換
--q:疑問文への変換
--o:命令文への変換
-c, --current:一文ずつ入出力
-d, --detail:形態素解析結果を表示
-f, --file:ファイルによる入出力(その後ろに変換元ファイル名、変換先ファイル名を順に指定)
使用例
csw --n2d --current --detail もしくは csw --n2d -cd
- 平叙文肯定から平叙文否定への変換を一文ずつの入出力で行います。
csw --q --file hoge.txt piyo.txt もしくは csw --q -f hoge.txt piyo.txt
- 様々な文型の文章で構成されたhoge.txtを全て疑問文に変換し、それらをpiyo.txtへ上書きします。
実行例
$ csw --n2d -cd
「e」か「え」を入力で終了
---------------------------------------------
input : 私は人間です。
私 名詞,代名詞,一般,*,*,*,私,ワタシ,ワタシ
は 助詞,係助詞,*,*,*,*,は,ハ,ワ
人間 名詞,一般,*,*,*,*,人間,ニンゲン,ニンゲン
です 助動詞,*,*,*,特殊・デス,基本形,です,デス,デス
。 記号,句点,*,*,*,*,。,。,。
EOS
output : 私は人間じゃないです。
---------------------------------------------
input : e
$ csw --d -f input.txt output.txt
$
Metadata
Release files for csw 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| csw-0.3.5.tar.gz | 12.2 kB | Without provenance | Details for csw-0.3.5.tar.gz |
Release files / csw-0.3.5.tar.gz
| Download URL | csw-0.3.5.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20baa7f4eaeaf8e492a676fb0694dfb1d4a6ecc3968259138a29ad2d017cac12
|
|
BLAKE2b-256 checksum How to use checksums |
d91333c8354b97aa9d393dc527ff9d9271bfa8277388ba314b2722aaff12899e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.62.2 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
|
Security for csw 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.