Search code examples
javasearchnlpopennlpsearch-suggestion

Search Engine suggestion - link (form complete)


I need to create search engine in my app. When user types e.g. "Buy 100 White Batman T-shirts", it should automatically open page with filled inputs (Page Buy -> Article: Batman T-shirt, Qty: 100, Color: White).

Also, if user types "Buy", it should be some suggestions like "Buy " or similar..

I was trying to accomplish that wit NLP (Apache openNLP + english language), but I can't figure it out completely. Any suggestions, what should I use and which approach should I take?


Solution

  • it seems there're 2 different requirements here: one is sort of natural language understanding (NLU) of the user intent, in other words you want to capture that when the user types "buy xxx yyy" he wants to "buy" xxx pieces of yyy and therefore drive him to appropriate page with all relevant information filled in (e.g. an ecommerce chart filled with 100 white t-shirts).

    Apart from this simple example, that's not straightforward in general and Apache OpenNLP doesn't provide an OOTB NLU capabilities. What OpenNLP can provide in this context is POS tagging, Parsing and NER models to: assign parts of speech to tokens (buy is a verb, 100 is a number, white is an adjective, etc.) build a parse tree so that you can look for VERB NUMBER NOUN PHRASE patterns in queries, and additionally attach named entities that recognize products so that you can directly add them to the cart (e.g. in ecommerce use case).

    For the second requirement (suggestion) you can use OpenNLP language model capabilities.

    All the above tools are described in http://opennlp.apache.org/docs/1.8.2/manual/opennlp.html