Ender Turing
Ender Turing is a solution for voice content understanding, analytics and business insights. Check enderturing.com for details.
Installation
$ pip install enderturing
For using streaming speech recognition functions, you'll also need FFmpeg installed.
Ubuntu:
$ sudo apt install ffmpeg
MacOS homebrew:
$ brew install ffmpeg
For other OS, please follow FFmpeg installation guides.
Quick Start
import asyncio
from enderturing import Config, EnderTuring, RecognitionResultFormat
# create configuration
config = Config.from_url("https://admin%40local.enderturing.com:your_password@enterturing.yourcompany.com")
et = EnderTuring(config)
# access sessions list
sessions = et.sessions.list()
print(sessions)
# get recognizer for one of configured languages
recognizer = et.get_speech_recognizer(language='en')
async def run_stream_recog(f, r, result_format):
async with r.stream_recognize(f, result_format=result_format) as rec:
text = await rec.read()
return text
# recognize specified file
loop = asyncio.get_event_loop()
task = loop.create_task(run_stream_recog("my_audio.mp3", recognizer, result_format=RecognitionResultFormat.text))
loop.run_until_complete(task)
print(task.result())
Usage
SDK contains two major parts:
- Using Ender Turing REST API
- Speech recognition
Using Ender Turing API
All API calls are accessible via an instance or EnderTuring. API methods are grouped, and each
group is a property of EnderTuring. Examples:
from enderturing import Config, EnderTuring, RecognitionResultFormat
et = EnderTuring(Config.from_env())
# access sessions list
sessions = et.sessions.list()
# working with ASR
et.asr.get_instances(active_only=True)
# accessing raw json
et.raw.create_event(caller_id='1234', event_data={"type": "hold"})
Access Configuration
To access API, you need to know an authentication key (login), authentication secret (password), and installation URL (e.g. https://enderturing.yourcompany.com/)
There are multiple ways to pass config options:
- from environmental variables (
Config.from_env()). - creating
Configwith parameters (e.g.Config(auth_key="my_login", auth_secret="my_secret"")) - using Enter Turing configuration URL (
Config.from_url())
Creating Speech Recognizer
There two options to create a speech recognizer:
If you have access to API configured:
recognizer = et.get_speech_recognizer(language='en')
If you know URL and sample rate of desired ASR instance:
from enderturing import AsrConfig, SpeechRecognizer
config = AsrConfig(url="wss://enderturing", sample_rate=8000)
recognizer = SpeechRecognizer(config)
Recognizing a File
SpeechRecognizer.recognize_file method returns an async text stream. Depending on parameters,
each line contains either a text of utterance or serialized JSON.
If you are only interested in results after recognition is complete, you can use the read() method. E.g.
async with recognizer.recognize_file("my_audio.wav", result_format=RecognitionResultFormat.text) as rec:
text = await rec.read()
If you prefer getting words and phrases as soon as they are recognized - you can
use the readline() method instead. E.g.
async with recognizer.recognize_file(src, result_format=RecognitionResultFormat.jsonl) as rec:
line = await rec.readline()
while line:
# Now line contains a json string, you can save it or do something else with it
line = await rec.readline()
Working With Multichannel Audio
If an audio file has more than one channel - by default system will recognize each channel and
return a transcript for each channel. To change the default behavior - you can use channels
parameter of SpeechRecognizer.recognize_file. Please check method documentation for details.
Sometimes an audio is stored as a file per channel, e.g., contact center call generates two files:
one for a client and one for a support agent. But for analysis, it's preferable to see transcripts
of the files merged as a dialog. In this scenario, you can use
recognizer.recognize_joined_file([audio1, audio2]).
License
Released under the MIT license.
Metadata
Release files for enderturing 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| enderturing-0.11.0.tar.gz | 21.3 kB | Without provenance | Details for enderturing-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enderturing-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for enderturing-0.11.0-py3-none-any.whl |
Total release size: 52.0 kB
Release files / enderturing-0.11.0.tar.gz
| Download URL | enderturing-0.11.0.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d3154ea1b6f1cb256f75a0d1ac3d66e629cb3f09ad1ceac933de7fd3627a0fa
|
|
BLAKE2b-256 checksum How to use checksums |
6ab681553446b9b1761e73f9f87da266e76190319feb6035cfcfc4e9de21bc73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.12 Linux/6.12.57
|
Release files / enderturing-0.11.0-py3-none-any.whl
| Download URL | enderturing-0.11.0-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d4d8e17d668b338885e894d758f19fa147915e8aac05ac0f890733c085144a9
|
|
BLAKE2b-256 checksum How to use checksums |
1cd8709f3ea30ce97f794501f9d55aa558eba667c254c510108eda0e4a219d55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.12 Linux/6.12.57
|
Security for enderturing 0.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.