nathan
nathan

Reputation: 987

Search terms on sentences with python

I have several sentences stored in MongoDB, and several dictionaries of terms (each term is composed of one or more words). I want search terms on sentences, but it is really slow to try matching for each term in each sentence, and this will be exact matching. How could I do easily to do a fuzzy matching or something like this to find my terms on sentences?

For example,

Sentence:

Ala394Thr polymorphism in the clock gene NPAS2: a circadian modifier for the risk of non-Hodgkin's lymphoma

Dictionary:

Ala394Thr | NPAS-2 | Lymphoma of Hodgkin

And the result should be:

Ala394Thr polymorphism in the clock gene NPAS2: a circadian modifier for the risk of non-Hodgkin's lymphoma

Upvotes: 1

Views: 212

Answers (1)

Derick
Derick

Reputation: 36784

I probably would suggest you have a look at dedicated search engines such as Solr or ElasticSearch. They are much better suited for this sort of task.

Have a look at https://github.com/renctan/mongo-solr on how to do this with oplog tailing.

Upvotes: 2

Related Questions