Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
Gather only the necessary facts for documentaries by e-filtering videos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TMP-23-384
Gather only the necessary facts for documentaries by e-filtering videos
Commits
d472f3e1
Commit
d472f3e1
authored
Oct 27, 2023
by
Kavindu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
important word capture func commit
parent
704afb83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
Objective_3/test.py
Objective_3/test.py
+18
-1
No files found.
Objective_3/test.py
View file @
d472f3e1
...
...
@@ -12,4 +12,21 @@ with open('data/test1.txt') as file:
count_vect
=
CountVectorizer
(
stop_words
=
stopwords
.
words
(
'english'
),
lowercase
=
True
)
x_counts
=
count_vect
.
fit_transform
(
corpus
)
x_counts
.
todense
()
\ No newline at end of file
x_counts
.
todense
()
x
=
count_vect
.
get_feature_names
()
print
(
x
)
tfidf_transformer
=
TfidfTransformer
()
x_tfidf
=
tfidf_transformer
.
fit_transform
(
x_counts
)
dimension
=
1
lda
=
LDA
(
n_components
=
dimension
)
lda_array
=
lda
.
fit_transform
(
x_tfidf
)
lda_array
components
=
[
lda
.
components_
[
i
]
for
i
in
range
(
len
(
lda
.
components_
))]
features
=
count_vect
.
get_feature_names
()
important_words
=
[
sorted
(
features
,
key
=
lambda
x
:
components
[
j
][
features
.
index
(
x
)],
reverse
=
True
)[:
3
]
for
j
in
range
(
len
(
components
))]
print
(
important_words
)
\ 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