I was able to meet the landlord at last yesterday. I told the air conditioner of the apartment to have broken. Then, the landlord quickly called the electric appliances store, and decided on the schedule of construction. And, he gave me a small electric heater. Because I had lived in refrigerator like house, I felt that it was warm in the room though the small heater was not too warm.
There is a language exchange today. I go to Kudanshita at 11 o'clock. I want to become fluent the native level of English. It is because of good-looking.
I was able to spend it without benumbing thanks to a warm heater. In addition, I was able to develop by staying out of the futon on the floor. The chat robot that completed today is a favor of this heater.
I visited a library as usual yesterday. It seemed to be very interesting, the book on Chomsky's linguistics.I was looking for a book that seemed to be interesting.
The chat robot that I am developing now is an artificial internal voice. Artificial internal voice becomes the brain of the chat robot that dynamically acts ,in a word, the engine. If artificial internal voice is used, it is possible to become an artificial intelligence program that studies very actively though the chat robot per se is originally a very static program.
# Load our modules # Please note that you MUST have LWP::UserAgent and JSON installed to use this # You can get both from CPAN. use LWP::UserAgent; use JSON;
use utf8; #utf8を使う use Encode qw/encode decode/;
my $ua = LWP::UserAgent->new(); $ua->agent('PerlSample/0.1'); my $str = shift; #### ←から変更。 $str = decode('UTF-8', $str); my $response = $ua->get("https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" . $str . "&userip=USERS-IP-ADDRESS&hl=ja");
my $json = from_json($response->decoded_content);
my $i = 0; foreach my $result (@{$json->{responseData}->{results}}){ $i++;
$str = encode('UTF-8', $result->{content}); print $i.". " . $str . "(" . $result->{url} . ")\n"; } if(!$i){ print "Sorry, but there were no results.\n"; }
さて、Musicを引数として渡します。 Musicでググった結果を返します。
--- 実行開始 [>perl untitled8.pl Music] 1. Portal for new bands and artists, with links to audio downloads and shopping.(http://www.music.com/) 2. Find music videos, internet radio, music downloads and all the latest music news and information on Yahoo! Music.(http://new.music.yahoo.com/) 3. Watch free music videos, tune in to AOL Radio, get free music downloads, read music news, and search for your favorite music artists.(http://music.aol.com/) 4. Music is an art form whose medium is sound. Common elements of music are pitch ( which governs melody and harmony), rhythm (and its associated concepts tempo, meter, and articulation), dynamics, and the sonic qualities of timbre and ...(http://en.wikipedia.org/wiki/Music)
--- 実行終了 (0)
Musicでググると以上のような結果が返って来ました。 例えば、4.のis an art~.の部分なんか使えないでしょうか。 Musicの意味をしっかりと定義しているわけです。 これを学習内容として、ボットに学習させることもできます。
BAD REQUESTなどと出ている場合はIFRAMEの設定をONにしてください。 0番の人工無脳に注目してください。 TEACHで文章を入力すると入力された文章を形態素解析して辞書ファイルに保存したのち、テンプレートで組み立てて吐き出します。テンプレートが現在のところ、名詞、動詞、形容詞しか用意していないので、連体詞、助詞、副詞、記号などは[J]などと言ってしまいますが、まあ、着実に私の目指しているものは出来つつあるので、進捗状況をさらすつもりで、この無脳を上げてみました。
if ( defined $text ) { my $utf8 = Encode::is_utf8($text) ? $text : Encode::decode_utf8($text); my $escaped = CGI::escape($utf8); my $ua = LWP::UserAgent->new; $ua->agent('PerlSample/0.1'); $ua->timeout(5);
package Dog; $string = "Walk the dog."; if($string eq "Walk the dog.") { package Cat; $string = "Pet the cat."; print("$string\n"); } print("$string\n"); --- 実行開始 [>perl untitled3.pl] Pet the cat. Walk the dog.