Module elpis.models.elan_options

Expand source code
from dataclasses import dataclass
from enum import Enum
from typing import Dict


class ElanTierSelector(Enum):
    """A class representing a method of selecting elan tiers"""

    ORDER = "tier_order"
    TYPE = "tier_type"
    NAME = "tier_name"


@dataclass
class ElanOptions:
    """A class representing options for how to extract utterance information
    from an elan file."""

    selection_mechanism: ElanTierSelector
    selection_value: str

    @classmethod
    def from_dict(cls, data: Dict[str, str]) -> "ElanOptions":
        return cls(
            selection_mechanism=ElanTierSelector(data["selection_mechanism"]),
            selection_value=data["selection_value"],
        )

    def to_dict(self) -> Dict[str, str]:
        result = dict(self.__dict__)
        result["selection_mechanism"] = self.selection_mechanism.value
        return result

Classes

class ElanOptions (selection_mechanism: ElanTierSelector, selection_value: str)

A class representing options for how to extract utterance information from an elan file.

Expand source code
@dataclass
class ElanOptions:
    """A class representing options for how to extract utterance information
    from an elan file."""

    selection_mechanism: ElanTierSelector
    selection_value: str

    @classmethod
    def from_dict(cls, data: Dict[str, str]) -> "ElanOptions":
        return cls(
            selection_mechanism=ElanTierSelector(data["selection_mechanism"]),
            selection_value=data["selection_value"],
        )

    def to_dict(self) -> Dict[str, str]:
        result = dict(self.__dict__)
        result["selection_mechanism"] = self.selection_mechanism.value
        return result

Class variables

var selection_mechanismElanTierSelector
var selection_value : str

Static methods

def from_dict(data: Dict[str, str]) ‑> ElanOptions
Expand source code
@classmethod
def from_dict(cls, data: Dict[str, str]) -> "ElanOptions":
    return cls(
        selection_mechanism=ElanTierSelector(data["selection_mechanism"]),
        selection_value=data["selection_value"],
    )

Methods

def to_dict(self) ‑> Dict[str, str]
Expand source code
def to_dict(self) -> Dict[str, str]:
    result = dict(self.__dict__)
    result["selection_mechanism"] = self.selection_mechanism.value
    return result
class ElanTierSelector (value, names=None, *, module=None, qualname=None, type=None, start=1)

A class representing a method of selecting elan tiers

Expand source code
class ElanTierSelector(Enum):
    """A class representing a method of selecting elan tiers"""

    ORDER = "tier_order"
    TYPE = "tier_type"
    NAME = "tier_name"

Ancestors

  • enum.Enum

Class variables

var NAME
var ORDER
var TYPE