poprawki
This commit is contained in:
parent
9cb993d397
commit
2787573a2c
10544
dev-0/expected.tsv
10544
dev-0/expected.tsv
File diff suppressed because it is too large
Load Diff
10544
dev-0/out.tsv
10544
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,22 @@
|
||||
import csv
|
||||
|
||||
import re
|
||||
|
||||
def makeoutput(infile, outfile):
|
||||
counter = 0
|
||||
output = []
|
||||
regex = r'paranormal|ufo|youtube|spirit'
|
||||
with open(infile) as tsvfile:
|
||||
reader = csv.reader(tsvfile, delimiter='\t')
|
||||
for row in reader:
|
||||
counter+=1
|
||||
if re.search(regex, str(row).lower()):
|
||||
output.append('1')
|
||||
else:
|
||||
output.append('0')
|
||||
|
||||
|
||||
with open(outfile, 'wt') as tsvfile:
|
||||
tsv_writer = csv.writer(tsvfile, delimiter='\t')
|
||||
for i in range(counter):
|
||||
tsv_writer.writerow('S')
|
||||
for i in output:
|
||||
tsv_writer.writerow(i)
|
||||
|
||||
makeoutput("test-A/in.tsv", "test-A/out.tsv")
|
||||
makeoutput("train/in.tsv", "train/out.tsv")
|
||||
|
10304
test-A/out.tsv
10304
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
579158
train/expected.tsv
579158
train/expected.tsv
File diff suppressed because it is too large
Load Diff
579082
train/out.tsv
579082
train/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user