Label
- korus.db_util.label.crosswalk_label(conn, source_type, origin_taxonomy_id, dst_taxonomy_id, ascend=False, descend=False, always_list=False)[source]
Map a label (sound-source, sound-type tag tuple) to another taxonomy.
Wrapper for
crosswalk_label_id()
- Args:
- conn: sqlite3.Connection
Database connection
- source_type: tuple(str, str)
Sound-source, sound-type tag tuple.
- origin_taxonomy_id: int
Origin taxonomy identifier
- dst_taxonomy_id: int
Destination taxonomy identifier
- ascend: bool
Also return the labels of ancestral nodes of the mapped node(s).
- descend: bool
Also return the labels of descendant nodes of the mapped node(s).
- always_list: bool
Whether to always return a list. Default is False.
- Returns:
- mapped_label: list(tuple)
The mapped label(s).
- is_equivalent: bool
Whether the input label and the mapped label(s) may be considered equivalent.
- korus.db_util.label.crosswalk_label_id(conn, label_id, dst_taxonomy_id, ascend=False, descend=False, always_list=False)[source]
Map a single label identifier to another taxonomy.
- Args:
- conn: sqlite3.Connection
Database connection
- label_id: int
Label identifier
- dst_taxonomy_id: int
Destination taxonomy identifier
- ascend: bool
Also return the labels of ancestral nodes of the mapped node(s).
- descend: bool
Also return the labels of descendant nodes of the mapped node(s).
- always_list: bool
Whether to always return a list. Default is False.
- Returns:
- mapped_label_id: list(str)
The mapped label identifier(s).
- is_equivalent: bool
Whether the input label and the mapped label(s) may be considered equivalent.
- korus.db_util.label.crosswalk_label_ids(conn, label_id, dst_taxonomy_id, ascend=False, descend=False, always_list=False, equiv=False)[source]
Map a list of label identifiers to another taxonomy.
Same as @crosswalk_label_id, but for list inputs.
- Args:
- conn: sqlite3.Connection
Database connection
- label_id: list(int)
Label identifier
- dst_taxonomy_id: int
Destination taxonomy identifier
- ascend: bool
Also return the labels of ancestral nodes of the mapped node(s).
- descend: bool
Also return the labels of descendant nodes of the mapped node(s).
- equiv: bool
If True, only return the mapped label IDs that are 1-to-1
- Returns:
- mapped_label_id: list(str)
The mapped label identifier(s).
Get label identifiers of related nodes in the taxonomy tree.
- Args:
- conn: sqlite3.Connection
Database connection
- label_id: int, list(int)
Label identifiers
- ascend: bool
Return the labels of ancestral nodes.
- descend: bool
Return the labels of descendant nodes.
- always_list: bool
Whether to always return a list. Default is False.
- Returns:
- related_id: int
Identifiers of related nodes
- korus.db_util.label.trace_node_history(conn, node_id, dst_taxonomy_id, mode='backward')[source]
Maps a taxonomy node to an earlier taxonomy version.
- Args:
- conn: sqlite3.Connection
Database connection
- node_id: str
Sound source or sound type UUID.
- dst_taxonomy_id: int
Destination taxonomy identifier
- mode: str
backward/b: trace node history backwards in time (default)
forward/f: trace node history forward in time
- Returns:
- mapped_ids: list(str)
UUID(s) in the destination taxonomy.
- is_equivalent: bool
Whether the input node and the mapped node(s) may be considered equivalent.