I have a list of list of strings from which I want to convert numbers into text equivalents. eg. 2 to two
This is what result looks like:
[
['nn', 'known', 'tsutsumi', 'father', 'yasujiro', 'sow', 'seed', 'family', 'dominion'],
['un', 'secretari', 'gener', 'kofi', 'annan', 'appoint', 'special', 'repres', 'iraq', 'help', 'improv', 'commun', 'iraqi', 'leader'],
['year', '2016']
]
Here is my code:
from num2words import num2words
result=[]
with open("./Stemmingg.txt") as filer:
for line in filer:
result.append(line.strip().split())
temp=[]
for item in result:
r=num2words(item)
temp.append(r)
However, this gives me an error which says:
TypeError: type(['nn', 'known', 'tsutsumi', 'father', 'yasujiro', 'sow', 'seed', 'family', 'dominion']) not in [long, int, float]