-
-
Save m2pathan/f7526846b2b43e6fe570 to your computer and use it in GitHub Desktop.
NMeCabで形態素解析してみよう
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 = @"..\..\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