Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김지훈
/
3line
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김지훈
2016-11-12 13:50:46 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
77562572cdd74a52fac2ba698f9ea1bffb67cca5
77562572
2 parents
70692b92
869c6b8c
Merge branch 'master' of
https://github.com/GodofKim/3line
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
23 deletions
Server/package.json
Server/routes/index.js
Server/views/index.jade
Server/package.json
View file @
7756257
...
...
@@ -14,7 +14,7 @@
"jade"
:
"~1.11.0"
,
"mecab-ya"
:
"^0.1.1"
,
"morgan"
:
"~1.7.0"
,
"multiset-jaccard"
:
"^0.1.
1
"
,
"multiset-jaccard"
:
"^0.1.
2
"
,
"node-readability"
:
"^2.2.0"
,
"serve-favicon"
:
"~2.3.0"
,
"textrank-node"
:
"^0.1.9"
...
...
Server/routes/index.js
View file @
7756257
...
...
@@ -24,8 +24,6 @@ router.get('/', function(req, res, next) {
async
.
each
(
sentences
,
function
(
sentence_2
,
callback_2
)
{
mecab
.
nouns
(
sentence
,
function
(
err
,
result
)
{
mecab
.
nouns
(
sentence_2
,
function
(
err
,
result_2
)
{
console
.
log
(
"result : "
,
result
);
console
.
log
(
"result2: "
,
result_2
);
var
index
=
jaccard
.
index
(
result
,
result_2
);
sentenceSimilarity
.
push
(
index
);
callback_2
();
...
...
@@ -39,9 +37,12 @@ router.get('/', function(req, res, next) {
},
// 3rd param is the function to call when everything's done
function
(
err
){
//
All tasks are done now
//
그래프를 얻었으니 텍스트랭크를 돌린다.
var
Rank
=
ranker
.
getTextRank
(
graph
).
probabilityNodes
;
// 가장 영향력이 큰 노드 세 개를 취한다.
var
selectedIndex
=
ranker
.
getSelectedIndex
(
Rank
,
3
);
// 문장의 순서대로 정렬하는 게 문맥상 자연스러운 듯.
selectedIndex
.
sort
();
var
result
=
''
;
for
(
var
i
=
0
;
i
<
3
;
i
++
){
for
(
var
j
=
0
;
j
<
sentences
.
length
;
j
++
){
...
...
@@ -58,23 +59,5 @@ router.get('/', function(req, res, next) {
});
// 다른 요약기에 비해 얼마나 성능 향상이 있었는지 확인하기 위함.
router
.
get
(
'/read'
,
function
(
req
,
res
,
next
)
{
read
(
'http://news.naver.com/main/read.nhn?mode=LSD&mid=shm&sid1=104&sid2=232&oid=421&aid=0002379859'
,
function
(
err
,
article
,
meta
)
{
// Title
console
.
log
(
article
.
title
);
// Main Article
console
.
log
(
article
.
content
);
res
.
json
({
title
:
article
.
title
,
content
:
article
.
content
},
function
(){
// Close article to clean up jsdom and prevent leaks
article
.
close
();
});
});
});
module
.
exports
=
router
;
...
...
Server/views/index.jade
View file @
7756257
...
...
@@ -2,4 +2,4 @@ extends layout
block content
h1= title
p
Welcome to #{title}
p
Redesigned by 3Line
...
...
Please
register
or
login
to post a comment