algorithm - Optimized search using Lookup and Search -


i have problem solve, looks quite challenging me, unable find how approach problem. have tried googling, didn't found concrete direction proceed.

i looking pointers, ideas, relevant material(s), name of algorithms etc.

problem

build list of book titles. e.g. given text "if may, laugh , live, prince charm" possible list of books be

  • if may
  • i laugh, tonight
  • laugh , live in timbackto
  • like prince charm

it desired have short list above rather long list like.

  • if i die
  • i may die tonight
  • i will be born again
  • laugh and cry
  • live like king
  • prince helen in trouble
  • the charm of living on mountain
  • ...

what available

available api library provides lookup , search service. lookup performs specific searches given title of book search provides list of books given keyword(s).

some additional constrains

  • what can make result short possible? can find optimal solution?
  • how can minimize unmatched words?
  • how can use local cashing improve search frequent sentences?

thanks

a naive solution following :

for each word in search, search matching book names.

then each candidate, compute correlation score between tokenized book title , words in search.

a basic correlation function :

public double correlation(string[] a, string[] b, int offset) {   double ret = 0.;   int maxi = math.min(a.length, b.length - offset);   for(int = 0 ; < maxi ; i++)   {     ret += a[i].equals(b[i+offset]) / maxi;   } } 

the offset parameter used in order shift robust.

then can sort book titles score.

cheers


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -