-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlabelling.py
More file actions
29 lines (24 loc) · 853 Bytes
/
labelling.py
File metadata and controls
29 lines (24 loc) · 853 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
28
# -*- coding: utf-8 -*-
import codecs
from chardet import detect
with codecs.open('marathi.txt', 'r', encoding='utf-8') as rr:
for line in rr:
# print line.encode('utf-8')
l = line.split("\n")
w =l[0].rstrip()
str1 = ''.join(w)
value = str1 + ',marathi' + '\n'
# print(value)
str1 = ""
with codecs.open('marathilabel.txt', 'a', encoding='utf-8') as out:
#s1 = value.decode('utf-8')
out.write(value)
out.close
#answer = str1.join('marathi')
#print str1.decode('utf-8')
#print answer.decode('utf-8')
#print('\n')
#str1 = 'marathi,'.join(s)
#encode the output
#print str1.decode('utf-8')
#print('\n')