/src/ca/ilanguage/labs/pocketsphinx/service/SpeechRecognizerViaFilePocketSphinx.java

http://github.com/cesine/AndroidPocketSphinx · Java · 52 lines · 4 code · 3 blank · 45 comment · 0 complexity · d7d69a651c883fe64c5cf2afdc857877 MD5 · raw file

  1. package ca.ilanguage.labs.pocketsphinx.service;
  2. /*
  3. * Copyright (C) 2010 The Android Open Source Project
  4. *
  5. * Based on android.speech.SpeechRecognizer.java commit 1c3cca0abed55516d2c6
  6. * https://github.com/android/platform_frameworks_base/blob/master/core/java/android/speech/SpeechRecognizer.java
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. import android.content.Context;
  21. /**
  22. * This class provides access to the speech recognition service to run on an MP3 file which is present on the device. This service allows access to the
  23. * speech recognizer. Do not instantiate this class directly, instead, call
  24. * {@link SpeechRecognizerViaFilePocketSphinx#createSpeechRecognizer(Context)}. This class's methods must be
  25. * invoked only from the main application thread.
  26. *
  27. * TODO This class expects an audio file
  28. * 1. chunks on pauses
  29. * 2. sends each chunk to be recognized (either on the device or on a server)
  30. * 3. returns results as an array of array hypotheses
  31. *
  32. *
  33. * TODO For inspiration on how this can be done see a combination of android.speech.SpeechRecognizer, PocketSphinxAndroidDemo, RecognizerTask
  34. *
  35. * TODO Learn how PocketSphinx works and how change PocketSphinxAndroidDemo to work for a file instead of recording
  36. * some info might be here: http://sourceforge.net/projects/cmusphinx/forums/forum/5471/topic/4023606
  37. * "In recent version pocketsphinx_continuous has -infile argument to pass file to decode."
  38. *
  39. * TODO How to do the chunking, two options:
  40. * 1. LIUM tools allows for speech stream segmentation and speaker recognition.
  41. * Documentation is for command line use (or perl) TODO figure out how to use it programatically
  42. * 2. Port Praat to Android
  43. * Praat is written in C++ and is a powerful phonetic analysis tool used by Phoneticians, might need it anyway to use additional prosodic information to improve Sphinx's recognition
  44. *
  45. * Please note that the application DOES NOT NEED
  46. * {@link android.Manifest.permission#RECORD_AUDIO} permission to use this class.
  47. */
  48. public class SpeechRecognizerViaFilePocketSphinx {
  49. }