#title(Yahoo! Japanの日本語形態素解析Web APIを使う)

#navi(.NETプログラミング研究)

#contents

*Yahoo! Japanの日本語形態素解析Web APIを使う [#ld3f8adf]

[[Yahoo! Japan>http://www.yahoo.co.jp/]]の[[日本語形態素解析Web API>http://developer.yahoo.co.jp/webapi/jlp/ma/v1/parse.html]]は、日本語形態素解析ができるWebサービスです。現在の最新バージョンは、1です。

日本語形態素解析Web APIは、RESTのみに対応しています。GETとPOSTどちらでも可能です。結果はXMLで返されます。なおRESTについては、.NETプログラミング研究 第73号の「[[RESTを使ったWebサービスにアクセスする>../73]]」をご覧ください。

日本語形態素解析Web APIを利用するには、様々な制限があります。まず、あらかじめアプリケーションIDを登録しておく必要があります。アプリケーションIDを登録する方法は、「[[Yahoo!デベロッパーネットワーク ヘルプ - アプリケーションIDとは>http://help.yahoo.co.jp/help/jp/developer/developer-06.html]]」にあります。

また、クレジットの表示が義務付けられています。詳しくは、「[[Yahoo!デベロッパーネットワーク - クレジットの表示>http://developer.yahoo.co.jp/attribution/]]」をご覧ください。

さらに、1つのアプリケーションIDにつき24時間以内で50000件のリクエストまでです。また、1つのリクエストのサイズは最大で100KBです。

これらの制限については、ご使用前にかならずご自分でご確認ください。

**とりあえず使ってみる [#q9f63a1c]

日本語形態素解析Web APIで取得できる結果には、2種類あります。通常の形態素解析の結果と、形態素の出現頻度情報(形態素解析の結果から同一形態素の出現数を求めたもの)の結果です。これらの結果はどちらかだけ取得することも、両方を一度に取得することもできます。なお2つの結果の違いについては、後述します。

まずはとりあえず使ってみましょう。以下の例では、resultsパラメータを"ma"にして、通常の形態素解析の結果のみを取得しています。なお、以下のコードで"<あなたのアプリケーションID>"の部分は必ずご自分のアプリケーションIDに変更してください。

#code(vbnet){{
'Imports System.IO
'Imports System.Net
'Imports System.Text
'Imports System.Xml

'形態素解析する文章
Dim text As String = "今日はいい天気です。明日もいい天気になるでしょう。"

'HttpWebRequestを作成する
Dim webreq As HttpWebRequest = DirectCast( _
    System.Net.WebRequest.Create( _
        "http://jlp.yahooapis.jp/MAService/V1/parse"), HttpWebRequest)
'POSTとしてデータを送信する
webreq.Method = "POST"
webreq.ContentType = "application/x-www-form-urlencoded"
'リクエストパラメータを作成する
Dim postStr As String = "appid=<あなたのアプリケーションID>&" & _
    "results=ma&" & _
    "sentence=" & Uri.EscapeUriString(text)
Dim postData As Byte() = Encoding.UTF8.GetBytes(postStr)
webreq.ContentLength = postData.Length
'データを送信する
Dim reqStrm As Stream = webreq.GetRequestStream()
reqStrm.Write(postData, 0, postData.Length)
reqStrm.Close()

'サーバーからの応答を受信するためのHttpWebResponseを取得する
Dim webres As HttpWebResponse = DirectCast(webreq.GetResponse(), HttpWebResponse)
'応答データを受信するためのStreamを取得する
Dim st As Stream = webres.GetResponseStream()
Dim sr As New StreamReader(st)
'応答データをすべて読み込む
Dim resultXml As String = sr.ReadToEnd()
'閉じる
sr.Close()
st.Close()
webres.Close()

'結果を表示する
Console.WriteLine(resultXml)
}}

#code(csharp){{
//using System;
//using System.IO;
//using System.Net;
//using System.Text;
//using System.Xml;

//形態素解析する文章
string text = "今日はいい天気です。明日もいい天気になるでしょう。";

//HttpWebRequestを作成する
HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(
    "http://jlp.yahooapis.jp/MAService/V1/parse");
//POSTとしてデータを送信する
webreq.Method = "POST";
webreq.ContentType = "application/x-www-form-urlencoded";
//リクエストパラメータを作成する
string postStr = "appid=<あなたのアプリケーションID>&" +
    "results=ma&" +
    "sentence=" + Uri.EscapeUriString(text);
byte[] postData = Encoding.UTF8.GetBytes(postStr);
webreq.ContentLength = postData.Length;
//データを送信する
Stream reqStrm = webreq.GetRequestStream();
reqStrm.Write(postData, 0, postData.Length);
reqStrm.Close();

//サーバーからの応答を受信するためのHttpWebResponseを取得する
HttpWebResponse webres = (HttpWebResponse)webreq.GetResponse();
//応答データを受信するためのStreamを取得する
Stream st = webres.GetResponseStream();
StreamReader sr = new StreamReader(st);
//応答データをすべて読み込む
string resultXml = sr.ReadToEnd();
//閉じる
sr.Close();
st.Close();
webres.Close();

//結果を表示する
Console.WriteLine(resultXml);
}}

このコードを実行した結果は、以下のようになります。(実際に返されるデータには改行が入りませんが、見やすくするために整形しています。)

#code(pre){{
#pre{{
<?xml version="1.0" encoding="UTF-8" ?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="urn:yahoo:jp:jlp"
 xsi:schemaLocation="urn:yahoo:jp:jlp http://jlp.yahooapis.jp/MAService/V1/parseResponse.xsd">
  <ma_result>
    <total_count>15</total_count>
    <filtered_count>15</filtered_count>
    <word_list>
      <word>
        <surface>今日</surface>
        <reading>きょう</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>は</surface>
        <reading>は</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>いい</surface>
        <reading>いい</reading>
        <pos>形容詞</pos>
      </word>
      <word>
        <surface>天気</surface>
        <reading>てんき</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>です</surface>
        <reading>です</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>。</surface>
        <reading>。</reading>
        <pos>特殊</pos>
      </word>
      <word>
        <surface>明日</surface>
        <reading>あした</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>も</surface>
        <reading>も</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>いい</surface>
        <reading>いい</reading>
        <pos>形容詞</pos>
      </word>
      <word>
        <surface>天気</surface>
        <reading>てんき</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>に</surface>
        <reading>に</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>なる</surface>
        <reading>なる</reading>
        <pos>動詞</pos>
      </word>
      <word>
        <surface>でしょ</surface>
        <reading>でしょ</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>う</surface>
        <reading>う</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>。</surface>
        <reading>。</reading>
        <pos>特殊</pos>
      </word>
    </word_list>
  </ma_result>
</ResultSet>
}}

resultsパラメータを"uniq"にして、出現頻度情報の結果のみを取得したときは、以下のような結果が返されます。

#code(pre){{
#pre{{
<?xml version="1.0" encoding="UTF-8" ?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="urn:yahoo:jp:jlp"
 xsi:schemaLocation="urn:yahoo:jp:jlp http://jlp.yahooapis.jp/MAService/V1/parseResponse.xsd">
  <uniq_result>
    <total_count>15</total_count>
    <filtered_count>15</filtered_count>
    <word_list>
      <word>
        <count>2</count>
        <surface>。</surface>
        <reading/>
        <pos>特殊</pos>
      </word>
      <word>
        <count>2</count>
        <surface>いい</surface>
        <reading/>
        <pos>形容詞</pos>
      </word>
      <word>
        <count>2</count>
        <surface>天気</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>う</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>でしょ</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>です</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>なる</surface>
        <reading/>
        <pos>動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>に</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>は</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>も</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>今日</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>明日</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
    </word_list>
  </uniq_result>
</ResultSet>
}}

さらに、resultsパラメータを"ma,uniq"にして、通常の形態素解析の結果と出現頻度情報の結果の両方を取得したときは、以下のような結果が返されます。

#code(pre){{
#pre{{
<?xml version="1.0" encoding="UTF-8" ?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="urn:yahoo:jp:jlp"
 xsi:schemaLocation="urn:yahoo:jp:jlp http://jlp.yahooapis.jp/MAService/V1/parseResponse.xsd">
  <ma_result>
    <total_count>15</total_count>
    <filtered_count>15</filtered_count>
    <word_list>
      <word>
        <surface>今日</surface>
        <reading>きょう</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>は</surface>
        <reading>は</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>いい</surface>
        <reading>いい</reading>
        <pos>形容詞</pos>
      </word>
      <word>
        <surface>天気</surface>
        <reading>てんき</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>です</surface>
        <reading>です</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>。</surface>
        <reading>。</reading>
        <pos>特殊</pos>
      </word>
      <word>
        <surface>明日</surface>
        <reading>あした</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>も</surface>
        <reading>も</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>いい</surface>
        <reading>いい</reading>
        <pos>形容詞</pos>
      </word>
      <word>
        <surface>天気</surface>
        <reading>てんき</reading>
        <pos>名詞</pos>
      </word>
      <word>
        <surface>に</surface>
        <reading>に</reading>
        <pos>助詞</pos>
      </word>
      <word>
        <surface>なる</surface>
        <reading>なる</reading>
        <pos>動詞</pos>
      </word>
      <word>
        <surface>でしょ</surface>
        <reading>でしょ</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>う</surface>
        <reading>う</reading>
        <pos>助動詞</pos>
      </word>
      <word>
        <surface>。</surface>
        <reading>。</reading>
        <pos>特殊</pos>
      </word>
    </word_list>
  </ma_result>
  <uniq_result>
    <total_count>15</total_count>
    <filtered_count>15</filtered_count>
    <word_list>
      <word>
        <count>2</count>
        <surface>。</surface>
        <reading/>
        <pos>特殊</pos>
      </word>
      <word>
        <count>2</count>
        <surface>いい</surface>
        <reading/>
        <pos>形容詞</pos>
      </word>
      <word>
        <count>2</count>
        <surface>天気</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>う</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>でしょ</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>です</surface>
        <reading/>
        <pos>助動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>なる</surface>
        <reading/>
        <pos>動詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>に</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>は</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>も</surface>
        <reading/>
        <pos>助詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>今日</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
      <word>
        <count>1</count>
        <surface>明日</surface>
        <reading/>
        <pos>名詞</pos>
      </word>
    </word_list>
  </uniq_result>
</ResultSet>
}}

**日本語形態素解析Web APIが返す結果の説明 [#z7618d18]

results=ma の時は、形態素解析の結果がma_resultという要素で返されます。その中にあるtotal_count要素は、形態素の総数を表します。filtered_count要素は、filterリクエストパラメータにマッチした形態素の数を表します。上記の例のようにリクエスト時にfilterを指定しなかったときは、total_countとfiltered_countの数は同じになります。(filterについては、この後のリクエストパラメータの項で説明します。)

word_list要素は、形態素のリストを表します。word_list要素内には形態素の数だけword要素が含まれます。

results=ma の時はword_listの形態素の順番が元の文章のままですが、results=uniq の時は、countの多い形態素が上位に行くなど、順番が元の文章とは大きく変わります。

上記の例ではword要素内の要素は3つだけですが、リクエストパラメータによっては、最大で5つになります。results=uniq の時に返されるuniq_result要素では、さらにcount要素が加わり、最大で6つになります。

word要素内に入る可能性がある要素と、その意味を以下に表で説明します。公式サイトの説明を参考にしていますが、そちらに書かれていないことも予想で書いています。

|要素|説明|h
|surface|形態素の表記。表層形。|
|reading|形態素の読みがな。読み。ひらがなで返される。uniq_resultでは空になる。|
|pos|形態素の品詞。形容詞、形容動詞、感動詞、副詞、連体詞、接続詞、接頭辞、接尾辞、名詞、動詞、助詞、助動詞、特殊(句読点、カッコ、記号など)のいずれか。|
|baseform|形態素の基本形表記。原形。|
|feature|形態素の全情報。このフォーマットに関する説明が公式サイトに見つからないのではっきりしないが、多分次のような感じでは?&br;品詞,品詞細分類または活用形,活用型,表層形,読み,原形|
|count|同一形態素の出現数。uniq_resultの場合のみ。|

**リクエスト時に指定できるパラメータ [#j0745cb3]

以下に、リクエスト時に指定できるパラメータを表にして説明します。この説明も公式サイトの説明を参考にしていますが、そちらに書かれていないことも予想で書いています。
|パラメータ|説明|h
|appid|必須パラメータ。登録済のアプリケーションIDを指定する。|
|sentence|必須パラメータ。解析対象のテキスト。|
|results|必須パラメータ。解析結果の種類を指定する。"ma"、"uniq"、"ma,uniq"のいずれかを指定できる。|
|response|取得したい形態素の情報を指定する。省略すると、"surface,reading,pos"となる。すべての情報を取得するには、"surface,reading,pos,baseform,feature"とする。"count"は指定しなくても取得でき、指定するとエラーになる。|
|filter|結果を取得したい形態素の品詞を数字で指定する。複数指定するときは"&#x7c;"で区切る。例えば、名詞と動詞の形態素だけを取得するには、"filter=9&#x7c;10"とする。品詞の数字は以下のとおり。&br;・ 1 : 形容詞&br;・ 2 : 形容動詞&br;・ 3 : 感動詞&br;・ 4 : 副詞&br;・ 5 : 連体詞&br;・ 6 : 接続詞&br;・ 7 : 接頭辞&br;・ 8 : 接尾辞&br;・ 9 : 名詞&br;・ 10 : 動詞&br;・ 11 : 助詞&br;・ 12 : 助動詞&br;・ 13 : 特殊|
|ma_response|"results=ma,uniq"とした時に、responseパラメータの値をma_result内だけ変えたい時に使用する。|
|ma_filter|"results=ma,uniq"とした時に、filterパラメータの値をma_result内だけ変えたい時に使用する。|
|uniq_response|"results=ma,uniq"とした時に、responseパラメータの値をuniq_result内だけ変えたい時に使用する。|
|uniq_filter|"results=ma,uniq"とした時に、filterパラメータの値をuniq_result内だけ変えたい時に使用する。|
|uniq_by_baseform|"results=uniq"の時、通常は全く同一の形態素しかcountに数えないが、"uniq_by_baseform=true"にすると、baseformが同じならば同一形態素としてカウントする。例えば、"sentence=彼は走っては走る。"とした時、通常は"走っ"と"走る"を別の形態素としてカウントするが、"uniq_by_baseform=true"にするとこの2つは同じものとしてカウントされ、surfaceが"走る"の形態素のcountが2になり、"走っ"はなくなる。|

**結果を解析して表示する [#w9176b77]

結果を解析して表示する例を示します。XMLの解析にはXmlDocumentを使用します。ここでは、通常の形態素解析の結果のみを取得しています。

また、以前の例では省略していたresponseパラメータを指定して、形態素のすべての情報を取得しています。

#code(vbnet){{
'Imports System.IO
'Imports System.Net
'Imports System.Text
'Imports System.Xml

'形態素解析する文章
Dim text As String = "今日はいい天気です。明日もいい天気になるでしょう。"

'HttpWebRequestを作成する
Dim webreq As HttpWebRequest = DirectCast( _
    System.Net.WebRequest.Create( _
        "http://jlp.yahooapis.jp/MAService/V1/parse"), HttpWebRequest)
'POSTとしてデータを送信する
webreq.Method = "POST"
webreq.ContentType = "application/x-www-form-urlencoded"
'リクエストパラメータを作成する
Dim postStr As String = "appid=<あなたのアプリケーションID>&" & _
    "results=ma&" & _
    "response=surface,reading,pos,baseform,feature&" & _
    "sentence=" & Uri.EscapeUriString(text)
Dim postData As Byte() = Encoding.UTF8.GetBytes(postStr)
webreq.ContentLength = postData.Length
'データを送信する
Dim reqStrm As Stream = webreq.GetRequestStream()
reqStrm.Write(postData, 0, postData.Length)
reqStrm.Close()

'サーバーからの応答を受信するためのHttpWebResponseを取得する
Dim webres As HttpWebResponse = DirectCast(webreq.GetResponse(), HttpWebResponse)
'応答データを受信するためのStreamを取得する
Dim st As Stream = webres.GetResponseStream()
Dim sr As New StreamReader(st)
'応答データをすべて読み込む
Dim resultXml As String = sr.ReadToEnd()
'閉じる
sr.Close()
st.Close()
webres.Close()

'XmlDocumentに読み込む
Dim xmlDoc As New XmlDocument()
xmlDoc.LoadXml(resultXml)
'ルートを取得
Dim rootElm As XmlElement = xmlDoc.DocumentElement
'情報の表示
If rootElm.Name = "ResultSet" Then
    '形態素解析の結果が返されているときは、解析する
    Dim maElm As XmlElement = rootElm("ma_result")
    If maElm IsNot Nothing Then
        Console.WriteLine("===== ma_result =====")
        '形態素の総数
        Console.WriteLine("total_count:{0}", maElm("total_count").InnerText)
        'フィルタにマッチした形態素数
        Console.WriteLine("filtered_count:{0}", maElm("filtered_count").InnerText)
        Console.WriteLine()
        '形態素のリストを列挙する
        Dim wlElm As XmlElement = maElm("word_list")
        If wlElm IsNot Nothing Then
            For Each e As XmlElement In wlElm.ChildNodes
                '表記
                If e("surface") IsNot Nothing Then
                    Console.WriteLine("surface:{0}", e("surface").InnerText)
                End If
                '読みがな
                If e("reading") IsNot Nothing Then
                    Console.WriteLine("reading:{0}", e("reading").InnerText)
                End If
                '品詞
                If e("pos") IsNot Nothing Then
                    Console.WriteLine("pos:{0}", e("pos").InnerText)
                End If
                '基本形表記
                If e("baseform") IsNot Nothing Then
                    Console.WriteLine("baseform:{0}", e("baseform").InnerText)
                End If
                '全情報
                If e("feature") IsNot Nothing Then
                    Console.WriteLine("feature:{0}", e("feature").InnerText)
                End If
                Console.WriteLine()
            Next
        End If
    End If
End If
}}

#code(csharp){{
//using System;
//using System.IO;
//using System.Net;
//using System.Text;
//using System.Xml;

//形態素解析する文章
string text = "今日はいい天気です。明日もいい天気になるでしょう。";

//HttpWebRequestを作成する
HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(
    "http://jlp.yahooapis.jp/MAService/V1/parse");
//POSTとしてデータを送信する
webreq.Method = "POST";
webreq.ContentType = "application/x-www-form-urlencoded";
//リクエストパラメータを作成する
string postStr = "appid=<あなたのアプリケーションID>&" +
    "results=ma&" +
    "response=surface,reading,pos,baseform,feature&" +
    "sentence=" + Uri.EscapeUriString(text);
byte[] postData = Encoding.UTF8.GetBytes(postStr);
webreq.ContentLength = postData.Length;
//データを送信する
Stream reqStrm = webreq.GetRequestStream();
reqStrm.Write(postData, 0, postData.Length);
reqStrm.Close();

//サーバーからの応答を受信するためのHttpWebResponseを取得する
HttpWebResponse webres = (HttpWebResponse)webreq.GetResponse();
//応答データを受信するためのStreamを取得する
Stream st = webres.GetResponseStream();
StreamReader sr = new StreamReader(st);
//応答データをすべて読み込む
string resultXml = sr.ReadToEnd();
//閉じる
sr.Close();
st.Close();
webres.Close();

//XmlDocumentに読み込む
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(resultXml);
//ルートを取得
XmlElement rootElm = xmlDoc.DocumentElement;
//情報の表示
if (rootElm.Name == "ResultSet")
{
    //形態素解析の結果が返されているときは、解析する
    XmlElement maElm = rootElm["ma_result"];
    if (maElm != null)
    {
        Console.WriteLine("===== ma_result =====");
        //形態素の総数
        Console.WriteLine("total_count:{0}", maElm["total_count"].InnerText);
        //フィルタにマッチした形態素数
        Console.WriteLine("filtered_count:{0}", maElm["filtered_count"].InnerText);
        Console.WriteLine();
        //形態素のリストを列挙する
        XmlElement wlElm = maElm["word_list"];
        if (wlElm != null)
        {
            foreach (XmlElement e in wlElm.ChildNodes)
            {
                //表記
                if (e["surface"] != null)
                {
                    Console.WriteLine("surface:{0}", e["surface"].InnerText);
                }
                //読みがな
                if (e["reading"] != null)
                {
                    Console.WriteLine("reading:{0}", e["reading"].InnerText);
                }
                //品詞
                if (e["pos"] != null)
                {
                    Console.WriteLine("pos:{0}", e["pos"].InnerText);
                }
                //基本形表記
                if (e["baseform"] != null)
                {
                    Console.WriteLine("baseform:{0}", e["baseform"].InnerText);
                }
                //全情報
                if (e["feature"] != null)
                {
                    Console.WriteLine("feature:{0}", e["feature"].InnerText);
                }
                Console.WriteLine();
            }
        }
    }
}
}}

結果は、以下のようになります。

#code(pre){{
#pre{{
===== ma_result =====
total_count:15
filtered_count:15

surface:今日
reading:きょう
pos:名詞
baseform:今日
feature:名詞,名詞,*,今日,きょう,今日

surface:は
reading:は
pos:助詞
baseform:は
feature:助詞,係助詞,*,は,は,は

surface:いい
reading:いい
pos:形容詞
baseform:いい
feature:形容詞,形容,基本形,いい,いい,いい

surface:天気
reading:てんき
pos:名詞
baseform:天気
feature:名詞,名詞,*,天気,てんき,天気

surface:です
reading:です
pos:助動詞
baseform:です
feature:助動詞,助動詞です,基本形,です,です,です

surface:。
reading:。
pos:特殊
baseform:。
feature:特殊,句点,*,。,。,。

surface:明日
reading:あした
pos:名詞
baseform:明日
feature:名詞,名詞,*,明日,あした,明日

surface:も
reading:も
pos:助詞
baseform:も
feature:助詞,係助詞,*,も,も,も

surface:いい
reading:いい
pos:形容詞
baseform:いい
feature:形容詞,形容,基本形,いい,いい,いい

surface:天気
reading:てんき
pos:名詞
baseform:天気
feature:名詞,名詞,*,天気,てんき,天気

surface:に
reading:に
pos:助詞
baseform:に
feature:助詞,格助詞,*,に,に,に

surface:なる
reading:なる
pos:動詞
baseform:なる
feature:動詞,ラ五,基本形,なる,なる,なる

surface:でしょ
reading:でしょ
pos:助動詞
baseform:です
feature:助動詞,助動詞です,未然形,でしょ,でしょ,です

surface:う
reading:う
pos:助動詞
baseform:う
feature:助動詞,助動詞,*,う,う,う

surface:。
reading:。
pos:特殊
baseform:。
feature:特殊,句点,*,。,。,。
}}

"results=uniq"にして出現頻度情報の結果を取得するコードは、ほとんど上記のコードと同じになりますので紹介しませんが、その時の結果は以下のようになります。

#code(pre){{
#pre{{
===== uniq_result =====
total_count:15
filtered_count:15

count:2
surface:。
reading:
pos:特殊
baseform:。
feature:特殊,*,*,。,,。

count:2
surface:いい
reading:
pos:形容詞
baseform:いい
feature:形容詞,*,*,いい,,いい

count:2
surface:天気
reading:
pos:名詞
baseform:天気
feature:名詞,*,*,天気,,天気

count:1
surface:う
reading:
pos:助動詞
baseform:う
feature:助動詞,*,*,う,,う

count:1
surface:でしょ
reading:
pos:助動詞
baseform:です
feature:助動詞,*,*,でしょ,,です

count:1
surface:です
reading:
pos:助動詞
baseform:です
feature:助動詞,*,*,です,,です

count:1
surface:なる
reading:
pos:動詞
baseform:なる
feature:動詞,*,*,なる,,なる

count:1
surface:に
reading:
pos:助詞
baseform:に
feature:助詞,*,*,に,,に

count:1
surface:は
reading:
pos:助詞
baseform:は
feature:助詞,*,*,は,,は

count:1
surface:も
reading:
pos:助詞
baseform:も
feature:助詞,*,*,も,,も

count:1
surface:今日
reading:
pos:名詞
baseform:今日
feature:名詞,*,*,今日,,今日

count:1
surface:明日
reading:
pos:名詞
baseform:明日
feature:名詞,*,*,明日,,明日
}}

**最後に [#cefc2be6]

今年の.NETプログラミング研究はこれが最後です。今年一年お付き合いいただきありがとうございました。来年もよろしくお願いいたします。それでは皆様、良いお年を。

**コメント [#ued8a753]
#comment

//これより下は編集しないでください
#pageinfo([[:Category/.NET]] [[:Category/ASP.NET]],2010-12-20 (月) 04:04:46,DOBON!,2010-12-20 (月) 04:09:22,DOBON!)
[ トップ ]   [ 編集 | 差分 | バックアップ | 添付 | 複製 | 名前変更 | リロード ]   [ 新規 | 子ページ作成 | 一覧 | 単語検索 | 最終更新 | ヘルプ ]