-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestclass.py
More file actions
27 lines (25 loc) · 755 Bytes
/
Copy pathtestclass.py
File metadata and controls
27 lines (25 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
corpusfilepath = "/home/amisha/Desktop/sourcedata/food/"
corpusfile ="foodcorpus"
reviewfilepath="/home/amisha/Desktop/sourcedata/food/"
from nltk.tokenize import word_tokenize, sent_tokenize
import nltk
from nltk.corpus import stopwords
import os
import string
from nltk.text import Text
import pickle
import sys
from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwords
from collections import defaultdict
from string import punctuation
from heapq import nlargest
import pandas as pd
with open(reviewfilepath+"Review","r") as fine:
array = []
for line in fine:
array.append(line)
sent = [f for f in array]
for i in range (0,len(sent)-1):
print i, sent[i]
sents = sent_tokenize(sent[i])