Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sejong25
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Tear of Sejong
sejong25
Commits
92d2bad3
Commit
92d2bad3
authored
Jun 27, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
단어 정보 구하는 함수들 WordReader로 따로 이동함
parent
6f871788
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
37 deletions
+45
-37
index.html
index.html
+1
-0
WordObject.js
js/WordObject.js
+2
-37
WordReader.js
js/WordReader.js
+42
-0
No files found.
index.html
View file @
92d2bad3
...
...
@@ -8,6 +8,7 @@
<script
src=
"js/Input.js"
></script>
<script
src=
"js/WordSpace.js"
></script>
<script
src=
"js/WordObject.js"
></script>
<script
src=
"js/WordReader.js"
></script>
</head>
<body>
<script
src=
"js/Main.js"
></script>
...
...
js/WordObject.js
View file @
92d2bad3
...
...
@@ -3,21 +3,10 @@ class WordObject
constructor
(
text
)
{
this
.
generationCode
=
WordSpace
.
nextWordCode
++
;
this
.
wordText
=
text
;
//this.wordText = Input.removeConVow(text);
this
.
wordTyping
=
(
function
(
_wordText
)
{
var
temp
=
0
;
for
(
var
i
=
0
;
i
<
_wordText
.
length
;
i
++
)
{
temp
+=
parseFloat
(
firstSound
(
_wordText
.
charAt
(
i
)))
+
middleSound
(
_wordText
.
charAt
(
i
))
+
lastSound
(
_wordText
.
charAt
(
i
));
}
return
temp
;
})(
this
.
wordText
);
this
.
wordGrade
=
2
<
this
.
wordTyping
&&
this
.
wordTyping
<
6
?
3
:
7
<
this
.
wordTyping
&&
this
.
wordTyping
<
11
?
2
:
12
<
this
.
wordTyping
&&
this
.
wordTyping
<
16
?
1
:
0
;
this
.
wordTyping
=
WordReader
.
getWordTyping
(
this
.
wordText
);
this
.
wordGrade
=
WordReader
.
getwordWeight
(
this
.
wordText
);
this
.
wordWeight
=
(
function
(
_wordGrade
)
{
var
temp
=
0
;
...
...
@@ -58,28 +47,4 @@ class WordObject
getWordWeight
()
{
return
this
.
wordWeight
;
}
isEqualObject
(
_generationCode
)
{
return
_generationCode
===
this
.
_generationCode
;
}
}
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
;
}
\ No newline at end of file
js/WordReader.js
0 → 100644
View file @
92d2bad3
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
;
for
(
var
i
=
0
;
i
<
stringText
.
length
;
i
++
)
{
temp
+=
parseFloat
(
firstSound
(
stringText
.
charAt
(
i
)))
+
middleSound
(
stringText
.
charAt
(
i
))
+
lastSound
(
stringText
.
charAt
(
i
));
}
return
temp
;
}
WordReader
.
getWordGrade
=
function
(
stringText
)
{
return
2
<
this
.
wordTyping
&&
this
.
wordTyping
<
6
?
3
:
7
<
this
.
wordTyping
&&
this
.
wordTyping
<
11
?
2
:
12
<
this
.
wordTyping
&&
this
.
wordTyping
<
16
?
1
:
0
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment