'Find similar words from sentences

How could I find similar words from many sentences? I try to google but cannot find specific algorithm for this kind of problem, guess I did not enter correct keys words(tried find similar words from sentences, find similar words from articles etc).

I have a db which contain more than 5000 words, their length vary from 5~20 characters.

Words from db(example):

イオヘキソール
アミドトリゾ酸Naメグルミン
イオトロクス酸メグルミン
ルトラール
ロキソニン錠

Example of input sentences:

■11/10/21 日吉台病院
ロキソニン錠60mg
1回 1T 青の點誤を保護する業
胃炎的症状を改善する美
千葉県八街市八街ほ 385-59

I would like to find out "ロキソニン錠" in the db from these sentences, in the real world there may exist 100 sentences like these. What kind of algorithms could help me find out the words similar to the db from the sentences?

Naive solution I come up is compare the Levenshtein distance of every words of the db with every sentences one by one, but this need to take nxm times(assume comparison times of each words as constant value), do we have a faster way to get the job done? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source