possible solution using Python:
I think that Unicode database contains pinyin romanizations for chinese characters, but these are not included in unicodedata
module data.
however, you can use some external libraries, like cjklib, example:
# coding: UTF-8
import cjklib
from cjklib.characterlookup import CharacterLookup
c = u'好'
cjk = CharacterLookup('T')
readings = cjk.getReadingForCharacter(c, 'Pinyin')
for r in readings:
print r
output:
hāo
hǎo
hào
UPDATE
cjklib comes with an standalone cjknife
utility, which micht help. some usage is described here