QueryClassifier#

class QueryClassifier(config)#

Bases: BatchedStep

Step that uses ONNX model to infer the type of the query.

Input - the input field needs to be of type str.

Output - the output field is filled with data of type str.

Parameters:
  • step (str, "app") – app

  • type (str, "query_processing") – query_processing

  • name (str, "query_classifier") – query_classifier

  • model (str, "svm-query-classifier") – Model name

  • input_field (str, "user_terms_str") – Field on which the query classifier gets applied

  • path (str, ".") – path

  • force_question_characters (str, "?¿") – if query ends with one of those characters, enforce question_or_statement prediction

  • force_question_length (int, 4) – amount of user query terms that enforce question_or_statement prediction

Methods Summary

pre_session_hook()

Download and extract the model if it's not existing.

process_doc(doc)

Process a document

shortcut_question_or_statement(doc)

Methods Documentation

pre_session_hook()#

Download and extract the model if it’s not existing.

Return type:

None

process_doc(doc)#

Process a document

Parameters:

doc (Document) – Document

Returns:

Processed document

Return type:

Document

shortcut_question_or_statement(doc)#