# stt-watson
Continuous speech to text using watson in python with websocket and record from microphone
## Requirements
- **Python 2.7**
- **Pip**
- **portaudio**, can be installed with `brew install portaudio` (mac) or `apt-get install portaudio19-dev`(linux)
## Installation
Install with pip: `pip install stt-watson`
## Run the playground
Simply run in command line: `stt-watson`
**At the first launch it will create a config file located to `~/.config-stt-watson.yml` and ask you your watson credentials**
## Usage for developers
Bootstrap example:
```python
from stt_watson.SttWatson import SttWatson
from stt_watson.SttWatsonAbstractListener import SttWatsonAbstractListener
"""
Example of listener to use data given by stt-watson (stt-watson notify hypothesis to his listeners when he receive it)
Hypothesis format:
{
'confidence': '0.1' // confidence of the sentence or words if exist
'transcript': 'the transcription of your voice'
}
"""
class MyListener(SttWatsonAbstractListener):
def __init__(self):
pass
"""
This give hypothesis from watson when your sentence is finished
"""
def listenHypothesis(self, hypothesis):
print "Hypothesis: {0}".format(hypothesis)
"""
This give the json received from watson
"""
def listenPayload(self, payload):
print(u"Text message received: {0}".format(payload))
"""
This give hypothesis from watson when your sentence is not finished
"""
def listenInterimHypothesis(self, interimHypothesis):
print "Interim hypothesis: {0}".format(interimHypothesis)
myListener = MyListener()
sttWatson = SttWatson('watson_user', 'watson_password')
sttWatson.addListener(myListener)
sttWatson.run()
```
Continuous speech to text using watson in python with websocket and record from microphone
## Requirements
- **Python 2.7**
- **Pip**
- **portaudio**, can be installed with `brew install portaudio` (mac) or `apt-get install portaudio19-dev`(linux)
## Installation
Install with pip: `pip install stt-watson`
## Run the playground
Simply run in command line: `stt-watson`
**At the first launch it will create a config file located to `~/.config-stt-watson.yml` and ask you your watson credentials**
## Usage for developers
Bootstrap example:
```python
from stt_watson.SttWatson import SttWatson
from stt_watson.SttWatsonAbstractListener import SttWatsonAbstractListener
"""
Example of listener to use data given by stt-watson (stt-watson notify hypothesis to his listeners when he receive it)
Hypothesis format:
{
'confidence': '0.1' // confidence of the sentence or words if exist
'transcript': 'the transcription of your voice'
}
"""
class MyListener(SttWatsonAbstractListener):
def __init__(self):
pass
"""
This give hypothesis from watson when your sentence is finished
"""
def listenHypothesis(self, hypothesis):
print "Hypothesis: {0}".format(hypothesis)
"""
This give the json received from watson
"""
def listenPayload(self, payload):
print(u"Text message received: {0}".format(payload))
"""
This give hypothesis from watson when your sentence is not finished
"""
def listenInterimHypothesis(self, interimHypothesis):
print "Interim hypothesis: {0}".format(interimHypothesis)
myListener = MyListener()
sttWatson = SttWatson('watson_user', 'watson_password')
sttWatson.addListener(myListener)
sttWatson.run()
```
Metadata
Release files for stt-watson 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stt_watson-1.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / stt_watson-1.0.3-py2.py3-none-any.whl
| Download URL | stt_watson-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4dbd12c7e39fed7ff487e673771328e0eff3e9ae0ab7b4c4950e295aedc12916
|
|
BLAKE2b-256 checksum How to use checksums |
df7b31b6e01b1e30333b2a345bb9c45f315ccabd9e307f14c89a1a9a4b665636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |