Skip to content

Instantly share code, notes, and snippets.

@jacoyutorius
Created November 20, 2013 11:09
Show Gist options
  • Save jacoyutorius/7561475 to your computer and use it in GitHub Desktop.
Save jacoyutorius/7561475 to your computer and use it in GitHub Desktop.
NMeCabで形態素解析してみよう ref: http://qiita.com/jacoyutorius/items/7f1867ae2de0da64ec46
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