Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9418

Statistical Phrase Identifier

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 7.5, 8.0
    • None
    • None

    Description

      Summary:

      The Statistical Phrase Identifier is a Solr contribution that takes in a string of text and then leverages a language model (an Apache Lucene/Solr inverted index) to predict how the inputted text should be divided into phrases. The intended purpose of this tool is to parse short-text queries into phrases prior to executing a keyword search (as opposed parsing out each keyword as a single term).

      It is being generously donated to the Solr project by CareerBuilder, with the original source code and a quickly demo-able version located here:  https://github.com/careerbuilder/statistical-phrase-identifier

      Purpose:

      Assume you're building a job search engine, and one of your users searches for the following:
      machine learning research and development Portland, OR software engineer AND hadoop, java

      Most search engines will natively parse this query into the following boolean representation:
      (machine AND learning AND research AND development AND Portland) OR (software AND engineer AND hadoop AND java)

      While this query may still yield relevant results, it is clear that the intent of the user wasn't understood very well at all. By leveraging the Statistical Phrase Identifier on this string prior to query parsing, you can instead expect the following parsing:

      _

      {machine learning}

      {and} {research and development} {Portland, OR} {software engineer} {AND} {hadoop,} {java}_

      It is then possile to modify all the multi-word phrases prior to executing the search:
      "machine learning" and "research and development" "Portland, OR" "software engineer" AND hadoop, java

      Of course, you could do your own query parsing to specifically handle the boolean syntax, but the following would eventually be interpreted correctly by Apache Solr and most other search engines:
      "machine learning" AND "research and development" AND "Portland, OR" AND "software engineer" AND hadoop AND java 

      History:

      This project was originally implemented by the search team at CareerBuilder in the summer of 2015 for use as part of their semantic search system. In the summer of 2016, Akash Mehta, implemented a much simpler version as a proof of concept based upon publicly available information about the CareerBuilder implementation (the first attached patch).  In July of 2018, CareerBuilder open sourced their original version (https://github.com/careerbuilder/statistical-phrase-identifier), and agreed to also donate the code to the Apache Software foundation as a Solr contribution. An Solr patch with the CareerBuilder version was added to this issue on September 5th, 2018, and community feedback and contributions are encouraged.

      This issue was originally titled the "Probabilistic Query Parser", but the name has now been updated to "Statistical Phrase Identifier" to avoid ambiguity with Solr's query parsers (per some of the feedback on this issue), as the implementation is actually just a mechanism for identifying phrases statistically from a string and is NOT a Solr query parser. 

      Example usage:

      (See contrib readme or configuration files in the patch for full configuration details)

      Request:

      http://localhost:8983/solr/spi/parse?q=darth vader obi wan kenobi anakin skywalker toad x men magneto professor xavier

      Response: 

      {
        "responseHeader":{
          "status":0,
          "QTime":25},
          "top_parsed_query":"{darth vader} {obi wan kenobi} {anakin skywalker} {toad} {x men} {magneto} {professor xavier}",
          "top_parsed_phrases":[
            "darth vader",
            "obi wan kenobi",
            "anakin skywalker",
            "toad",
            "x-men",
            "magneto",
            "professor xavier"],
            "potential_parsings":[{
            "parsed_phrases":["darth vader",
            "obi wan kenobi",
            "anakin skywalker",
            "toad",
            "x-men",
            "magneto",
            "professor xavier"],
            "parsed_query":"{darth vader} {obi wan kenobi} {anakin skywalker} {toad} {x-men} {magneto} {professor xavier}",
          "score":0.0}]}

       

       

      Attachments

        1. SOLR-9418.zip
          19 kB
          Akash Mehta
        2. SOLR-9418.patch
          279 kB
          Trey Grainger
        3. SOLR-9418.patch
          109 kB
          Chris M. Hostetter
        4. SOLR-9418.patch
          109 kB
          Chris M. Hostetter

        Activity

          People

            hossman Chris M. Hostetter
            mehtakash93 Akash Mehta
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: