Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2015104216
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장준영
2020-12-17 14:41:53 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f674d08090f80b185e76aeb87c1994632d5f2301
f674d080
1 parent
0a79a358
refactor : 프로젝트 최종 완성
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
client/.eslintcache
server/controller/calcDistance.js
client/.eslintcache
View file @
f674d08
[{"D:\\JJY\\4-2\\2015104216\\client\\src\\index.js":"1","D:\\JJY\\4-2\\2015104216\\client\\src\\App.js":"2","D:\\JJY\\4-2\\2015104216\\client\\src\\reportWebVitals.js":"3","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\header\\header.jsx":"4","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\inputBox\\inputBox.jsx":"5","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\resultBox\\resultBox.jsx":"6"},{"size":500,"mtime":499162500000,"results":"7","hashOfConfig":"8"},{"size":546,"mtime":1607869406913,"results":"9","hashOfConfig":"8"},{"size":362,"mtime":499162500000,"results":"10","hashOfConfig":"8"},{"size":367,"mtime":1607866466638,"results":"11","hashOfConfig":"8"},{"size":655,"mtime":1607869355111,"results":"12","hashOfConfig":"8"},{"size":869,"mtime":1607872379349,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"1f1vq1t",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"D:\\JJY\\4-2\\2015104216\\client\\src\\index.js",[],["27","28"],"D:\\JJY\\4-2\\2015104216\\client\\src\\App.js",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\reportWebVitals.js",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\header\\header.jsx",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\inputBox\\inputBox.jsx",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\resultBox\\resultBox.jsx",[],{"ruleId":"29","replacedBy":"30"},{"ruleId":"31","replacedBy":"32"},"no-native-reassign",["33"],"no-negated-in-lhs",["34"],"no-global-assign","no-unsafe-negation"]
\ No newline at end of file
[{"D:\\JJY\\4-2\\2015104216\\client\\src\\index.js":"1","D:\\JJY\\4-2\\2015104216\\client\\src\\App.js":"2","D:\\JJY\\4-2\\2015104216\\client\\src\\reportWebVitals.js":"3","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\header\\header.jsx":"4","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\inputBox\\inputBox.jsx":"5","D:\\JJY\\4-2\\2015104216\\client\\src\\components\\resultBox\\resultBox.jsx":"6"},{"size":500,"mtime":499162500000,"results":"7","hashOfConfig":"8"},{"size":546,"mtime":1607869406913,"results":"9","hashOfConfig":"8"},{"size":362,"mtime":499162500000,"results":"10","hashOfConfig":"8"},{"size":367,"mtime":1607866466638,"results":"11","hashOfConfig":"8"},{"size":655,"mtime":1607869355111,"results":"12","hashOfConfig":"8"},{"size":869,"mtime":1607872379349,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"1f1vq1t",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"27"},"D:\\JJY\\4-2\\2015104216\\client\\src\\index.js",[],["28","29"],"D:\\JJY\\4-2\\2015104216\\client\\src\\App.js",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\reportWebVitals.js",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\header\\header.jsx",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\inputBox\\inputBox.jsx",[],"D:\\JJY\\4-2\\2015104216\\client\\src\\components\\resultBox\\resultBox.jsx",[],["30","31"],{"ruleId":"32","replacedBy":"33"},{"ruleId":"34","replacedBy":"35"},{"ruleId":"32","replacedBy":"36"},{"ruleId":"34","replacedBy":"37"},"no-native-reassign",["38"],"no-negated-in-lhs",["39"],["38"],["39"],"no-global-assign","no-unsafe-negation"]
\ No newline at end of file
...
...
server/controller/calcDistance.js
View file @
f674d08
...
...
@@ -5,24 +5,33 @@ const db = require('../model/db');
const
{
calcDistance
}
=
require
(
'../service/calcDistance'
);
const
{
getProfanity
}
=
require
(
'../service/query'
);
const
{
standardize
,
removeSpecial
}
=
require
(
'../service/standardization'
);
const
Hangul
=
require
(
'hangul-js'
);
exports
.
calcDistance
=
async
(
req
,
res
,
next
)
=>
{
const
{
word
}
=
req
.
body
;
const
profanityList
=
await
getProfanity
();
let
rare
=
word
;
let
specialRemoved
=
removeSpecial
(
word
);
let
specialRemovedRare
=
specialRemoved
;
let
specialNotRemoved
=
word
;
rare
=
Hangul
.
disassemble
(
rare
);
rare
=
rare
.
join
(
''
);
specialRemovedRare
=
Hangul
.
disassemble
(
specialRemovedRare
);
specialRemovedRare
=
specialRemovedRare
.
join
(
''
);
specialRemoved
=
standardize
(
specialRemoved
);
specialNotRemoved
=
standardize
(
specialNotRemoved
);
const
rareResult
=
calcDistance
(
word
,
profanityList
);
const
rareResult
=
calcDistance
(
rare
,
profanityList
);
const
specialRemovedRareResult
=
calcDistance
(
specialRemovedRare
,
profanityList
);
const
specialRemovedResult
=
calcDistance
(
specialRemoved
,
profanityList
);
const
specialNotRemovedResult
=
calcDistance
(
specialNotRemoved
,
profanityList
);
const
minResult
=
Math
.
min
(
rareResult
,
specialRemovedResult
,
specialNotRemovedResult
);
const
minResult
=
Math
.
min
(
rareResult
,
specialRemovedR
areResult
,
specialRemovedR
esult
,
specialNotRemovedResult
);
if
(
minResult
<=
1
){
res
.
status
(
200
).
json
({
success
:
true
,
isProfanity
:
"욕설"
});
...
...
Please
register
or
login
to post a comment