plots2 icon indicating copy to clipboard operation
plots2 copied to clipboard

Search: "query expansion" or "thesauruses" or "stemming" in full-text search

Open ebarry opened this issue 8 years ago • 6 comments

Please describe the problem (or idea)

What problem could this idea solve?

@bronwen9 and I were observing that searching for trawl, trawls, and trawling all yield different search results. This is actually a similar pattern seen in words like sample, samples, sampling.

Because we're not using a controlled vocabulary, or defining how people can tag, it's currently possible for a newcomer to search for a term, find nothing, and never know they were just a single s away from finding an entire research area.

What did you expect to see that you didn't?

We should have a way to group common variations on the term so that several closely related or common misspellings would yield the same high quality search results.

Alternatively, we could have a way to show people what similar term to what they are currently searching for might yield more results. Perhaps at the autosuggest moment where we show "similar" terms along with a "count" of how many times they are used.

We are willing to work on this manually to create lists of associated words or phrases that could assist the search on our site.

Please show us where to look

https://publiclab.org/search

What's your PublicLab.org username?

This can help us diagnose the issue:

liz, bronwen

ebarry avatar Oct 09 '18 20:10 ebarry

Hi! I think this is called "query expansion" in database terms, and there is a feature for it here:

https://dev.mysql.com/doc/refman/5.7/en/fulltext-query-expansion.html

https://en.m.wikipedia.org/wiki/Query_expansion

And word variations can be captured via "stemming" I think? https://en.m.wikipedia.org/wiki/Stemming

It looks like true stemming is not built in but maybe could be achieved through blind query expansion or another technique? https://stackoverflow.com/questions/48144890/stemming-words-in-mysql

Hmm, thesauruses were a 2010 proposal for MySQL; https://stackoverflow.com/questions/3265396/how-to-add-synonym-dictionary-to-mysql-fulltext-search . https://stackoverflow.com/questions/15777420/how-to-create-a-synonym-in-mysql#15777438

On Wed, Oct 10, 2018, 4:58 AM Liz Barry [email protected] wrote:

Please describe the problem (or idea)

What problem could this idea solve?

@bronwen9 https://github.com/bronwen9 and I were observing that searching for trawl, trawls, and trawling all yield different search results. This is actually a similar pattern seen in words like sample, samples, sampling.

Because we're not using a controlled vocabulary, or defining how people can tag, it's currently possible for a newcomer to search for a term, find nothing, and never know they were just a single s away from finding an entire research area.

What did you expect to see that you didn't?

We should have a way to group common variations on the term so that several closely related or common misspellings would yield the same high quality search results.

Alternatively, we could have a way to show people what similar term to what they are currently searching for might yield more results. Perhaps at the autosuggest moment where we show "similar" terms along with a "count" of how many times they are used.

We are willing to work on this manually to create lists of associated words or phrases that could assist the search on our site. Please show us where to look

https://publiclab.org/search What's your PublicLab.org username?

This can help us diagnose the issue:

liz, bronwen

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3666, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ262m7n2Q1RiexPLVo4TN3w0WS0Vks5ujQ3YgaJpZM4XUHxi .

jywarren avatar Oct 09 '18 22:10 jywarren

@ebarry we can use the lemmatizer gem (https://rubygems.org/gems/lemmatizer/versions/0.1.1) to reduce a word to its lemma or dictionary form and then perform the search. This would I guess definitely solve the problem.

shubhscoder avatar Jan 04 '19 10:01 shubhscoder

Whoa... Lemmatizing is like stemming? Does it work in non English text? Wow!

On Fri, Jan 4, 2019, 5:22 AM Shubham Sangamnerkar <[email protected] wrote:

@ebarry https://github.com/ebarry we can use the lemmatizer gem ( https://rubygems.org/gems/lemmatizer/versions/0.1.1) to reduce a word to its lemma or dictionary form and then perform the search. This would I guess definitely solve the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3666#issuecomment-451406191, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ_uPBQ_ZNXwGh7zNAX7X4Uj_-0Hqks5u_ysxgaJpZM4XUHxi .

jywarren avatar Jan 04 '19 14:01 jywarren

I dont think it would work in any other language other than english (unless we write our own code ). Stemming and lemmatization are a bit different, but in the end their purpose is the same. But lemmatization is more accurate as it takes into consideration various linguistic features whereas stemming would just heuristically prune the suffixes. 🙈

On Fri, Jan 4, 2019, 7:37 PM Jeffrey Warren [email protected] wrote:

Whoa... Lemmatizing is like stemming? Does it work in non English text? Wow!

On Fri, Jan 4, 2019, 5:22 AM Shubham Sangamnerkar < [email protected] wrote:

@ebarry https://github.com/ebarry we can use the lemmatizer gem ( https://rubygems.org/gems/lemmatizer/versions/0.1.1) to reduce a word to its lemma or dictionary form and then perform the search. This would I guess definitely solve the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/publiclab/plots2/issues/3666#issuecomment-451406191 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AABfJ_uPBQ_ZNXwGh7zNAX7X4Uj_-0Hqks5u_ysxgaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3666#issuecomment-451452756, or mute the thread https://github.com/notifications/unsubscribe-auth/ARofxbLWeDmCqKPd61qT6T0VzORYCQtJks5u_2A2gaJpZM4XUHxi .

shubhscoder avatar Jan 04 '19 15:01 shubhscoder

This sounds super - would you want to open a PR implementing this on our search API methods? Perhaps if we find additional lemmatizers for other languages we could insert them. In fact, perhaps if we are going to insert this code in more than one place, we should make a common method called lemmatize() and then in the future we could switch based on the user set language. Amazing resource here, thank you!

On Fri, Jan 4, 2019 at 10:24 AM Shubham Sangamnerkar < [email protected]> wrote:

I dont think it would work in any other language other than english (unless we write our own code ). Stemming and lemmatization are a bit different, but in the end their purpose is the same. But lemmatization is more accurate as it takes into consideration various linguistic features whereas stemming would just heuristically prune the suffixes. 🙈

On Fri, Jan 4, 2019, 7:37 PM Jeffrey Warren [email protected] wrote:

Whoa... Lemmatizing is like stemming? Does it work in non English text? Wow!

On Fri, Jan 4, 2019, 5:22 AM Shubham Sangamnerkar < [email protected] wrote:

@ebarry https://github.com/ebarry we can use the lemmatizer gem ( https://rubygems.org/gems/lemmatizer/versions/0.1.1) to reduce a word to its lemma or dictionary form and then perform the search. This would I guess definitely solve the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/publiclab/plots2/issues/3666#issuecomment-451406191 , or mute the thread <

https://github.com/notifications/unsubscribe-auth/AABfJ_uPBQ_ZNXwGh7zNAX7X4Uj_-0Hqks5u_ysxgaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/publiclab/plots2/issues/3666#issuecomment-451452756 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ARofxbLWeDmCqKPd61qT6T0VzORYCQtJks5u_2A2gaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3666#issuecomment-451474152, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ72djc1XXgOQUdsTwWxeBvbpY4Jpks5u_3IMgaJpZM4XUHxi .

jywarren avatar Jan 04 '19 15:01 jywarren

Yes sure I would like to work on this. This is super interesting . Thank you !

On Fri, Jan 4, 2019, 9:19 PM Jeffrey Warren [email protected] wrote:

This sounds super - would you want to open a PR implementing this on our search API methods? Perhaps if we find additional lemmatizers for other languages we could insert them. In fact, perhaps if we are going to insert this code in more than one place, we should make a common method called lemmatize() and then in the future we could switch based on the user set language. Amazing resource here, thank you!

On Fri, Jan 4, 2019 at 10:24 AM Shubham Sangamnerkar < [email protected]> wrote:

I dont think it would work in any other language other than english (unless we write our own code ). Stemming and lemmatization are a bit different, but in the end their purpose is the same. But lemmatization is more accurate as it takes into consideration various linguistic features whereas stemming would just heuristically prune the suffixes. 🙈

On Fri, Jan 4, 2019, 7:37 PM Jeffrey Warren [email protected] wrote:

Whoa... Lemmatizing is like stemming? Does it work in non English text? Wow!

On Fri, Jan 4, 2019, 5:22 AM Shubham Sangamnerkar < [email protected] wrote:

@ebarry https://github.com/ebarry we can use the lemmatizer gem ( https://rubygems.org/gems/lemmatizer/versions/0.1.1) to reduce a word to its lemma or dictionary form and then perform the search. This would I guess definitely solve the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/publiclab/plots2/issues/3666#issuecomment-451406191 , or mute the thread <

https://github.com/notifications/unsubscribe-auth/AABfJ_uPBQ_ZNXwGh7zNAX7X4Uj_-0Hqks5u_ysxgaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/publiclab/plots2/issues/3666#issuecomment-451452756 , or mute the thread <

https://github.com/notifications/unsubscribe-auth/ARofxbLWeDmCqKPd61qT6T0VzORYCQtJks5u_2A2gaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/publiclab/plots2/issues/3666#issuecomment-451474152 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AABfJ72djc1XXgOQUdsTwWxeBvbpY4Jpks5u_3IMgaJpZM4XUHxi

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/3666#issuecomment-451481916, or mute the thread https://github.com/notifications/unsubscribe-auth/ARofxawTAvgtcZeGFtbMy5uLJtnspym-ks5u_3gRgaJpZM4XUHxi .

shubhscoder avatar Jan 04 '19 17:01 shubhscoder