# Export ner.print-stream output

**URL:** <https://support.prodi.gy/t/export-ner-print-stream-output/968>\
**Category:** Uncategorized\
**Tags:** usage, ner, solved\
**Created:** [November 14, 2018, 10:40pm UTC](https://support.prodi.gy/t/export-ner-print-stream-output/968 "2018-11-14T22:40:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristiano74](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/cristiano74/32/439_2.png) [@Cristiano74](https://support.prodi.gy/u/Cristiano74)\
**Post date:** [November 14, 2018, 10:40pm UTC](https://support.prodi.gy/t/export-ner-print-stream-output/968/1 "2018-11-14T22:40:13Z")

</div>

Hi all, I’m wondering how to export the output of `ner.print-stream`to jsonl or prodigy dataset.  
I would like to use the output as validation dataset of `ner.batch-train`.

Thanks in advance

C.

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [November 14, 2018, 11:27pm UTC](https://support.prodi.gy/t/export-ner-print-stream-output/968/2 "2018-11-14T23:27:09Z")

</div>

By default, the `ner.print-stream` recipe adds formatting to output the entities in the stream nicely and coloured – but if you have a look at the recipe, you’ll see that it’s actually pretty straightforward. If you just want it to output the unformatted JSONL, you could remove the following line:

```python
printers.pretty_print_ner(stream)

```

…and replace it with:

```python
for eg in stream:
    print(json.dumps(eg))

```

You can then run the recipe in the same way you did before and pipe it to `less`, or like this to save it to a file:

```bash
ner.print-stream [... your arguments] > your_file.jsonl

```

---

<div class="post-metadata">

**Author:** ![Cristiano74](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/cristiano74/32/439_2.png) [@Cristiano74](https://support.prodi.gy/u/Cristiano74)\
**Post date:** [November 15, 2018, 9:05am UTC](https://support.prodi.gy/t/export-ner-print-stream-output/968/3 "2018-11-15T09:05:40Z")

</div>

Thanks a lot @ines ! It is exactly what I was looking for.

Just a last question: I would like to assign `--answer accept` to all examples in the exported jsonl. I can do it with `db-in` command, but there is any other way to get the same via code (I don’t find the `db-in` code to get through).

Thanks again for your support!

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [November 15, 2018, 10:25am UTC](https://support.prodi.gy/t/export-ner-print-stream-output/968/4 "2018-11-15T10:25:16Z")

</div>

Sure! The examples in the stream are regular Python dictionaries, so when you iterate over the examples, you can do:

```python
eg['answer'] = 'accept'

```

(The `db-in` code is in ` __main__.py` btw!)
