It looks like you just want to save everything a user has input into a database. When there is a new input, search the database for matchese. The bigram is used to index the database for faster search. Maybe add some frequency information. It helps but I don't think it will extrapolate things that a user did not input before. Is this too much simplification from your scheme? -- Best regard hashao