Grepping a list of words from one file in a master database of homophones

Hello,
I am sorry if the title is confusing, but I need a script to grep a list of Names from a Source file in a Master database in which all the homophonic variants of the name are listed along with a single indexing key and store all of these in an output file. I need this because I am testing the accuracy of a Homophone algorithm which I have written.

An example will make this clear.Let us assume that the source file has the following entries:

John
Mary

and the Master file has the following

Jon<Tab>2003
Jean<Tab>2003
John<Tab>2003
Johan<Tab>2003
Johann<Tab>2003

Mary<Tab>21978
Marie<Tab>21978
Mariam<Tab>21978
Marium<Tab>21978

Each indexed entry is separated by a Space.

The output file would identify all homophones of the Word found in the master file and which are linked by the common index and store them.
The source file has around 30,00+ entries.At present I have to open both files in a text editor. Select a word in the source file and search for it in the master database, copy to clipboard and store in the Output file. Since this is a long and tedious operation, I was wondering if there is a PERL or AWK script which could do the job.
My OS is Windows and all the wonderful UNIX tools don't help.
Many thanks for your help.

Please show us what format you want to use in the output file.

So sorry I should have specified the format of the output. The structure should be as under:

keyword from source file followed by:
list of words from master along with index key

The desired out put would be as under:

John:
John<tab>word index
Jon<tab>word index
Johann<tab>word index
Jan<tab>word index

Many thanks for your interest and prompt response.

For output like this:

John(2003) : Jon Jean John Johan Johann
Mary(21978) : Mary Marie Mariam Marium

try:

awk 'FNR==NR {H[$1]=$2; L[$2]=L[$2]" "$1 ; next }
{ print $1"(" H[$1]") : "substr(L[H[$1]],2) } ' homophones names

---------- Post updated at 12:57 PM ---------- Previous update was at 12:54 PM ----------

For your listed output try:

awk 'FNR==NR {H[$1]=$2; L[$2]=L[$2]" "$1 ; next }
{ print $1":"
  for(i=split(L[H[$1]], r);i;i--)
     print r"\t"H[$1] } ' homophones names

Many thanks. Both worked and are pretty fast. The second fits into my scheme of things for further massaging the output data.