<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.apps.query_processing.QueryClassifier.html -->
# QueryClassifier

**`class QueryClassifier(config)`**

Bases: [`BatchedStep`](../technical/libnlp/steps/standard.md#squirro.lib.nlp.steps.batched_step.BatchedStep)

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

**Input** - the input field needs to be of type [`str`](https://docs.python.org/3.11/library/stdtypes.html#str).

**Output** - the output field is filled with data of type [`str`](https://docs.python.org/3.11/library/stdtypes.html#str).

Parameters

- `step` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"app"`) – app
- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"query_processing"`) – query_processing
- `name` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"query_classifier"`) – query_classifier
- `model` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"svm-query-classifier"`) – Model name
- `input_field` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"user_terms_str"`) – Field on which the query classifier gets applied
- `path` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"."`) – path
- `force_question_characters` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"?¿"`) – if query ends with one of those characters, enforce question_or_statement prediction
- `force_question_length` ([`int`](https://docs.python.org/3.11/library/functions.html#int)`, ``4`) – amount of user query terms that enforce question_or_statement prediction

Methods SummaryMethods Documentation

**`pre_session_hook()`**

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

Return type

[`None`](https://docs.python.org/3.11/library/constants.html#None)

**`process_doc(doc)`**

Process a document

Parameters

`doc` ([`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)) – Document

Returns

Processed document

Return type

[Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)

**`shortcut_question_or_statement(doc)`**
