Created
April 11, 2017 19:38
-
-
Save cutecycle/da0ca1e81d6cbadc5f7b37b1ab93df92 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var kuroshiro = require('kuroshiro'); | |
var japaneasy = require('japaneasy'); | |
var readline = require('readline'); | |
var async = require('async'); | |
// var ParseJapanese = require('parse-japanese'); | |
var fs = require('fs'); | |
var path = require('path'); | |
//var japanese = new ParseJapanese(); | |
var wwwjdic = new japaneasy({ | |
dictionary: "expanded-glossing", | |
encode: "UTF-8", | |
timeout: 1000, | |
language: "japanese" | |
}); | |
/* | |
var text = ''; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
process.stdin.on('data', function(chunk) { | |
text += chunk; | |
}); | |
process.stdin.on('end', function() { | |
parse(text); | |
}); | |
*/ | |
// var lines = text.split('\n'); | |
//var text = fs.readFileSync("./in.txt", "utf8"); | |
stitch = function(gloss) { | |
debugger; | |
gloss.forEach(function(element) { | |
final_text = final_text.concat(element.japanese).concat(" "); | |
final_text = final_text.concat("(").concat(element.pronunciation).concat(") - "); | |
final_text = final_text.concat(element.english).concat("\n"); | |
}, this); | |
return final_text; | |
} | |
glossSentence = function(userString, index, out_text) { | |
gloss = []; | |
debugger; | |
out_text = wwwjdic(userString[index]).then(function(result) { | |
debugger; | |
out_text = out_text.stitch(result); | |
glossSentence(userString, index++, out_text); | |
return out_text; | |
}) | |
return out_text; | |
//TODO: glossing function will use the wwwjdic function and return the text to function calling it ( basically append it onto the outstring in parse) | |
} | |
removeBlanks = function(userString) { | |
return_string = userString.filter(function(element) { | |
return (element !== ""); | |
}); | |
return return_string; | |
} | |
parse = function(text) { | |
debugger; | |
outlines = ''; | |
var outstring = ""; | |
var tree = {}; | |
var sentencelist = text.split(/\„ÄÇ|\„ÄÅ|=„Äé/); | |
sentencelist = removeBlanks(sentencelist); | |
//outstring = glossSentence(sentencelist, 0, ""); | |
wwwjdic(' おはよう、ニナです ').then(function(result) { | |
console.log(result); | |
}); | |
// sentencelist.forEach(function(element) { | |
// outstring = outstring.concat(glossSentence(element)); | |
// }, this); | |
///async.each(sentencelist, function(sentence) { wwwjdic(sentence) }, outstring); // blah = glossSentence(sentencelist[0]); | |
debugger; | |
} | |
parse("1997年10月2日には、日本国内での販売本数300万本突破記念として、アメリカ版における追加部分を逆移植した『ファイナルファンタジーVII インターナショナル』が日本国内で発売された(販売本数約64万本)。2001年12月20日には廉価版『PS one Books ファイナルファンタジーVII インターナショナル』として再発売された。2009年4月10日には『ファイナルファンタジーVII インターナショナル』がゲームアーカイブスとして配信開始された。アメリカではWindowsにも移植された。日本国内でも後に逆輸入という形でWIN英語版が販売。さらに、2012年に欧米でWindows XP以降対応として再リリースされ、2013年5月にはこのWIN英語版のテキスト文を日本語化した『ファイナルファンタジーVII インターナショナル for PC』というタイトルでダウンロード専売された(『~for PC』日本語版の詳細については『~インターナショナル』の節を参照のこと)。ひかりTVなど、クラウドゲーム(Gクラスタ)としても提供された[7][8]。") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment