extend_mapping#

ethograph.labels.converters.extend_mapping(names, mapping_path)[source]#

Name -> id for names in the mapping at mapping_path, appending any it lacks.

Existing classes keep their ids, branches and event types; a new name gets the next free id as a state class on branch 0. The file is rewritten only when a name was added, so one vocabulary serves every import format.

Returns the name -> id lookup and the names that were added.

Return type:

tuple[dict[str, int], list[str]]