# parser_generator

Python API: `depthai_nodes.node.parser_generator`

## Classes

### ParserGenerator

General interface for instantiating parsers based on the provided model archive.

The `build` method creates parsers based on the head information stored in the NN Archive. The method then returns a dictionary of
these parsers.

#### Methods

##### build

```python
def build(nnArchive: dai.NNArchive, headIndex: int | None = None, hostOnly: bool = False) -> dict:
```

Instantiate parser nodes for the supplied model archive.

Parameters

 * `nnArchive` (`dai.NNArchive`): Model archive describing the parser configuration.
 * `headIndex` (`int | None`): Optional model head index to instantiate. If omitted, parsers are created for all heads.
 * `hostOnly` (`bool`): If True, use parser implementations from depthai-nodes. Otherwise, always use native DepthAI parser nodes.

Returns

 * `dict`: Mapping of model head index to parser node.

Raises

 * `ValueError`: If the archive has no heads, a requested parser is unavailable, or required model geometry is invalid.
 * `IndexError`: If `headIndex` is outside the archive head list.

##### run

```python
def run(self):
```

No-op required by `dai.node.ThreadedHostNode`.

#### Attributes

##### DETECTION_PARSERS

##### HOST_PARSER_ALIASES
