There are 5404 in "noslang.txt". Example
...
2mz tomorrow
2night tonight
2nite tonight
soml story of my life
ssry so sorry
...
In "test.txt"
ya right
i'll attend the class
2morow will b great
My codes:
NoSlang = open("noslang.txt")
for line in NoSlang:
slang,fulltext = map(str, line.split('\t'))
dic[slang] = fulltext.strip('\n')
file = open('test.txt').read().split("\n")
for line in file:
sline = line.split(" ")
for n,i in enumerate(sline):
if i in dic:
sline[n] = dic[i]
print ' '.join(sline)
I tried to create dictionary and replace them in sentence from "test.txt". The results showed the same, nothing change.
Any suggestion?
Expected results:
yeah right
i'll attend the class
tomorrow will be great