<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yukun&#039;s Blog &#187; Bot</title>
	<atom:link href="http://www.yukun.info/blog/tag/bot/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yukun.info</link>
	<description>難しいことは分かりやすく、簡単なことは面白く紹介</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:33:59 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JavaプログラムからExcite翻訳を利用</title>
		<link>http://www.yukun.info/blog/2008/05/java-excite-translation.html</link>
		<comments>http://www.yukun.info/blog/2008/05/java-excite-translation.html#comments</comments>
		<pubDate>Fri, 16 May 2008 11:01:52 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Bot]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[RegExp]]></category>

		<guid isPermaLink="false">http://www.yukun.info/trump/20080516/java%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e3%81%8b%e3%82%89excite%e7%bf%bb%e8%a8%b3%e3%82%92%e5%88%a9%e7%94%a8-using-excite-translation-in-java-program</guid>
		<description><![CDATA[POSTメソッドを用いてWebページのフォームにリクエストを送信し、そのレスポンスを取得するプログラム例として、エキサイト 翻訳を利用してみます。 送信クエリの1つは翻訳言語設定、2つ目は翻訳対象文字列でレスポンスのWe &#8230; <a href="http://www.yukun.info/blog/2008/05/java-excite-translation.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/05/java-excite-translation.html">JavaプログラムからExcite翻訳を利用</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>POSTメソッドを用いてWebページのフォームにリクエストを送信し、そのレスポンスを取得するプログラム例として、<a href="http://www.excite.co.jp/world/">エキサイト 翻訳</a>を利用してみます。<br />
送信クエリの1つは翻訳言語設定、2つ目は翻訳対象文字列でレスポンスのWebページから翻訳された文字列を抽出します。</p>
<h3>ソースコード</h3>
<pre>
import java.net.*;
import java.util.regex.*;
import java.io.*;

/**
 * Excite翻訳(http://www.excite.co.jp/world/)を利用するクラス
 */
public class ExciteTrans {
  private String direction; // 翻訳する言語設定 &quot;ENJA&quot; or &quot;JAEN&quot;
  /** テスト用main() */
  public static void main(String[] args) {
    ExciteTrans et = new ExciteTrans();
    System.out.println(et.getTransText(&quot;Hello!&quot;)); // 翻訳対象テキスト
  }
  /** コンストラクタ */
  public ExciteTrans() { direction =&quot;ENJA&quot;; }
  public ExciteTrans(String str) {
    if (str.equals(&quot;JAEN&quot;) || str.equals(&quot;ENJA&quot;))
      direction = str;
    else
      direction =&quot;JAEN&quot;;
  }
  /**
   * テキストを翻訳
   * @param before 翻訳前のテキスト
   * @return 翻訳後のテキスト
   */
  public String getTransText(String before) {
    String afterText = null; // 翻訳されたテキスト
    try {
      // URLクラスのインスタンスを生成
      URL exciteURL =
        new URL(&quot;http://www.excite.co.jp/world/english/&quot;);
      // 接続します
      URLConnection con = exciteURL.openConnection();
      // 出力を行うように設定
      con.setDoOutput(true);
      // 出力ストリームを取得
      PrintWriter out = new PrintWriter(con.getOutputStream());
      // クエリー文の生成・送信
      out.print(&quot;before={&quot;+ before +&quot;}&amp;wb_lp={&quot;+ direction +&quot;}&quot;);
      out.close();
      // 入力ストリームを取得
      BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
      // 一行ずつ読み込む
      String aline;
      // 抽出用の正規表現
      String regex = &quot;&lt;textarea [^&gt;].*after.*&gt;(.*)&quot;;
      Pattern pattern = Pattern.compile(regex);
      while ((aline = in.readLine()) != null) {
        Matcher mc = pattern.matcher(aline);
        if(mc.matches()) {
          afterText = mc.group(1);
        }
      }
      in.close(); // 入力ストリームを閉じる
    } catch (IOException e) {
      e.printStackTrace();
    }
    return afterText;
  }
}
</pre>
<h3>実行結果</h3>
<pre>こんにちは!</pre>
<h3>Java MSN Messenger Library (JML)で翻訳ロボを作る</h3>
<p><a href="http://java-jml.sourceforge.net/">Java MSN Messenger Library (JML)</a>とは Windows Live Messenger 上の通信プロトコルMSNP8-MSNP12をサポートするライブラリです。主に、メンバーの会話に自動応答するチャットボット(Chat Bot)や人工無脳などを作る際に用いられます。</p>
<p>今回は、ライブラリに付属しているサンプルプログラムのEchoMessengerクラスにこの翻訳クラスをかませて、メンバーの発言を翻訳し、その文字列色をランダムで選択した色で応答するチャットボットを作成してみました。</p>
<p>実行結果は下図になります。<br />
<a href="http://www.yukun.info/wp-content/uploads/naiTrans.png"><img src="http://www.yukun.info/wp-content/uploads/naiTrans-e1273383658134.png" alt="JML翻訳ロボの実行結果例" title="naiTrans" width="400" height="392" class="size-full wp-image-1547" /></a></p>
<p>コンストラクタでの翻訳言語設定が逆でも、文字列が英語or日本語に統一されていれば、Excite翻訳側がそれに合わせて適当な言語で翻訳するみたいです。<br />
最後に、</p>
<h3>礼儀正しくクローリングする際は</h3>
<ul>
<li>robots.txtやメタタグを守るように</li>
<li>相手サーバに負荷をかけすぎないように</li>
<li>相手Webサイトポリシー(利用規約)を守るように</li>
<li>頻繁に使いたいモノなら、同機能のWebサービスを使うこと(利用規約内で)</li>
</ul>
<p>うーん、今回のようなプログラムの利用はあまりよくないようでね。<br />
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2010/05/java-networkinterface-ipv6-ipv4.html" rel="bookmark" title="2010年5月16日">Java: インターフェースとローカルのIPv6, IPv4アドレスの取得 &#8211; NetworkInterfaceクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/07/python-regular-expression.html" rel="bookmark" title="2008年7月19日">Python: 正規表現の基本 &#8211; メタ文字「.」「^」「$」</a></li>
<li><a href="http://www.yukun.info/blog/2008/07/python-regular-expression-loop.html" rel="bookmark" title="2008年7月20日">Python: 正規表現の基本 &#8211; 繰り返し「*」「+」「?」</a></li>
<li><a href="http://www.yukun.info/blog/2011/02/java-tcp-socket-echo.html" rel="bookmark" title="2011年2月12日">Java: TCP Socket Echo Server/Client サンプル</a></li>
<li><a href="http://www.yukun.info/blog/2008/07/python-regular-expression-range.html" rel="bookmark" title="2008年7月21日">Python: 正規表現の基本 &#8211; 文字範囲の指定「[ ]」</a></li>
</ul>
<p><!-- Similar Posts took 7.203 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/05/java-excite-translation.html">JavaプログラムからExcite翻訳を利用</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/05/java-excite-translation.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMT, the Eye of the Storm in the Net Game</title>
		<link>http://www.yukun.info/blog/2007/02/rmi-net-game.html</link>
		<comments>http://www.yukun.info/blog/2007/02/rmi-net-game.html#comments</comments>
		<pubDate>Wed, 21 Feb 2007 06:05:00 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Bot]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[RMT]]></category>
		<category><![CDATA[Web2.0]]></category>

		<guid isPermaLink="false">http://codeai.net/?p=27</guid>
		<description><![CDATA[Recently, the online game has been more popular together with developing the computer&#8217;s performance and  &#8230; <a href="http://www.yukun.info/blog/2007/02/rmi-net-game.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2007/02/rmi-net-game.html">RMT, the Eye of the Storm in the Net Game</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Recently, the online game has been more popular together with developing the computer&#8217;s performance and building the network.<br />
At the same time, some people pick out not only the real value but also virtual one.</p>
<p>In online game, some player buy the game currency for the real one.<br />
That is <span style="color: rgb(153, 0, 0);">R</span><span style="color: rgb(204, 153, 51);">M</span><span style="color: rgb(51, 51, 255);">T</span> standing for <span style="color: rgb(153, 0, 0);">R</span>eal <span style="color: rgb(204, 153, 51);">M</span>oney <span style="color: rgb(51, 51, 255);">T</span>rading.</p>
<p>They often buy through the agent.<br />
The employee of the brokerage firm describes that the main users are busy salaried workers who wanna enjoy the game with not having much time.<br />
That firm takes up the game currency from the heavy user who spend much time in a day.<br />
He said that I earn fifteen thousand yen per a month. In addition, he also assert that the demand of the game currency will increase.</p>
<p>But the company of making online game doesn&#8217;t formally admit RMT.<br />
One of reasons stem from the bot. Well, I&#8217;ll try to state the present problem of RMT including the bot.</p>
<p>A bot is defined as the computer program that operate to earn the game currency automatically and unfairly in online game as the game character.<br />
A <span style="color: rgb(0, 153, 0);">bot</span> comes from a <span style="color: rgb(153, 51, 0);">ro</span><span><span style="color: rgb(0, 153, 0);">bot</span>. </span>For instance, the bot character on the game searches the enemy, smashes it, and gets the game money. it repeats the cycle without a break.</p>
<p>But the bot pressure burden towards the game server and disturb the human player enjoying it. For that reason, the company bans the bot and detects  bots with the manpower around the clock.</p>
<p>Since the pattern of the bot movement is regular and fixed, the stuff can detect easily. Nevertheless, the innumerable bot annoy the game company.</p>
<p>The user of the bot access the online game from China mostly.<br />
Some users remark that we gain by the reminder of currency rat between China and Japan and between the real and the game.<br />
Some online game company prohibit the bot user from accessing the game from China. But they attempt to access it through the relay server in Japan.</p>
<p>While some Japanese game company are puzzled over RMT&#8217;s problem, the<br />
American game company that has spread and argued with online game market perform the business that premise RMT. &#8220;<a href="http://ja.wikipedia.org/wiki/Second_Life">Second Life</a>&#8221; is a case in point.</p>
<p>I deduce that on the Net it&#8217;s difficult for authority to grasp the distribution route and amount but according to making them visual as the business, we can conceive the new way of sound enjoying the game.</p>
<p>Frankly speaking, I think the virtual world encroaches the real one whether or not.</p>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2007/02/reviewing-web2.html" rel="bookmark" title="2007年2月22日">Reviewing Web2.0 at the Tail of the Procession</a></li>
<li><a href="http://www.yukun.info/blog/2006/07/character-of-the-time.html" rel="bookmark" title="2006年7月13日">Take the character of the time</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/digital-native-energetic-action-power.html" rel="bookmark" title="2008年11月12日">デジタルネイティブ達の行動力が凄い</a></li>
<li><a href="http://www.yukun.info/blog/2007/03/pitfall-of-freedom-of-choice.html" rel="bookmark" title="2007年3月7日">The Pitfall of Freedom of Choice</a></li>
<li><a href="http://www.yukun.info/blog/2010/05/many-interrupted-jobs.html" rel="bookmark" title="2010年5月6日">Many interrupted jobs</a></li>
</ul>
<p><!-- Similar Posts took 6.139 ms --></p>
<p><a href="http://www.yukun.info/blog/2007/02/rmi-net-game.html">RMT, the Eye of the Storm in the Net Game</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2007/02/rmi-net-game.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

