Created
April 9, 2016 20:08
-
-
Save yuka1984/8394e47c9000fd7906c7f4ec5e6225b3 to your computer and use it in GitHub Desktop.
C#でEdge.jsを使ってrakutenMAを実行
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 EdgeJs; | |
using Newtonsoft.Json; | |
namespace RakutenMA | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var func = Edge.Func(@" | |
var RakutenMA = require('../rakutenma/rakutenma.js'); | |
var fs = require('fs'); | |
var model = JSON.parse(fs.readFileSync('rakutenma/model_ja.json')); | |
rma = new RakutenMA(model, 1024, 0.007812); // Specify hyperparameter for SCW (for demonstration purpose) | |
rma.featset = RakutenMA.default_featset_ja; | |
rma.hash_func = RakutenMA.create_hash_func(15); | |
return function(data, cb) { | |
cb(null, rma.tokenize(data)); | |
}; | |
"); | |
var result = func("彼は新しい仕事できっと成功するだろう。").Result; | |
Console.Write(JsonConvert.SerializeObject(result, Formatting.Indented)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment