<commit_before># Search Parser

Allow parsing search queries, using free-text, keywords and boolean operators.

## Installation

Using yarn:

```shell
yarn add search-parser
```

Using npm: 
```shell 
npm instal search-parser --save
```

## Usage

```javascript
import { parse, parseToPredicate } from 'search-parser'
```

## API

### parse(query)
Convert a query string into an array of arrays of expression objects.
Support freetext, keywords (key:value), boolean operators (AND, OR, NOT) and parenthesis.

Each expression object is in the form:
```javascript
{
  key: { condition: value }
}
```
Where ```key``` is the keyword or 'freetext' in case no given keyword.  
```condition``` is either 'include' or 'exclude' (when using NOT operator).  <commit_msg>add reference to boolean-parser docs<commit_after># Search Parser

Allow parsing search queries, using free-text, keywords and boolean operators.

## Installation

Using yarn:

```shell
yarn add search-parser
```

Using npm: 
```shell 
npm instal search-parser --save
```

## Usage

```javascript
import { parse, parseToPredicate } from 'search-parser'
```

## API

### parse(query)
Convert a query string into an array of arrays of expression objects.
Support freetext, keywords (key:value), boolean operators (AND, OR, NOT) and parenthesis.
For more information on the shapre of the nested arrays, read the documentation at [boolean-parser-js](https://github.com/riichard/boolean-parser-js).

Each expression object is in the form:
```javascript
{
  key: { condition: value }
}
```
Where ```key``` is the keyword or 'freetext' in case no given keyword.  
```condition``` is either 'include' or 'exclude' (when using NOT operator).  
{'fraction_non_alphanumeric': 0.12219598583234947, 'fraction_numerical': 0.0, 'mean_word_length': 4.668896321070235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706822', 'n_tokens_mistral': 519, 'n_tokens_neox': 485, 'n_words': 203}