Symbl.ai is a general purpose, domain agnostic, cross channel Conversation Intelligence API platform that works for obtaining transcripts, analyzing contextual insights in multi-channel conversations, in streaming voice, video, message or broadcast real-time contexts.

With Symbl.ai developers are empowered to transform those channels digitally with the introduction of new layers of continuously deployed Artificial Intelligence models built to drive real-time engagement on Unix kernels of any type, including Ubuntu!

Python3 on a Local Programming Environment with Ubuntu 20.04

Automating speech recognition within an instance of Ubuntu on a local programming environment with Python3 requires a cloud such as Digital Ocean. To deploy an instance of Ubuntu on Digital Ocean, 1) sign up on the DigitalOcean new account registration page, 2) set up a droplet, choose the image entitled Ubuntu 20.04×64, 3) choose a plan, set up SSH, name the droplet, until finally clicking “Create Droplet” whereafter DO provides you with the IP address of your droplet. After copying the IP address, securely connect with the droplet through your terminal by executing the following command via SSH as a root user:

ssh root@your_IP_address

Setting up Python 3

Upon login to your new instance of Ubuntu on Digital Ocean with SSH, your next step is to configure Python3 to run on your instance of Ubuntu. The next few steps rely upon the command line. Open the command line Terminal by clicking on the search button in the upper-left hand corner of your screen or by pressing theCTRL, ALT, and Ttogether at the same time. Ubuntu 20.04 ships with Python3 pre-installed. To ensure your version of Python3 is updated, you run a command against the package manager with apt (i.e., Advanced Packaging Tool). If you are a macOS user who is familiar with Brew (i.e., “the missing package manager for macOS), then you are already familiar with the basic functionality of apt. The following few commands are designed to update your packages:

sudo apt update  sudo apt -y upgrade

Upon completion the next step is to check the version of Python3 your instance of Ubuntu has:

python3 -V

Ensure that you have the latest version of Python3. The next step is to add the pip command. The command is absolutely essential to installing or managing programming packages for Python.

sudo apt install -y python3-pip

With the pip command now installed into your version of Python3, you’re ready to add, remove or modify Python packages from your project as you see fit. You could run pip3 install package_name, for instance, to add packages like pandas by running pip3 install pandas, numpy by running pip3 install numpy, or matplotlib by running pip3 install matplotlib, where you’re able Last but not least is to install build essentials such as the GNU debugger, g++/GNU compiler collection, G++, dpkg-dev, or GCC (i.e., for transforming languages like Python3 into machine readable I/Os). In addition to build essentials are development tools such as OpenSSL project’s implementation of the SSL and TLS cryptographic protocols for secure communication over the Internet or the Foreign Function Interface library (i.e., for communications with the compiler). After installing packages specific to the compiler available on your instance of Ubuntu, you add a command for installing header files you need to build Python extensions.

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

Setting up a Virtual Environment in Ubuntu’s Terminal

Since Python has its own unique way of downloading, storing, and resolving packages (or modules), its virtual environments are designed to isolate projects so that modules do not unintentionally cross pollinate the dependencies of one project with another.  You add the  venv module as part of the standard Python 3 library for creating virtual environments in the following way:

sudo apt-get install -y python3-venv

Without any fanfare or exaggeration, a project is merely a localized root directory with folders containing scripts so creating “environments” entails not much more than issuing a few commands from #!Shebang!

mkdir environments cd environments

After creating the directory where you will store your environment, the next step is to initiate the environment inside of the /environments directory with the following Python3 command:

python3 -m venv asr_env

With the asr_env set up to run Python3, the next step is to perform a sanity check with the #!Shebang ls command in the following way:

ls asr_env

If the asr_env’s output is the following, then the environment is properly set up:

bin include lib lib64 pyvenv.cfg share

Last but not least is the step to activate

source asr_env/bin/activate

Upon activation your environment displays a precursor in your environment’s namesake:

(asr_env) symblai@symblai: ~/environments$

With these steps in place, the next step is to create scripts in Nano with Symbl.ai’s Python SDK for automating speech recognition on Ubuntu.

Automating Speech Recognition on Ubuntu in Nano with Symbl.ai’s Python SDK

The ability to create instances of Linux distributions such as Ubuntu on droplets of Digital Ocean empowers developers with the ability to expand the number of operating systems with which to create brand new experiences for conversations, be they on macOS, Windows, or your favorite Linux distribution. Symbl.ai’s Conversation Intelligence API platform operates anywhere APIs operate, extending beyond merely automating the process of detecting speech events asynchronously or in real-time to granulized analysis of speech in general. Symbl.ai’s speech recognition APIs come as part of its overall Conversation Intelligence API platform where action-items, follow-ups, questions, topics, or sentiment analysis. Among the tools available for developers is Symbl.ai’s Python SDK.

How to Sign up for a Free Account with Symbl.ai

Register for an account at Symbl (i.e., https://platform.symbl.ai/). Grab both your appId and your appSecret. With both of those you should authenticate either with a cURL command or with Postman so that you receive your x-api-key. Here is an example with cURL:

Nano

With the account credentials you need for running Symbl.ai’s Python SDK you create a script in Nano for analysing recorded calls.

Script

Create a new file called asr_recorded_call with the following command:

(asr_env) symblai@symblai: ~/environments$ nano asr_recorded_call.py

In your asr_recorded_call.py script add the following

import symbl recording_url = input("Enter your recording_url: ") print(recording_url) payload = { 'url':'recording_url', } credentials={app_id: <app_id>, app_secret: <app_secret>} conversation = symbl.Audio.process_url(payload=payload, credentials=credentials) response = conversation.get_messages(parameters={'sentiment': True}) timestamps, polarities = [], [] for message in response.messages:    timestamps.append(message.start_time)    polarities.append(message.sentiment.polarity.score) conversation_id = conversation.get_conversation_id() print("Your conversation ID is:", conversation_id)

After adding the above code to your script, exit nano by typing the CTRLand X keys while pressing y when prompted to save the file. To run the script, execute the following command.

(asr_env) symblai@symblai: ~/environments$ python  asr_recorded_call.py

Telnyx, Dolby.io, or Agora

In your script you add a url you received from a recorded call made on a PSTN number from Telnyx. With Symbl.ai, however, you are in a position as a developer to create an entire technology stack out of APIs for conversations augmented with artificial intelligence from Symbl.ai with any of the leading real-time communications, engagement, or CPaaS platforms such as  Agora.io, Dolby.io, or Telnyx.

Conclusion

With Symbl.ai’s Python SDK editors like Nano provide developers the opportunity to create automations with scripts in the terminal on instances of Linux distributions without much more than a few lines of #!Shebang! In your demo application you created an automation script for automating the process of analyzing a call with one of the leading CPaaS providers in the telecommunications space, Telnyx. Your script automatically recognizes speech.

What’s Next

Apart from learning how to code different things in Python3, there are many additional aspects of Symbl.ai’s Python SDK you may leverage for further automating speech recognition on instances of Linux distributions. In particular you are in a position to generate enhanced analytics for your audio or video conversations with Dolby.io or Agora.io, all of which may be automated entirely, or create time series analyses of speech events for an display of sentiment analysis with a graph. In addition to adding bells and whistles to your graphs like labels, you may consider how Symbl.ai’s Python SDK provides access to many of Symbl.ai’s APIs. In particular, you can enable Symbl.ai’s Python SDK on the real-time WebSockets API or any one of the Async APIs for voice, video, or messaging. A complete list is here:

In addition, Symbl.ai’s Python SDK contains links to enable Symbl.ai on its Telephony APIs with Python special methods. The methods for dialing into a call, work on the Session Initiation Protocol (SIP). With Symbl.ai’s Python SDK dialed into a call, your in a position to expand the experiences around calls in real-time. After connecting to a SIP call in real-time, you subscribe to Symbl.ai’s events such as events for contextual insights like follow-ups, questions, or action-items, or you create a request to deliver a post-meeting summary directly to your inbox.

Community

Symbl.ai‘s invites developers to reach out to us via email at [email protected], join our Slack channels, participate in our hackathons, fork our Postman public workspace, or git clone our repos at Symbl.ai’s GitHub.  

Avatar photo
Eric Giannini
Lead Developer Evangelist & Advocate