Skip to content

テキストファイルから自動的に共起ネットワークを作成・保存するには(VBAからの操作について) #1085

Discussion options

You must be logged in to vote

コマンドプロンプトから自動実行プラグイン「auto_run.pm」を使う

自動的にテキストファイルから共起ネットワークを作成して保存するということですね。コマンドプロンプト(ターミナル)であれば、次のコマンドで実行できます。

cd c:\khcoder3
.\kh_coder.exe -auto_run c:\khcoder3\tutorial_jp\bayes_data.txt

入力のテキストファイル名「c:\khcoder3\tutorial_jp\bayes_data.txt」は、任意のテキストファイルのフルパスに置き換えてください。出力は、「c:\khcoder3」フォルダに「net.png」というファイル名で共起ネットワークが保存されます。

上のコマンドでは自動実行プラグインを用いています。「pulugin_jp」フォルダの「auto_run.pm」です。「auto_run.pm」の20行目、

		my $file_save   = 'net.png';

を編集すれば、出力ファイル名を任意のものに変更できます。

この自動実行プラグインはPerlで書かれています。編集することで、出力ファイル名以外にも、共起ネットワークのオプションなどを変更できます。このプラグインについて詳しくはこちらの書籍をご覧下さい。
http://amzn.to/2AYS5dI

VBAからの実行

上のコマンドをVBAから実行するには次のようにすれば良いでしょう。

Shell ("cmd.exe /c ""cd c:\khcoder3 & .\kh_coder.exe -auto_run …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@coconanalove08290301
Comment options

@ko-ichi-h
Comment options

@coconanalove08290301
Comment options

@ko-ichi-h
Comment options

Answer selected by ko-ichi-h
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Non-English Communication in Japanese language.
3 participants
Converted from issue

This discussion was converted from issue #602 on April 22, 2023 10:48.