Skip to content

Commit

Permalink
project 2 text: updated paths in cooc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tvogels committed Dec 1, 2021
1 parent d25a8b1 commit 68d88c1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions projects/project2/project_text_classification/cooc.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/usr/bin/env python3
from scipy.sparse import *
from scipy.sparse import coo_matrix
import numpy as np
import pickle


def main():
with open('vocab.pkl', 'rb') as f:
vocab = pickle.load(f)
vocab_size = len(vocab)

data, row, col = [], [], []
counter = 1
for fn in ['pos_train.txt', 'neg_train.txt']:
for fn in ['twitter-datasets/train_pos.txt', 'twitter-datasets/train_neg.txt']:
with open(fn) as f:
for line in f:
tokens = [vocab.get(t, -1) for t in line.strip().split()]
Expand Down

0 comments on commit 68d88c1

Please sign in to comment.