14 May 2007 18:40
Re: [poedit-users] word count in PO files
Hi Tibor,
Based on what you sent I did something in Python, could probably be done
better if I know how to use the "re" module, but anyhow it is close enough.
I copied the poedit list in case others are interested in this too or
maybe someone could create this a patch for poEdit to have something
like this as tool/menu option.
Best regards
Werner
Python version:
pofile = file(r'some.po', 'r')
wordcount = 0
charcount = 0
netcharcount = 0
nottocount = '0123456789-=.,;:'
for line in pofile:
if line[0:6] == 'msgid ':
text = line[7:]
for x in nottocount:
text = text.replace(x, '')
wordcount += len(text.split())
charcount += len(text)
netcharcount += len(text.replace(' ', ''))
(Continue reading)
RSS Feed