Commit f30281f5 authored by 18손재민's avatar 18손재민

getWordGrade 함수 일부 수정.

parent 92d2bad3
......@@ -6,7 +6,7 @@ class WordObject
this.wordText = text;
//this.wordText = Input.removeConVow(text);
this.wordTyping = WordReader.getWordTyping(this.wordText);
this.wordGrade = WordReader.getwordWeight(this.wordText);
this.wordGrade = WordReader.getwordWeight(this.wordTyping);
this.wordWeight = (function(_wordGrade)
{
var temp = 0;
......
var WordReader = WordReader || {};
//초성의 타수를 반환함
function firstSound(charText)
{
var r = parseInt(((charText.charCodeAt(0) - parseInt('0xac00',16)) /28) / 21);
//쌍자음일 경우
if(r === 1 || r === 4 || r === 8 || r === 10 || r === 13) return 1.3;
else return 1;
}
//중성의 타수를 반환함
function middleSound(charText)
{
var r = parseInt(((charText.charCodeAt(0)- parseInt('0xac00',16)) / 28) % 21);
//'ㅒ' 또는 'ㅖ'일 경우
if(r === 3 || r === 7) return 1.3;
//조합된 모음일 경우
else if(r === 9 || r === 10 || r === 11 || r === 14 || r === 15 || r === 16 || r === 19) return 2;
else return 1;
}
//종성의 타수를 반환함
function lastSound(charText)
{
var r = parseInt((charText.charCodeAt(0) - parseInt('0xac00',16)) % 28);
//쌍자음일 경우
if(r === 2 || r === 20) return 1.3;
//없을 경우
else if(r === 0) return 0;
//조합된 자음일 경우
else if(r === 3 || r === 5 || r === 6 || r === 9 || r === 10 || r === 11 || r === 12 || r === 13 || r === 14 || r === 15 || r === 18) return 2;
else return 1;
}
//입력 받은 단어의 타수를 반환함
WordReader.getWordTyping = function(stringText)
{
var temp = 0;
......@@ -34,9 +44,10 @@ WordReader.getWordTyping = function(stringText)
return temp;
}
WordReader.getWordGrade = function(stringText)
//입력 받은 단어의 등급을 반환함
WordReader.getWordGrade = function(_wordTyping)
{
return 2 < this.wordTyping && this.wordTyping < 6 ? 3 :
7 < this.wordTyping && this.wordTyping < 11 ? 2 :
12 < this.wordTyping && this.wordTyping < 16 ? 1 : 0;
return 2 < _wordTyping && _wordTyping < 6 ? 3 :
7 < _wordTyping && _wordTyping < 11 ? 2 :
12 < _wordTyping && _wordTyping < 16 ? 1 : 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment