Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020_21 J-25
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
3
Merge Requests
3
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
2020_21 J-25
2020_21 J-25
Commits
86b0714f
Commit
86b0714f
authored
Jul 09, 2021
by
Amuthini Kulatheepan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete make_test_set.py
parent
c689b584
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
36 deletions
+0
-36
Personality_prediction/make_test_set.py
Personality_prediction/make_test_set.py
+0
-36
No files found.
Personality_prediction/make_test_set.py
deleted
100644 → 0
View file @
c689b584
import
os
import
collections
import
pandas
as
pd
import
csv
import
re
DATA_DIRECTORY
=
"data"
MBTI_CLEAN_CSV_PATH
=
os
.
path
.
join
(
DATA_DIRECTORY
,
"mbti_clean.csv"
)
DIMENSIONS
=
(
"IE"
,
"NS"
,
"TF"
,
"PJ"
)
df
=
pd
.
read_csv
(
MBTI_CLEAN_CSV_PATH
)
for
dimension
in
DIMENSIONS
:
letter_1
,
letter_2
=
dimension
for
letter
in
[
letter_1
,
letter_2
]:
posts
=
[]
for
index
,
row
in
df
.
iterrows
():
if
letter
in
row
[
"type"
]:
hundred_posts
=
row
[
"posts"
]
.
split
(
"|||"
)
for
post
in
hundred_posts
:
if
(
(
"http"
in
post
)
or
(
post
==
""
)
or
(
post
==
None
)
or
(
not
re
.
search
(
"[a-zA-Z]"
,
post
))
):
# ignore deformed posts
continue
posts
.
append
(
post
)
test_csv_path
=
os
.
path
.
join
(
DATA_DIRECTORY
,
f
"test_{letter}.csv"
)
with
open
(
test_csv_path
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
writer
=
csv
.
writer
(
f
)
for
post
in
posts
:
writer
.
writerow
([
post
])
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