Skip to content

Commit

Permalink
Implement Multilingual
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvonthenen committed Jul 9, 2024
1 parent 16f37a2 commit 97fd4e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions deepgram/clients/live/v1/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class Word(DataClassJsonMixin):
speaker: Optional[int] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
language: Optional[str] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)

def __getitem__(self, key):
_dict = self.to_dict()
Expand All @@ -66,6 +69,9 @@ class Alternative(DataClassJsonMixin):
transcript: str = ""
confidence: float = 0
words: List[Word] = field(default_factory=list)
languages: Optional[List[str]] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)

def __getitem__(self, key):
_dict = self.to_dict()
Expand Down
8 changes: 7 additions & 1 deletion deepgram/clients/prerecorded/v1/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ class Word(DataClassJsonMixin): # pylint: disable=too-many-instance-attributes
sentiment_score: Optional[float] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
language: Optional[str] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)

def __getitem__(self, key):
_dict = self.to_dict()
Expand Down Expand Up @@ -537,7 +540,7 @@ def __str__(self) -> str:


@dataclass
class Alternative(DataClassJsonMixin):
class Alternative(DataClassJsonMixin): # pylint: disable=too-many-instance-attributes
"""
The alternative information for the response.
"""
Expand All @@ -557,6 +560,9 @@ class Alternative(DataClassJsonMixin):
translations: Optional[List[Translation]] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)
languages: Optional[List[str]] = field(
default=None, metadata=dataclass_config(exclude=lambda f: f is None)
)

def __getitem__(self, key):
_dict = self.to_dict()
Expand Down

0 comments on commit 97fd4e3

Please sign in to comment.