Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files classified as positive and negative reviews #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The dataset construction is based on the method noted in [Large movie review dat
- `ratings.txt`: All 200K reviews
- `ratings_test.txt`: 50K reviews held out for testing
- `ratings_train.txt`: 150K reviews for training
- Classified by rating
- These files have no header line and have only one column, `document`
- `reviews.pos`: Positive 100K reviews
- `reviews.neg`: Negative 100K reviews

## Characteristics

Expand All @@ -27,7 +31,7 @@ The dataset construction is based on the method noted in [Large movie review dat
- Neutral reviews (originally reviews of ratings 5-8) are excluded

## Quick peek

(files with filename beginning with `rating`)
$ head ratings_train.txt
id document label
9976970 아 더빙.. 진짜 짜증나네요 목소리 0
Expand Down
11 changes: 11 additions & 0 deletions code/classify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import csv

with open("../ratings.txt", "r", encoding="utf-8") as tsv, open("../reviews.pos", "w") as reviews_pos, open("../reviews.neg", "w") as reviews_neg:
tsv = csv.reader(tsv, delimiter='\t')

for row in tsv:
if row[2] == "1":
reviews_pos.write(row[1] +"\n")
elif row[2] == "0":
reviews_neg.write(row[1] +"\n")

Loading