# ner.teach not filtering by label when using prodigy.serve

**URL:** <https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221>\
**Category:** Uncategorized\
**Tags:** usage, api\
**Created:** [January 16, 2018, 2:27am UTC](https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221 "2018-01-16T02:27:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/andy/32/966_2.png) [@andy](https://support.prodi.gy/u/andy)\
**Post date:** [January 16, 2018, 2:27am UTC](https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221/1 "2018-01-16T02:27:18Z")

</div>

I’ve run into a weird issue where if I run `ner.teach` using `prodigy.serve`, the label filtering does not work and I see entities of all types. If I run it from the command like like normal, the filtering does work. Any idea what’s going on? I’m including the two commands below.

```python
prodigy.serve("ner.teach", "multiuser_test", "en_core_web_sm", 
                  "LOC/LOC.jsonl", label = "LOC", port=9000)

```

```python
prodigy ner.teach multiuser_test en_core_web_sm LOC/LOC.jsonl --label LOC

```

---

<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:** [January 16, 2018, 12:35pm UTC](https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221/2 "2018-01-16T12:35:16Z")

</div>

Ah, I think I know what the problem might be: Try setting all recipe arguments as positional arguments in the order of argument annotations, and use `None` for the ones you don’t want to set, e.g.:

```python
prodigy.serve("ner.teach", "multiuser_test", "en_core_web_sm", 
              "LOC/LOC.jsonl", None, None, "LOC", port=9000)

```

The way this is currently handled is probably not ideal – the positional arguments are passed into the recipe, while the keyword arguments are used as the recipe config. Instead, `prodigy.serve` should probably allow specifying the recipe arguments as positional arguments _and_ keyword arguments, and take an optional `config` keyword argument that’s not passed into the recipe.

---

<div class="post-metadata">

**Author:** ![andy](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/andy/32/966_2.png) [@andy](https://support.prodi.gy/u/andy)\
**Post date:** [January 16, 2018, 2:25pm UTC](https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221/3 "2018-01-16T14:25:42Z")

</div>

That gives me this error:

```python
✨ ERROR: Can't find label 'L' in model en_core_web_sm

```

I can fix that by changing lines 90 and 91 of `ner.py` to

```python
        for l in label.split(","):
            if not model.has_label(l.strip()):

```

Then everything starts and it’s correctly filtered. The sidebar on the page says “L,O,C”, but it looks like that’s an easy fix in line 119.

Thanks!

---

<div class="post-metadata">

**Author:** ![andy](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/andy/32/966_2.png) [@andy](https://support.prodi.gy/u/andy)\
**Post date:** [January 19, 2018, 12:59pm UTC](https://support.prodi.gy/t/ner-teach-not-filtering-by-label-when-using-prodigy-serve/221/4 "2018-01-19T12:59:05Z")

</div>

Note that this solution then breaks regular CLI calls to `ner.teach`…
