Commit ae8c659d authored by Matt Clarkson's avatar Matt Clarkson

Merge branch '3-update-readme'

parents b848fa1b b6c45f9d
Pipeline #2952 passed with stages
in 11 minutes and 48 seconds
......@@ -15,26 +15,36 @@ scikit-surgeryspeech
:target: https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryspeech/commits/master
:alt: Test coverage
.. image:: https://readthedocs.org/projects/scikit-surgeryspeech/badge/?version=latest
:target: http://scikit-surgeryspeech.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Author: Matt Clarkson
Author: Kim-Celine Kahl
scikit-surgeryspeech is part of the `SNAPPY`_ software project, developed at the `Wellcome EPSRC Centre for Interventional and Surgical Sciences`_, part of `University College London (UCL)`_.
scikit-surgeryspeech supports Python 2.7 and Python 3.6.
scikit-surgeryspeech supports Python 3.6.
scikit-surgeryspeech is a project which runs the `Python Speech Recognition API`_ in the background listening
for a specific command (For now "start "). After saying the keyword you can say different commands, which get
converted to QT Signals.
The speech recognition is done by the `Google Cloud API`_, you have to get the credentials to use it or change the recognition service.
Please explore the project structure, and implement your own functionality.
Example usage
-------------
scikit-surgeryspeech is currently a demo project, which will add/multiply two numbers. Example usage:
To run an example, just start
::
python sksurgeryspeech.py 5 8
python sksurgeryspeech.py 3 6 --multiply
sksurgeryspeech.py
Please explore the project structure, and implement your own functionality.
Make sure Google Cloud API is set up correctly as described in the section below.
You can then say "start" as keyword and afterwards a command. The command "quit" exits the application.
Note: each time you have already entered a command, you need to say "start" again to trigger the listening to commands.
Developing
----------
......@@ -54,24 +64,53 @@ If you have problems running the application, you might need to install portaudi
brew install portaudio
Running tests
^^^^^^^^^^^^^
Pytest is used for running unit tests:
Use the Google Cloud speech recognition service
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _`Google Cloud API is set up correctly`:
To use the Google Cloud speech recognition service, you need to `get the credentials`_ first. After signing up, you
should get a json file with your credentials. Download this file and set the environment variable
::
pip install pytest
python -m pytest
GOOGLE_APPLICATION_CREDENTIALS
To the path of your json file. You should then be able to run the application.
Linting
^^^^^^^
Change speech recognition service
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This code conforms to the PEP8 standard. Pylint can be used to analyse the code:
To change the speech recognition service if you don't want to use the Google Cloud API, just change the command
::
pip install pylint
pylint --rcfile=tests/pylintrc sksurgeryspeech
words = recognizer.recognize_google_cloud(audio, credentials_json=self.credentials)
(file "voice_recognition_service.py", methods "callback(self, recognizer, audio)", "listen_to_command(self)")
to the recognition service of your choice. Currently available services are:
::
recognizer.recognize_sphinx(audio)
recognizer.recognize_google(audio)
recognizer.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS)
recognizer.recognize_wit(audio, key=WIT_AI_KEY)
recognizer.recognize_bing(audio, key=BING_KEY)
recognizer.recognize_azure(audio, key=AZURE_SPEECH_KEY)
recognizer.recognize_houndify(audio, client_id=HOUNDIFY_CLIENT_ID, client_key=HOUNDIFY_CLIENT_KEY)
recognizer.recognize_ibm(audio, username=IBM_USERNAME, password=IBM_PASSWORD)
Python development
^^^^^^^^^^^^^^^^^^
This project uses tox. Start with a clean python environment, then do:
::
pip install tox
tox
and the commands that are run can be found in tox.ini.
Installing
......@@ -95,7 +134,6 @@ Useful links
^^^^^^^^^^^^
* `Source code repository`_
* `Documentation`_
Licensing and copyright
......@@ -113,11 +151,12 @@ Supported by `Wellcome`_ and `EPSRC`_.
.. _`Wellcome EPSRC Centre for Interventional and Surgical Sciences`: http://www.ucl.ac.uk/weiss
.. _`source code repository`: https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryspeech
.. _`Documentation`: https://scikit-surgeryspeech.readthedocs.io
.. _`SNAPPY`: https://weisslab.cs.ucl.ac.uk/WEISS/PlatformManagement/SNAPPY/wikis/home
.. _`University College London (UCL)`: http://www.ucl.ac.uk/
.. _`Wellcome`: https://wellcome.ac.uk/
.. _`EPSRC`: https://www.epsrc.ac.uk/
.. _`contributing guidelines`: https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryspeech/blob/master/CONTRIBUTING.rst
.. _`license file`: https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgeryspeech/blob/master/LICENSE
.. _`Python Speech Recognition API`: https://pypi.org/project/SpeechRecognition/
.. _`Google Cloud API`: https://cloud.google.com/speech-to-text/
.. _`get the credentials`: https://console.cloud.google.com/freetrial/signup/tos?_ga=2.263649484.-1718611742.1562839990
......@@ -6,7 +6,7 @@ Demo for the Speech API module
import sys
import logging
import PySide2.QtCore
from sksurgeryspeech.algorithms import first_test_speech_api as speech_api
from sksurgeryspeech.algorithms import voice_recognition_service as speech_api
LOGGER = logging.getLogger("voice_recognition_logger")
......
......@@ -3,7 +3,6 @@
"""scikit-surgeryspeech tests"""
# Pytest style
from sksurgeryspeech.algorithms import first_test_speech_api as speech_api
def test_function_example():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment