-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpadding.py
More file actions
50 lines (46 loc) · 1.46 KB
/
Copy pathpadding.py
File metadata and controls
50 lines (46 loc) · 1.46 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import io
import os
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
#arr = ['negative0.csv']
max = 0
min = 0
file1 = open('/home/axp1147/Humor/Anotherbert/positiveid.txt')
line = file1.read()# Use this to read file content as a stream:
lines = line.split('\n')
for l in lines:
check = l.split(' ')
if min > len(check):
min = len(check)
if max<len(check):
max = len(check)
file1 = open('/home/axp1147/Humor/Anotherbert/negativeid.txt')
line = file1.read()# Use this to read file content as a stream:
lines = line.split('\n')
for l in lines:
check = l.split(' ')
if min > len(check):
min = len(check)
if max<len(check):
max = len(check)
file1 = open('/home/axp1147/Humor/Anotherbert/positiveid.txt')
line = file1.read()# Use this to read file content as a stream:
lines = line.split('\n')
for l in lines[0:len(lines)-1]:
check = l.split(' ')
for i in range (len(check), max):
l = l + " " + str(0)
appendFile = open('/home/axp1147/Humor/Anotherbert/positiveidpad.txt','a')
appendFile.write(l + "\n")
appendFile.close()
file1 = open('/home/axp1147/Humor/Anotherbert/negativeid.txt')
line = file1.read()# Use this to read file content as a stream:
lines = line.split('\n')
for l in lines:
check = l.split(' ')
for i in range (len(check), max):
l = l + " " + str(0)
appendFile = open('/home/axp1147/Humor/Anotherbert/negativeidpad.txt','a')
appendFile.write(l + "\n")
appendFile.close()