Created
November 20, 2013 11:09
-
-
Save jacoyutorius/7561475 to your computer and use it in GitHub Desktop.
NMeCabで形態素解析してみよう ref: http://qiita.com/jacoyutorius/items/7f1867ae2de0da64ec46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using NMeCab; | |
namespace NMecabTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
try | |
{ | |
string sentence = ""; | |
MeCabParam param = new MeCabParam(); | |
param.DicDir = @"..\..\lib\dic\ipadic"; | |
MeCabTagger t = MeCabTagger.Create(param); | |
MeCabNode node = t.ParseToNode(sentence); | |
while (node != null) | |
{ | |
if (node.CharType > 0) | |
{ | |
Console.WriteLine(node.Surface + "\t" + node.Feature); | |
} | |
node = node.Next; | |
} | |
Console.WriteLine(); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} | |
finally | |
{ | |
Console.Read(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment