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

**`class QuerySyntaxParser(config)`**

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

Parse query to separate User-Query-Terms from filter tokens.

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)`, ``"syntax_parser"`) – syntax_parser
- `input_field` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`,``"query"`) – query
- `output_user_terms` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"user_terms"`) – user terms as list
- `output_user_terms_str` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"user_terms_str"`) – user terms as str
- `output_facet_filters` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"facet_filters"`) – facet filters as list
- `output_query_length` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"query_length"`) – query length as integer
- `path` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``"."`) – schema expects path where step file is located. not used actually

Methods SummaryMethods Documentation

**`parse_query(query)`**

Parse query into:
- enrichable tokens: natural language style user terms
- non-enrichable tokens: query-syntax rules like facet filters, comparisons etc.

Parameters

`query` – Searchbar query text (contains possible squirro-query-syntax logic)

Return type

`ParsedQuery`

Returns

parsed query

**`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)
