Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박은주
/
Todays_Issue
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
박은주
2021-06-01 17:10:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a68f287e6c445d99595dab655427c8fbaa0e58f6
a68f287e
1 parent
30515d6a
Add files via upload
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
GetTopic.py
GetTopic.py
0 → 100644
View file @
a68f287
import
os
import
csv
from
sklearn.metrics.pairwise
import
cosine_similarity
from
sklearn.feature_extraction.text
import
TfidfVectorizer
from
sklearn.cluster
import
KMeans
from
konlpy.tag
import
Okt
okt
=
Okt
()
def
DocToNouns
(
docs
):
return
[{
'id'
:
i
,
'nouns'
:
' '
.
join
(
okt
.
nouns
(
doc
)),
}
for
i
,
doc
in
enumerate
(
docs
)]
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
posts
=
[]
with
open
(
os
.
path
.
join
(
BASE_DIR
+
'/'
,
'data.csv'
),
'r'
,
encoding
=
'utf-8-sig'
)
as
db
:
reader
=
csv
.
reader
(
db
)
for
data
in
reader
:
posts
.
append
(
data
)
nouns
=
DocToNouns
(
posts
)
print
(
nouns
)
\ No newline at end of file
Please
register
or
login
to post a comment