I was wrong to send the above email before looking at the code first. I saw the sql statement that is updating confidence. A similar issue is discussed at [1]. The solution they suggest is to use bigint instead of int. There is another idea that just occurred to me but it's probably too costly :
Maintain two columns confidence1 and confidence2. Confidence 2 is incremented by 1 everytime confidence 1 is a multiple of 5. That is if confidence 1 of a word is 9 and when it is encountered again confidence1 becomes 10. This will fire a trigger and increments confidence2 from 1 to 2. When confidence 1 reaches a really large value, we can simply reset it without causing any problems since confidence2 will be intact. Not a permanent solution. But lowers overflow risk by 'n' times.