From a0182fc7073808fcb00dcfb5ef0e5de5c1e20d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romuald=20Texier-Marcad=C3=A9?= Date: Tue, 3 Dec 2024 16:47:33 +0100 Subject: [PATCH 1/3] Phones support. --- docs/index.md | 4 ++++ setup.py | 2 +- src/uhlive/stream/recognition/events.py | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 4df9c01..583ce1d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -84,6 +84,10 @@ Also known as the human to bot (H2B) stream API. ## Changelog +### v1.6.0 + +* Support for phones. + ### v1.5.1 * API fix: `RecogResult.alternatives` now returns an empty list instead of `None`. diff --git a/setup.py b/setup.py index 7815876..6caae2e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="uhlive", - version="1.5.1", + version="1.6.0", url="https://github.com/uhlive/python-sdk", author="Allo-Media", author_email="support@allo-media.fr", diff --git a/src/uhlive/stream/recognition/events.py b/src/uhlive/stream/recognition/events.py index aec0823..006a220 100644 --- a/src/uhlive/stream/recognition/events.py +++ b/src/uhlive/stream/recognition/events.py @@ -35,6 +35,7 @@ class Transcript: def __init__(self, data: Dict[str, Any]) -> None: self._transcript: str = data["transcript"] + self._phones: str = data.get("phones", "") self._confidence: float = float(data["confidence"]) self._start = datetime.utcfromtimestamp(data["start"] / 1000.0) self._end = datetime.utcfromtimestamp(data["end"] / 1000.0) @@ -44,6 +45,11 @@ def transcript(self) -> str: """The raw ASR output.""" return self._transcript + @property + def phones(self) -> str: + """May contain the phone transcription, or empty if phones not activated.""" + return self._phones + @property def confidence(self) -> float: """The ASR transcription confidence.""" @@ -60,7 +66,7 @@ def end(self) -> datetime: return self._end def __str__(self) -> str: - return f'"{self._transcript}" ({self._confidence})' + return f'"{self._transcript}" [{self.phones}] ({self._confidence})' class Interpretation: From 21a9c5aabf26a0276986131d6de960e9497dcce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romuald=20Texier-Marcad=C3=A9?= Date: Fri, 13 Dec 2024 14:38:10 +0100 Subject: [PATCH 2/3] CI: python3 -> python --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4e8aab..0b27a87 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: - run: name: init .pypirc and build env command: | - python3 -m venv venv + python -m venv venv . venv/bin/activate pip install -U pip pip install wheel twine build From d56a1aadadef3cee1637bf20267ce498de057ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romuald=20Texier-Marcad=C3=A9?= Date: Fri, 13 Dec 2024 14:41:30 +0100 Subject: [PATCH 3/3] CI: python3 -> python --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0b27a87..5dfa7f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: - run: name: install requirements command: | - python3 -m venv venv + python -m venv venv . venv/bin/activate pip install tox pip install -e .[examples]