OSDN Git Service

IpaDic・UniDic等の形態素情報から任意の項目を取得できる拡張メソッドを追加
[nmecab/NMeCabRepo2.git] / src / LibNMeCabMMF / Extension / IpaDic / IpaDicFeatureExtension.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace NMeCab.Extension.IpaDic
6 {
7     public static class IpaDicFeatureExtension
8     {
9         /// <summary>
10         /// 品詞を取得
11         /// </summary>
12         public static string GetPartsOfSpeech(this MeCabNode node)
13         {
14             return node.GetFeatureItem(0);
15         }
16
17         /// <summary>
18         /// 品詞細分類1を取得
19         /// </summary>
20         public static string GetPartsOfSpeechSection1(this MeCabNode node)
21         {
22             return node.GetFeatureItem(1);
23         }
24
25         /// <summary>
26         /// 品詞細分類2を取得
27         /// </summary>
28         public static string GetPartsOfSpeechSection2(this MeCabNode node)
29         {
30             return node.GetFeatureItem(2);
31         }
32
33         /// <summary>
34         /// 品詞細分類3を取得
35         /// </summary>
36         public static string GetPartsOfSpeechSection3(this MeCabNode node)
37         {
38             return node.GetFeatureItem(3);
39         }
40
41         /// <summary>
42         /// 活用形を取得
43         /// </summary>
44         public static string GetConjugatedForm(this MeCabNode node)
45         {
46             return node.GetFeatureItem(4);
47         }
48
49         /// <summary>
50         /// 活用型を取得
51         /// </summary>
52         public static string GetInflection(this MeCabNode node)
53         {
54             return node.GetFeatureItem(5);
55         }
56
57         /// <summary>
58         /// 活用型を取得
59         /// </summary>
60         public static string GetOriginalForm(this MeCabNode node)
61         {
62             return node.GetFeatureItem(6);
63         }
64
65         /// <summary>
66         /// 読みを取得
67         /// </summary>
68         public static string GetReading(this MeCabNode node)
69         {
70             return node.GetFeatureItem(7);
71         }
72
73         /// <summary>
74         /// 発音を取得
75         /// </summary>
76         public static string GetPronounciation(this MeCabNode node)
77         {
78             return node.GetFeatureItem(8);
79         }
80     }
81 }