# Recipe for custom intent parser to train spaCy

**URL:** <https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374>\
**Category:** Uncategorized\
**Tags:** enhancement, done, spacy\
**Created:** [March 7, 2018, 9:54am UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374 "2018-03-07T09:54:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurudev](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@Gurudev](https://support.prodi.gy/u/Gurudev)\
**Post date:** [March 7, 2018, 9:54am UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374/1 "2018-03-07T09:54:45Z")

</div>

I need to train my own intent parser for spaCy and being able to do so using prodigy would be great and would save me a lot of time.

Please let me know if there is a recipe for the same. If not, is there any quick work around?

Thanks for this great tool.

---

<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:** [March 7, 2018, 11:54am UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374/2 "2018-03-07T11:54:27Z")

</div>

Hi! So I guess you’re referring to the spaCy example of training an intent parser using spaCy’s dependency parser, right?

[https://github.com/explosion/spaCy/blob/master/examples/training/train\_intent\_parser.py](https://github.com/explosion/spaCy/blob/master/examples/training/train_intent_parser.py)

The good news is, we’re currently working on getting Prodigy v1.4.0 ready (coming this week!), which will include an experimental built-in interface for dependency annotation, as well as `dep.teach` and `dep.batch-train` recipes. Those will work with any spaCy model – so you can use it to improve the default syntactic dependency parser, but also any customised version of it with different labels, like the intent parser shown in the example above The interface will look like this and will focus on one dependency at a time:

![dep_parser](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/1X/dd6706d60d919e1defa7830d07ed7d376a080290.png)

In the meantime, you might also find [this thread on annotating dependencies and relations](https://support.prodi.gy/t/anotating-relations-dependencies/125) useful. I’m outlining a few solutions for how to render dependency annotations using custom HTML interfaces.

In order to get over the “cold start problem”, you’ll still need some initial annotations to pre-train the model, so it can start making meaningful suggestions. You could bootstrap those by repurposing the manual annotation interface – similar to the [manual POS tag annotation](https://prodi.gy/demo?view_id=pos_manual):

![pos](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/1X/f1e2dafbedcf832933531560eba929ef1c8ba21e.jpg)

Instead of POS tags, you’d simply use your intents as the label set defined via `--label`. If your label set is quite small, you could also create two labels per dependency – for example, `PLACE_HEAD` and `PLACE_CHILD`. In your [custom theme settings](https://prodi.gy/docs/web-app#themes), you can also define your own colours for those labels.

When annotating in manual mode, I’d recommend only **focusing on one label at a time** – even if this means making several passes over your data. So you’d start off by doing all `PLACE` dependencies and then re-start the server and annotate all `QUALITY` dependencies. This way, your brain only has to focus on one concept at a time, which makes annotation faster and more efficient (and also less prone to human error). The manual annotation interface also “snaps” your selection to the token boundaries – this means you won’t have to worry about highlighting exact characters, and you can even double-click on single-token spans to highlight them.

The annotations you collect are stored in a simple JSON format, with a list of `"spans"` containing the highlighted spans of text, their indices and the label. So once you’re done, you can export the dataset and convert it to the format you need for pre-training your model. You’ll find more details on the formats and other specifics in the `PRODIGY_README.html`, available for download with Prodigy.

---

<div class="post-metadata">

**Author:** ![Gurudev](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@Gurudev](https://support.prodi.gy/u/Gurudev)\
**Post date:** [March 7, 2018, 3:23pm UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374/3 "2018-03-07T15:23:09Z")

</div>

Thank you so much. v1.4 will be godsend for me.

Thanks for the detailed explanation and tips as well. spaCy made NLP easy, Prodigy is making it quick.

---

<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:** [March 11, 2018, 5:53pm UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374/4 "2018-03-11T17:53:47Z")

</div>

Just released `v1.4.0`, which comes with a dependency annotation interface and (still experimental) `dep.teach`, `dep.batch-train` and `dep.train-curve` recipes! 🎉[See here](https://prodi.gy/demo?view_id=dep) for a demo of the new interface.

---

<div class="post-metadata">

**Author:** ![Gurudev](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@Gurudev](https://support.prodi.gy/u/Gurudev)\
**Post date:** [March 12, 2018, 9:36am UTC](https://support.prodi.gy/t/recipe-for-custom-intent-parser-to-train-spacy/374/5 "2018-03-12T09:36:36Z")

</div>

Thanks so much.
