Natural Language Query for .NET search-like interface in C#


features natural language interface c# library

  • pure C# NLP NER library for .NET Framework, .NET Core, Mono.
  • fast and efficient rule-based named entity recognition engine: parses natural language query, performs matching and generates top-combinations in milliseconds.
  • implements basic set of matchers for handling typical search queries
  • handles relative date phrases like "yesterday", "last week", "last month", "last year", conditions "between", "more than", "less than", "age>18", ranges like "before", "after".
  • supports matching in external indexes (like Lucene).
  • synonyms for better recognition results and ontology matching.
  • easy-to-use: includes a component that automatically configures recognizer by data table description.
  • helps users to form a query with autocomplete suggestions

examples for typical usage scenarios

  • NliDataFilter: natural language interface for SQL filter
    • illustrates how to configure recognizers by data table schema
    • scoring function for best matches
    • generates SQL WHERE by recognition results
    • useful for adding user-friendly filter to the data lists or grids
  • NliPivotTable: search-based OLAP queries to PivotData in-memory data cube
    • illustrates how to configure recognizers by PivotData object
    • scoring function for best pivot table configuration
    • generates PivotData SliceQuery by recognition results
    • result is a PivotTable object that can be used for rendering crosstab report or pivot chart

download and pricing

quick purchase process

  • 1 Choose a package
  • 2 Pay online 2Checkout.com is a worldwide leader in online payment services
  • 3 Download the package

how to use

  1. Install NReco.NLQuery nuget package
  2. Configure a recognition engine (C#):
    var tblMatchBuilder = new TableMatcherBuilder();
    tblMatchBuilder.Add(tasksTableSchema);
    var recognizer = new Recognizer(tblMatchBuilder.Build());
    
  3. Parse user's search query:
    var tokens = new Tokenizer().Parse("John closed tasks");
    var searchQuery = new TokenSequence(tokens.ToArray());
    recognizer.Recognize(searchQuery, matchesCombinationHandler);
    
  4. In matchesCombinationHandler choose best recognition with your scoring function and translate matches to formal query like SQL.
  5. Next steps:
Have a question? Feel free to ask.

online demo

NLQuery Example:
Search-based Filter for Data List
NLQuery Example:
Search-Driven Pivot Table Report Builder
NLQuery is used for SeekTable.com "Ask a question" feature.

NReco.NLQuery provides simple way to add search-based interface into your .NET business application. It was specially designed for matching business entities in context of structured data (tabular data or database, OLAP cube, text indexes).

Library is useful for: keyword-based filters for lists/grids, custom semantic search by database(s), search-driven analytics (reports by search), parse incoming messages by bots.

frequently asked questions

Traditional NL statistical parsers (like Apache OpenNLP) are good in processing unstructured natural language text but not so good when used for natural language interfaces (NLI). Main reasons are:
  • in most cases natural language interfaces don't receive complete (and correct) natural language sentences: good examples are google search queries. NLI input is actually a set of interconnected keywords and phrases; words meaning may be very specific to the context of the search query.
  • statistical parsers require training on a massive corpus of questions (queries) and desired recognition, and manual creation of such corpus for each database usually is unacceptable for number of reasons; this might be not possible at all if database content is unique for each user (for instance, in SaaS applications).
  • when a database is changed, results may become unreliable without additional re-training. It's hard to incorporate special hints and formal expressions (say, field conditions) that are very desirable for NLI in the business applications.

NLQuery was specially designed for processing natural language queries in the context of tabular data (like database). It aims to be database-independent NLI that doesn't require any training; internally NLQuery mixes formal rule-based approach for named entity recognition by ontology information (database schema, unique values) with probability approach for getting the best formal result that matches a search query.

NLQuery usage or redistribution requires a commercial license:

  • Standard per-developer license (perpetual, royalty-free).
    All developers who are working on the project that uses NLQuery need to be licensed. It is possible to purchase a license for unlimited developers.
    NOTE: this license cannot be used for SaaS applications.
  • SaaS license (perpetual, per-deployment).
    Anyone who works on the project may use NLQuery for the purpose of developing SaaS application. Each production deployment should have its own license. If you offer self-hosted (on-premise) version of SaaS application, each installation requires its own SaaS deployment license(s). It is possible to purchase SaaS license for unlimited deployments.
If you’re not sure what licenses are needed in your case, please consult our support team.

All commercial packages include 1 year subscription for email support (assistance in components usage, troubleshooting) and free component updates (including bug fixes and new features). Expired subscription can be renewed for +1 year with 50% of the full package price.

what's new

2018 Mar 19 v.1.0 release:
  • totally redeveloped engine (API is changed): more efficient and highly extensible in comparing to beta1, supports custom external matchers (for example, Lucene index)
  • full set of generic matchers: Number, Date, DateOffset, ExactPhrase, LikePhrase, ListContains, Hint, MergePhrase
  • efficient greedy algorithm for matches combinations generation
  • TableMatcherBuilder that signficantly simplifies library usage for recognition in context of tabular data. It is enough to provide data table schema and builder will configure all needed matchers automatically.
2016 Sep 02 Added advanced example NliDataFilter: generates SQL where condition by search query.
2016 Apr 28 Added advanced example NliDataFilter: generates SQL where condition by search query.
2016 Apr 19 v.1.0-beta1 (first public version):
  • Implements tokenizer and basic matchers (date, relative date, list-contains).
  • Example that recognizes films by MovieLens dataset.

more components

  • PivotData Toolkit for .NET

    .NET components for manipulating multidimensional dataset (in-memory data cube) without OLAP server, aggregating huge datasets, calculating data for pivot table / chart reports, ASP.NET pivot table builder control.

  • Recommendation Engine

    Fast collaborative filtering engine that takes users' behaviour and from that tries to find items users might like.