Skip to content

COVID-19-Text-Mining/autocomplete-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lib-face

How to deploy the scripts

Start local server

# compile c++ code
cd autocomplete
make COPT="-DNMAX=10"
chmod 755 lib-face

./lib-face -f rsc/keywords.tsv -p 6767
# then the script should run on localhost:6767

Query

The request format is http://localhost:6767/suggest/?n={LIMIT}&q={QUERY}.

The response format is {"l": ["Suggestion 1", "Suggestion 2", ...]}, exactly the same as the google scholar's suggestion API.


Original Intro

A very fast auto-complete server; to be used for as-you-type search suggestions.

I have written a blog post comparing various methods for implementing auto-complete for user queries.

lib-face implements Approach-4 as mentioned in the blog post. The total cost of querying (TCQ) a corpus of 'n' phrases for not more than 'k' frequently occurring phrases that share a prefix with a supplied phrase is O(k log n). This is close the best that can be done for such a requirement. lib-face also provides an option to switch to using another (faster) algorithm that results in a per-query run-time of O(k log k).

You can help by testing the new BenderRMQ data structure that has an O(n) space overhead and build cost and O(1) query cost. To read up on RMQ (Range Maximum Query), see here and here

lib-face is written using C++ and uses libuv and the joyent http-parser to serve requests.

Visit the Quick Start Guide to get started now!

See the Benchmarks!

Read the paper!

About

COVIDScholar's Autocomplete API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published