Not sure if there is any OS (Open Source) packages available. However, in theory, it is not too hard to build this kind of library. In Chinese, there are about 1300 single sounds: initial + final + tones. Each sound have group of Chinese characters, various number from 1 to 130 characters.
You may define an array of all Pinyin sounds:
string[] pinyins = new string[] {
"a:c1c2c3...", // pinyin 1 a: character1 character2...
...
"zuo:z1z2z3z4z5..." // last pinyin (1300) zuo: character character...
};
The above array is a base for your mapping Pinyin to Chinese(Chinese characters and Pinyin tones are unicode strings). Then for each Pinyin input sound, a list of characters is obtained by a function like this:
string getCharacters(string aPinyin) {
string characters = null;
foreach(string item in pinyins) {
string[] temp = item.split(':');
if (temp[0].Equals(aPinyin)) {
charaters = temp[1];
break;
}
}
return characters;
}
I wrote a JavaScipt long time ago, where I defined the relationship between Pinyin and Chinese characters. In my blog: Get Pinyin From Chinese Characters, the script can be found by view the source codes or Inspect Element in context menu. In my blog, the script is used to convert Chinese to Pinyin, but the relationship can be used as a reference.

To add smart Pinyin feature--displaying a list of words for Pinyin, this can be done by defining all the commonly used words in the similar pattern: pinyin:words.