# Bool flag not accepted in the jsonl pattern file

**URL:** <https://support.prodi.gy/t/bool-flag-not-accepted-in-the-jsonl-pattern-file/6709>\
**Category:** Uncategorized\
**Tags:** usage, ner, spacy\
**Created:** [August 3, 2023, 4:47pm UTC](https://support.prodi.gy/t/bool-flag-not-accepted-in-the-jsonl-pattern-file/6709 "2023-08-03T16:47:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HadhemiDS](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/hadhemids/32/3969_2.png) [@HadhemiDS](https://support.prodi.gy/u/HadhemiDS)\
**Post date:** [August 3, 2023, 4:47pm UTC](https://support.prodi.gy/t/bool-flag-not-accepted-in-the-jsonl-pattern-file/6709/1 "2023-08-03T16:47:34Z")

</div>

I'm using spacy config.cfg to train my model

```python
...
[nlp]
lang = "xx"
pipeline = ["ner","entity_ruler"]
disabled = []

...
[initialize.components.entity_ruler.patterns]

@readers = "srsly.read_jsonl.v1"

path = "my_patterns.jsonl"

skip = false

```

In my\_patterns.jsonl file, I wrote all the patterns using the srsly.write\_jsonl. The thing is the output file will transform all the True flag to true. Which are correct for the JSON format but not recognized by python.  
One example of pattern could be `{"label": "my_label" , "pattern": [{"LOWER": {"IN": [list of keywords]}},{"IS_SPACE": True, "OP":"?"}, {"IS_PUNCT": True, "OP": "?"}, {"IS_DIGIT": True}]}`  
This will be transformed using srsly to  
`{"label": "my_label" , "pattern": [{"LOWER": {"IN": [list of keywords]}},{"IS_SPACE": true, "OP":"?"}, {"IS_PUNCT": true, "OP": "?"}, {"IS_DIGIT": true}]}`  
And when training the model, the label is not recognized.

In the other hand, I tried to write a simple code :

```python
import spacy

# Import the Matcher

from spacy.matcher import Matcher

# Load a model and create the nlp object

nlp = spacy.load("xx_ent_wiki_sm")

# Initialize the matcher with the shared vocab

matcher = Matcher(nlp.vocab)

# Add the pattern to the matcher

pattern = [{"LOWER": {"IN": [list of keywords]}},{"IS_SPACE": True, "OP":"?"}, {"IS_PUNCT": True, "OP": "?"}, {"IS_DIGIT": True}]

matcher.add("my_label", [pattern])

# Process some text

doc = nlp("Hello, this is a keyword from the keyword list")

# Call the matcher on the doc

matches = matcher(doc)

for match_id, start, end in matches:

     print(doc[start:end])

```

This code works and can detect the keyword from the doc. But, when training the model using the config.cfg and my\_patterns.jsonl file. It is not working. How can I fix this?

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [August 4, 2023, 2:07am UTC](https://support.prodi.gy/t/bool-flag-not-accepted-in-the-jsonl-pattern-file/6709/2 "2023-08-04T02:07:50Z")

</div>

hi @HadhemiDS,

Thanks for your question.

> [@HadhemiDS](#):
>
> But, when training the model using the config.cfg and my\_patterns.jsonl file. It is not working. How can I fix this?

Your question looks specific to spaCy, not Prodigy. Could you post it on [spaCy's discussion forum](https://github.com/explosion/spacy/discussions)? This forum is for Prodigy-specific questions.

---

<div class="post-metadata">

**Author:** ![HadhemiDS](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/hadhemids/32/3969_2.png) [@HadhemiDS](https://support.prodi.gy/u/HadhemiDS)\
**Post date:** [August 4, 2023, 12:58pm UTC](https://support.prodi.gy/t/bool-flag-not-accepted-in-the-jsonl-pattern-file/6709/3 "2023-08-04T12:58:39Z")

</div>

Hi,  
Done! Thanks
