{"id":346,"date":"2014-08-04T05:03:17","date_gmt":"2014-08-03T20:03:17","guid":{"rendered":"http:\/\/www.nukoneko.info\/blog\/?p=346"},"modified":"2014-11-16T00:44:55","modified_gmt":"2014-11-15T15:44:55","slug":"nmecab%e3%81%a7%e7%8b%ac%e8%87%aa%e8%be%9e%e6%9b%b8%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%93%e3%81%a7%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/www.nukoneko.info\/blog\/?p=346","title":{"rendered":"NMeCab\u3067\u72ec\u81ea\u8f9e\u66f8\u3092\u8aad\u307f\u8fbc\u3093\u3067\u4f7f\u3046"},"content":{"rendered":"<p>\u5f62\u614b\u7d20\u89e3\u6790\u304c\u3057\u305f\u304f\u306a\u308a\u8abf\u3079\u3066\u3044\u305f\u3068\u3053\u308d\u3001MeCab\u306e.Net\u7248\u3068\u3057\u3066\u4f5c\u3089\u308c\u305f NMeCab (<a href=\"http:\/\/sourceforge.jp\/projects\/nmecab\/\" title=\"NMeCab\" target=\"_blank\">\u30b5\u30a4\u30c8<\/a>) \u3092\u898b\u3064\u3051\u305f\u3002<br \/>\n\u3053\u308c\u306b\u3001Wikipedia\u3068\u306f\u3066\u306a\u306e\u8f9e\u66f8\u3092\u8ffd\u52a0\u3057\u81ea\u5206\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3067\u5229\u7528\u3059\u308b\u307e\u3067\u306e\u8a71\u3002<br \/>\n\u74b0\u5883\u306f<br \/>\n\u3000Windows7 Pro 64bit<br \/>\n\u3000Visual Studio 2010 Pro<br \/>\n<!--more--><\/p>\n<p>\u307e\u305a\u3001Wikipedia\u3068\u306f\u3066\u306a\u306e\u8f9e\u66f8\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u305d\u306e\u305f\u3081\u306b\u3053\u3061\u3089\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<br \/>\n\u300e<a href=\"http:\/\/yukihir0.hatenablog.jp\/entry\/20110201\/1296565687\" title=\"\u30bf\u30c1\u30b3\u30de\u597d\u304d\u306a\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u30d6\u30ed\u30b0\" target=\"_blank\">MeCab\u306b\u30e6\u30fc\u30b6\u8f9e\u66f8\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/a>\u300f \u30bf\u30c1\u30b3\u30de\u597d\u304d\u306a\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u30d6\u30ed\u30b0<\/p>\n<p>\u3053\u3061\u3089\u306e\u8a18\u4e8b\u306fLinux\u5411\u3051\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u306e\u3067\u3001Windows\u3067\u306e\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u8f9e\u66f8\u3092\u4f5c\u6210\u3059\u308b<\/strong><br \/>\n\u30103. \u30e6\u30fc\u30b6\u8f9e\u66f8\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u3011\u304b\u3089<br \/>\nMecab\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3001<br \/>\nPATH\u304c<br \/>\n C:\\Program Files (x86)\\MeCab\\bin<br \/>\n\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u3066<br \/>\n\u8f9e\u66f8\u306fIPA\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u3059\u308b\u3002<br \/>\n\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3001csv\u30d5\u30a1\u30a4\u30eb\u304c\u7f6e\u3044\u3066\u3042\u308b\u5834\u6240\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmecab-dict-index -d C:\\Program Files (x86)\\MeCab\\dic\\ipadic -u hatena-keyword.dic -f utf-8 -t utf-8 hatena_userdic.csv\r\nmecab-dict-index -d C:\\Program Files (x86)\\MeCab\\dic\\ipadic -u wikipedia-keyword.dic -f utf-8 -t utf-8 wikipedia_userdic.csv\r\n<\/pre>\n<p>\u3059\u308b\u3068\u3001\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4e8c\u3064\u306e\u8f9e\u66f8\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u529b\u3055\u308c\u308b\u3002<\/p>\n<p><strong>NMeCab\u306e\u4e2d\u306b\u8f9e\u66f8\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc<\/strong><br \/>\nNMeCab\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u65e2\u306b\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u3082\u306e\u3068\u3059\u308b\u3002<br \/>\n\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u3001lib\\dic\\ipadic \u306b<br \/>\nC:\\Program Files (x86)\\MeCab\\dic\\ipadic<br \/>\n\u306e\u4e2d\u8eab\u3092\u3059\u3079\u3066\u30b3\u30d4\u30fc\u3059\u308b\u3002<br \/>\n\u3064\u3044\u3067\u306b\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u4e8c\u3064\u306e .dic \u30d5\u30a1\u30a4\u30eb\u3082 lib\\dic\\ipadic \u3078\u5165\u308c\u308b\u3002<\/p>\n<p><strong>.config\u30d5\u30a1\u30a4\u30eb\u306b\u8a2d\u5b9a\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/strong><br \/>\n\u3082\u3057 new MeCabParam(); \u306a\u3069\u3067 DicDir\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u524a\u9664\u3057\u3066\u5927\u4e08\u592b\u3067\u3059\u3002<br \/>\n\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067 App.config \u3092\u4f5c\u6210\u3057\u3066\u3044\u306a\u3044\u4eba\u306f<br \/>\n<strong>\u25cf NMeCab\u304b\u3089\u30b3\u30d4\u30fc<\/strong><br \/>\nNMeCab\u306e\u30d5\u30a9\u30eb\u30c0 -> src\\ -> WindowsFormSample\\ -> app.config<br \/>\n\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u8ffd\u52a0<br \/>\n\u53c8\u306f<br \/>\n<strong>\u25cf \u81ea\u5206\u3067\u4f5c\u6210<\/strong><br \/>\n\u3000[\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d] \u3092\u53f3\u30af\u30ea\u30c3\u30af<br \/>\n\u3000[\u8ffd\u52a0] -> [\u65b0\u3057\u3044\u9805\u76ee] -> [\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u69cb\u6210\u30d5\u30a1\u30a4\u30eb]<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u3089\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot;?&gt;\r\n&lt;configuration&gt;\r\n  &lt;configSections&gt;\r\n    &lt;sectionGroup name=&quot;applicationSettings&quot; type=&quot;System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;&gt;\r\n      &lt;section name=&quot;NMeCab.Properties.Settings&quot; type=&quot;System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; requirePermission=&quot;false&quot;\/&gt;\r\n    &lt;\/sectionGroup&gt;\r\n  &lt;\/configSections&gt;\r\n  &lt;applicationSettings&gt;\r\n    &lt;NMeCab.Properties.Settings&gt;\r\n      &lt;setting name=&quot;DicDir&quot; serializeAs=&quot;String&quot;&gt;\r\n        &lt;value&gt;..\\..\\lib\\dic\\ipadic&lt;\/value&gt;\r\n      &lt;\/setting&gt;\r\n      &lt;setting name=&quot;UserDic&quot; serializeAs=&quot;String&quot;&gt;\r\n        &lt;value&gt;hatena-keyword.dic, wikipedia-keyword.dic&lt;\/value&gt;\r\n      &lt;\/setting&gt;\r\n    &lt;\/NMeCab.Properties.Settings&gt;\r\n  &lt;\/applicationSettings&gt;\r\n&lt;\/configuration&gt;\r\n<\/pre>\n<p>\u305d\u308c\u305e\u308c\u306e value \u306e\u968e\u5c64\u306f\u4eba\u306b\u3088\u3063\u3066\u9055\u3046\u305f\u3081 ..\\ \u306e\u6570\u3092\u8abf\u6574\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\nUserDic \u306e value \u306f\u3001DicDir \u304c\u57fa\u6e96\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4e0a\u8a18\u306e\u4f8b\u3060\u3068<br \/>\n\u3000..\\..\\lib\\dic\\ipadic\\hatena-keyword.dic<br \/>\n\u304c\u53c2\u7167\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u7c21\u5358\u306a\u30bd\u30fc\u30b9\u307a\u305f\u308a\u3002\u3000..\u30d5\u30a9\u30fc\u30e0\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nusing System;\r\nusing System.Windows.Forms;\r\nusing NMeCab;\r\n\r\nnamespace post_346_nmecab\r\n{\r\n    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n        private void Form1_Load(object sender, EventArgs e)\r\n        {}\r\n\r\n        private void text_analysis()\r\n        {\r\n            try\r\n            {\r\n                string txt = &quot;&quot;;\r\n                tAnalysed.Clear();\r\n                MeCabTagger t = MeCabTagger.Create();\r\n                MeCabNode n = t.ParseToNode(tBaseString.Text);\r\n                while (n != null)\r\n                {\r\n                    if (n.CharType &gt; 0)\r\n                    {\r\n                        txt += n.Surface + &quot;\\t&quot; + n.Feature + Environment.NewLine;\r\n                    }\r\n                    n = n.Next;\r\n                }\r\n                tAnalysed.Text = txt; \r\n            }\r\n            catch (Exception e)\r\n            {\r\n                MessageBox.Show(e.ToString(), &quot;\u30a8\u30e9\u30fc\u2606&quot;, MessageBoxButtons.Yes, MessageBoxIcon.Error);\r\n                this.Close();\r\n            }\r\n        }\r\n\r\n        private void Form1_FormClosing(object sender, FormClosingEventArgs e)\r\n        {\r\n        }\r\n\r\n        private void bAnalysis_Click(object sender, EventArgs e)\r\n        {\r\n            text_analysis();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>\u3067\u3082\u3001\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u89e3\u6790\u3059\u308b\u3068\u304d\u306f\u3001\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u306b\u5bfe\u5fdc\u3055\u305b\u305f\u65b9\u304c\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u304a\u308f\u308a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f62\u614b\u7d20\u89e3\u6790\u304c\u3057\u305f\u304f\u306a\u308a\u8abf\u3079\u3066\u3044\u305f\u3068\u3053\u308d\u3001MeCab\u306e.Net\u7248\u3068\u3057\u3066\u4f5c\u3089\u308c\u305f NMeCab (\u30b5\u30a4\u30c8) \u3092\u898b\u3064\u3051\u305f\u3002 \u3053\u308c\u306b\u3001Wikipedia\u3068\u306f\u3066\u306a\u306e\u8f9e\u66f8\u3092\u8ffd\u52a0\u3057\u81ea\u5206\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3067\u5229\u7528\u3059\u308b\u307e\u3067\u306e\u8a71\u3002 \u74b0\u5883\u306f \u3000Wi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346"}],"version-history":[{"count":11,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":358,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions\/358"}],"wp:attachment":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}