Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

JavaScript algorithm to match text as closely as possible (but not identical)

  • 18-02-2015 10:12pm
    #1
    Registered Users, Registered Users 2 Posts: 2,469 ✭✭✭


    Hi there,

    Do you have any advice for a JavaScript algorithm, which searches through a database of strings of text to find multiple matches as closely related as possible to one particular string.

    For example:
    I ate a chicken

    Database:
    I think I ate bad chicken for my lunch
    I had chicken salad for breakfast
    Had I eaten breakfast, I would have felt better.

    It would be a large database and will have to repeat hundreds of times for different searches.


Comments

  • Registered Users, Registered Users 2 Posts: 11,998 ✭✭✭✭Giblet


    You would use an indexer of some sort for this, such as Solr or Elastic Search (both based on Lucene).


  • Registered Users, Registered Users 2 Posts: 1,275 ✭✭✭bpmurray


    I've never hear of fuzzy matching written in JavaScript - that sounds rather ambitious. Instead, use something like Lucene as Giblit suggested - FuzzyQuery might be what you want.


  • Registered Users, Registered Users 2 Posts: 2,015 ✭✭✭colm_c


    Depends on the overall solution, but I don't think a client side JS will be up to the job, here's a node module which might help:
    https://github.com/mattyork/fuzzy


  • Registered Users, Registered Users 2 Posts: 2,469 ✭✭✭embraer170


    Thanks all for your help, I will be doing some digging based on these references.


Advertisement