RSS を読み込んでランダムな文章を生成する 2008-09-07-3 [Programming][NLP][IIR][WebAPI] 今日のIIR輪講[2008-09-07-2]の内容のフォローも兼ねて、ちょっとしたハックを紹介。 bigram language model に基づく、ランダム文生成を行います。 って、まあ、単純にある単語の次に現れる単語の分布を用いて、文章を生成していくだけですが。 以下、サンプルプログラムと実行例です。 サンプルコード rss-lm.pl #!/usr/bin/perl use strict; use warnings; use XML::RSS; use LWP::Simple; use XML::Simple; use URI::Escape; use utf8; binmode STDOUT, ":utf8"; my $appid = "Yaho
![RSS を読み込んでランダムな文章を生成する](https://cdn-ak-scissors.b.st-hatena.com/image/square/af37977ee866988286b95e74fff98500a190545c/height=288;version=1;width=512/https%3A%2F%2Fchalow.net%2Fimages%2Ftcl-logo-25.png)