<!-- Source: https://docs.squirro.com/en/latest/api/squirro_client.topic.MLNerMixin.html -->
# MLNerMixin

**`class MLNerMixin`**

Bases: [`object`](https://docs.python.org/3.11/library/functions.html#object)

Mixin for interacting with NER groundtruths, categories, labels, and models.

Methods SummaryMethods Documentation

**`create_ner_category(project_id, groundtruth_id, category_data)`**

Create a new category.

**`create_ner_fastpass(project_id, groundtruth_id, fastpass_data)`**

Create or overwrite (upsert) the FastPass settings.

**`create_ner_groundtruth(project_id, groundtruth_data)`**

Create a new groundtruth.

**`create_ner_item_label(project_id, groundtruth_id, item_id, label_data)`**

Create a new label for a groundtruth item.

**`create_ner_label(project_id, groundtruth_id, category_id, label_data)`**

Create a new label.

**`create_ner_publish(project_id, groundtruth_id, publish_data)`**

Create and publish a new NER model.

**`create_ner_validation(project_id, groundtruth_id, validation_data)`**

Create a new NER validation.

**`delete_ner_category(project_id, groundtruth_id, category_id)`**

Delete a category.

**`delete_ner_fastpass(project_id, groundtruth_id)`**

Soft-delete the FastPass (set active = False).

**`delete_ner_groundtruth(project_id, groundtruth_id)`**

Delete a groundtruth.

**`delete_ner_item_label(project_id, groundtruth_id, item_id, item_label_id)`**

Delete a specific label from a groundtruth item.

**`delete_ner_label(project_id, groundtruth_id, category_id, label_id)`**

Delete a label.

**`delete_ner_publish(project_id, groundtruth_id, publish_id)`**

Delete a published NER model.

**`get_all_ner_publishes(project_id)`**

List all published NER models for a groundtruth.

**`get_groundtruths_ner(project_id)`**

Return all ground truth for a project in a list.

Parameters

`project_id` – Id of the Squirro project.

**`get_ner_categories(project_id, groundtruth_id)`**

List all categories under a groundtruth.

**`get_ner_category(project_id, groundtruth_id, category_id)`**

Retrieve a single category.

**`get_ner_fastpass(project_id, groundtruth_id)`**

Retrieve the active FastPass settings for this project/groundtruth.

**`get_ner_fastpass_labels(project_id, groundtruth_id, item_id, label_mapping=None, config_model=None)`**

Run FastPass inference on a single item.
Optional query parameters (e.g. label_mapping, config_model) will be forwarded.

**`get_ner_fastpass_models(project_id, groundtruth_id)`**

List all FastPass templates available for NER.

**`get_ner_groundtruth(project_id, groundtruth_id)`**

Retrieve a single groundtruth by ID.

**`get_ner_groundtruths(project_id)`**

List all groundtruths for a project.

**`get_ner_item_label(project_id, groundtruth_id, item_id)`**

Get all labels for a specific item.

**`get_ner_item_labels(project_id, groundtruth_id, user_id=None, labelled_filter=None, label_id=None, query=None, count=None, start=None)`**

List all item labels for a groundtruth, with optional filters.

**`get_ner_label(project_id, groundtruth_id, category_id, label_id)`**

Retrieve a single label.

**`get_ner_labels(project_id, groundtruth_id, category_id)`**

List all labels for a category.

**`get_ner_models(project_id)`**

List all available NER models.

**`get_ner_publishes(project_id, groundtruth_id)`**

List all published NER models for a groundtruth.

**`get_ner_validation(project_id, groundtruth_id, validation_id)`**

Retrieve a specific NER validation by ID.

**`get_ner_validation_set(project_id, groundtruth_id, params=None)`**

Get the validation set for a groundtruth.

Parameters

- `project_id` – ID of the Squirro project.
- `groundtruth_id` – ID of the groundtruth.
- `params` ([`Optional`](https://docs.python.org/3.11/library/typing.html#typing.Optional)[[`dict`](https://docs.python.org/3.11/library/stdtypes.html#dict)]) – Optional parameters to filter the validation set. These are defined in the ML API documentation.

**`get_ner_validations(project_id, groundtruth_id)`**

List all NER validations for a groundtruth.

**`update_ner_category(project_id, groundtruth_id, category_id, category_data)`**

Update an existing category.

**`update_ner_fastpass(project_id, groundtruth_id, fastpass_update)`**

Toggle only the active flag on the FastPass.

**`update_ner_fastpass_suggestion(project_id, groundtruth_id, suggestion_id, suggestion_data)`**

Process (update) a single FastPass suggestion by its ID.

**`update_ner_groundtruth(project_id, groundtruth_id, groundtruth_data)`**

Update an existing groundtruth.

**`update_ner_item_label(project_id, groundtruth_id, item_id, item_label_id, label_data)`**

Update a label on a groundtruth item.

**`update_ner_label(project_id, groundtruth_id, category_id, label_id, label_data)`**

Update an existing label.

**`update_ner_validation_exception(project_id, groundtruth_id, validation_id, exception_id, resolved)`**

Update the resolved status of a specific NER validation exception.

Parameters

- `project_id` – ID of the Squirro project.
- `groundtruth_id` – ID of the NER groundtruth.
- `validation_id` – ID of the validation run.
- `exception_id` – ID of the exception to update.
- `resolved` – Boolean indicating whether the exception is resolved.

Returns

Dictionary containing the response from the API, typically
including a success message.

Raises

[`TypeError`](https://docs.python.org/3.11/library/exceptions.html#TypeError) – If resolved parameter is not a boolean.
