def __init__(self):
    self._conf = ''
    self.sphinxDied = False
    GlobalParams.__init__(self)
    self.denoise_topic = rospy.get_param("rapp_audio_processing_denoise_topic")
    self.energy_denoise_topic = \
        rospy.get_param("rapp_audio_processing_energy_denoise_topic")
    self.detect_silence_topic = \
        rospy.get_param("rapp_audio_processing_detect_silence_topic")
    self.audio_trans_topic = \
        rospy.get_param("rapp_audio_processing_transform_audio_topic")

    if(not self.denoise_topic):
      rospy.logerror("Audio processing denoise topic not found")
    if(not self.energy_denoise_topic):
      rospy.logerror("Audio processing energy denoise topic not found")
    if(not self.detect_silence_topic):
      rospy.logerror("Audio processing detect silence topic not found")
    if(not self.audio_trans_topic):
      rospy.logerror("Audio processing transform audio topic not found")

    self.denoise_service = rospy.ServiceProxy(\
              self.denoise_topic, AudioProcessingDenoiseSrv)
    self.energy_denoise_service = rospy.ServiceProxy(\
              self.energy_denoise_topic, AudioProcessingDenoiseSrv)
    self.detect_silence_service = rospy.ServiceProxy(\
              self.detect_silence_topic, AudioProcessingDetectSilenceSrv)
    self.audio_transform_srv = rospy.ServiceProxy( \
        self.audio_trans_topic, AudioProcessingTransformAudioSrv )
Exemplo n.º 2
0
    def __init__(self):
        self._conf = ''
        self.sphinxDied = False
        GlobalParams.__init__(self)
        self.denoise_topic = rospy.get_param(
            "rapp_audio_processing_denoise_topic")
        self.energy_denoise_topic = \
            rospy.get_param("rapp_audio_processing_energy_denoise_topic")
        self.detect_silence_topic = \
            rospy.get_param("rapp_audio_processing_detect_silence_topic")
        self.audio_trans_topic = \
            rospy.get_param("rapp_audio_processing_transform_audio_topic")

        if (not self.denoise_topic):
            rospy.logerror("Audio processing denoise topic not found")
        if (not self.energy_denoise_topic):
            rospy.logerror("Audio processing energy denoise topic not found")
        if (not self.detect_silence_topic):
            rospy.logerror("Audio processing detect silence topic not found")
        if (not self.audio_trans_topic):
            rospy.logerror("Audio processing transform audio topic not found")

        self.denoise_service = rospy.ServiceProxy(\
                  self.denoise_topic, AudioProcessingDenoiseSrv)
        self.energy_denoise_service = rospy.ServiceProxy(\
                  self.energy_denoise_topic, AudioProcessingDenoiseSrv)
        self.detect_silence_service = rospy.ServiceProxy(\
                  self.detect_silence_topic, AudioProcessingDetectSilenceSrv)
        self.audio_transform_srv = rospy.ServiceProxy( \
            self.audio_trans_topic, AudioProcessingTransformAudioSrv )
  def __init__(self):
    GlobalParams.__init__(self)

    if not os.path.exists( self.tmp_language_models_url ):
      rospy.logwarn( "Language temporary directory does not exist. Path: " + \
          self.tmp_language_models_url )
      os.makedirs(self.tmp_language_models_url)

    self.languages_package = tempfile.mkdtemp( prefix='tmp_language_pack_', dir = self.tmp_language_models_url )

    atexit.register(shutil.rmtree, self.languages_package)


    self.sphinx_configuration = { \
      'jar_path' : ".:" + self.sphinx_jar_files_url + \
            "/" + self.sphinx_jar_file + ":" \
            + self.sphinx_package_url + "/src", \
      'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
      'acoustic_model' : self.acoustic_models_url, \
      'grammar_name' : '', \
      'grammar_folder' : '', \
      'dictionary' : '', \
      'language_model' : '', \
      'grammar_disabled' : True
      }
    def __init__(self):
        GlobalParams.__init__(self)

        if not os.path.exists(self.tmp_language_models_url):
            rospy.logwarn( "Language temporary directory does not exist. Path: " + \
                self.tmp_language_models_url )
            os.makedirs(self.tmp_language_models_url)

        self.languages_package = tempfile.mkdtemp(
            prefix='tmp_language_pack_', dir=self.tmp_language_models_url)

        atexit.register(shutil.rmtree, self.languages_package)


        self.sphinx_configuration = { \
          'jar_path' : ".:" + self.sphinx_jar_files_url + \
                "/" + self.sphinx_jar_file + ":" \
                + self.sphinx_package_url + "/src", \
          'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
          'acoustic_model' : self.acoustic_models_url, \
          'grammar_name' : '', \
          'grammar_folder' : '', \
          'dictionary' : '', \
          'language_model' : '', \
          'grammar_disabled' : True
          }
Exemplo n.º 5
0
    def __init__(self):
        GlobalParams.__init__(self)

        self.sphinx4 = Sphinx4Wrapper()
        self.greek_support = GreekSupport()
        self.english_support = EnglishSupport()
        self._configuration_params = SphinxConfigurationParams()
        self.word_mapping = {}

        #self.serv_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_detect_speech_topic")
        #self.serv_configuration_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_configuration_topic")
        #self.serv_batch_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_total_topic")

        self.use_db_authentication = rospy.get_param(\
            "rapp_speech_detection_sphinx4_use_db_authentication")

        #---------------------------Check db authentication------------------------#
        if self.use_db_authentication == True:
            self.serv_db_topic = \
                rospy.get_param("rapp_mysql_wrapper_user_fetch_data_topic")
            self.authentication_service = rospy.ServiceProxy(\
                    self.serv_db_topic, fetchDataSrv)

        #if(not self.serv_topic):
        #rospy.logerror("Sphinx4 Speech detection topic param not found")
        #if(not self.serv_configuration_topic):
        #rospy.logerror("Sphinx4 Speech detection configuration topic param not found")
        #if(not self.serv_batch_topic):
        #rospy.logerror("Sphinx4 Speech detection batch topic param not found")
        if (not self.use_db_authentication):
            rospy.logerror(
                "Sphinx4 Seech Detection use authentication param not found")

        #self.speech_recognition_service = rospy.Service(self.serv_topic, \
        #SpeechRecognitionSphinx4Srv, self.speechRecognition)
        #self.speech_recognition_configuration_service = rospy.Service( \
        #self.serv_configuration_topic, SpeechRecognitionSphinx4ConfigureSrv, \
        #self.configureSpeechRecognition)
        #self.speech_recognition_batch_service = rospy.Service( \
        #self.serv_batch_topic, SpeechRecognitionSphinx4TotalSrv, \
        #self.speechRecognitionBatch)

        total_path = ".:" + self.sphinx_jar_files_url + \
            "/" + self.sphinx_jar_file + ":" \
                + self.sphinx_package_url + "/src"

        self.sphinx_configuration = { \
          'jar_path' : total_path, \
          'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
          'acoustic_model' : self.acoustic_models_url , \
          'grammar_name' : 'hello', \
          'grammar_folder' : self.language_models_url + "/greekPack/", \
          'dictionary' : self.language_models_url + "/greekPack/custom.dict", \
          'language_model' : self.language_models_url + "/greekPack/sentences.lm.bin", \
          'grammar_disabled' : True
          }
        self.sphinx4.initializeSphinx(self.sphinx_configuration)
  def __init__(self):
    GlobalParams.__init__(self)

    self.sphinx4 = Sphinx4Wrapper()
    self.greek_support = GreekSupport()
    self.english_support = EnglishSupport()
    self._configuration_params = SphinxConfigurationParams()
    self.word_mapping = {}

    #self.serv_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_detect_speech_topic")
    #self.serv_configuration_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_configuration_topic")
    #self.serv_batch_topic = \
        #rospy.get_param("rapp_speech_detection_sphinx4_total_topic")

    self.use_db_authentication = rospy.get_param(\
        "rapp_speech_detection_sphinx4_use_db_authentication")

    #---------------------------Check db authentication------------------------#
    if self.use_db_authentication == True:
      self.serv_db_topic = \
          rospy.get_param("rapp_mysql_wrapper_user_fetch_data_topic")
      self.authentication_service = rospy.ServiceProxy(\
              self.serv_db_topic, fetchDataSrv)

    #if(not self.serv_topic):
      #rospy.logerror("Sphinx4 Speech detection topic param not found")
    #if(not self.serv_configuration_topic):
      #rospy.logerror("Sphinx4 Speech detection configuration topic param not found")
    #if(not self.serv_batch_topic):
      #rospy.logerror("Sphinx4 Speech detection batch topic param not found")
    if(not self.use_db_authentication):
      rospy.logerror("Sphinx4 Seech Detection use authentication param not found")

    #self.speech_recognition_service = rospy.Service(self.serv_topic, \
        #SpeechRecognitionSphinx4Srv, self.speechRecognition)
    #self.speech_recognition_configuration_service = rospy.Service( \
        #self.serv_configuration_topic, SpeechRecognitionSphinx4ConfigureSrv, \
        #self.configureSpeechRecognition)
    #self.speech_recognition_batch_service = rospy.Service( \
        #self.serv_batch_topic, SpeechRecognitionSphinx4TotalSrv, \
        #self.speechRecognitionBatch)

    total_path = ".:" + self.sphinx_jar_files_url + \
        "/" + self.sphinx_jar_file + ":" \
            + self.sphinx_package_url + "/src"

    self.sphinx_configuration = { \
      'jar_path' : total_path, \
      'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
      'acoustic_model' : self.acoustic_models_url , \
      'grammar_name' : 'hello', \
      'grammar_folder' : self.language_models_url + "/greekPack/", \
      'dictionary' : self.language_models_url + "/greekPack/custom.dict", \
      'language_model' : self.language_models_url + "/greekPack/sentences.lm.bin", \
      'grammar_disabled' : True
      }
    self.sphinx4.initializeSphinx(self.sphinx_configuration)
Exemplo n.º 7
0
    def __init__(self):
        GlobalParams.__init__(self)
        ## Sphinx configuration
        self._conf = ''
        ## Sphinx status flag
        self._sphinxDied = False

        ## The IPC socket
        self._sphinx_socket = None
        ## The IPC socket port
        self._sphinx_socket_PORT = None

        ## The Sphinx subprocess
        self._sphinxSubprocess = None

        # Denoise service topic name
        denoise_topic = rospy.get_param("rapp_audio_processing_denoise_topic")
        # Energy denoise service topic name
        energy_denoise_topic = \
            rospy.get_param("rapp_audio_processing_energy_denoise_topic")
        # Detect silence service topic name
        detect_silence_topic = \
            rospy.get_param("rapp_audio_processing_detect_silence_topic")
        # Transform audio service topic name
        audio_trans_topic = \
            rospy.get_param("rapp_audio_processing_transform_audio_topic")

        if (not denoise_topic):
            rospy.logerror("Audio processing denoise topic not found")
        if (not energy_denoise_topic):
            rospy.logerror("Audio processing energy denoise topic not found")
        if (not detect_silence_topic):
            rospy.logerror("Audio processing detect silence topic not found")
        if (not audio_trans_topic):
            rospy.logerror("Audio processing transform audio topic not found")

        ## @brief Denoise service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::denoise
        self._denoise_service = rospy.ServiceProxy(\
                  denoise_topic, AudioProcessingDenoiseSrv)

        ## @brief Energy denoise service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::energy_denoise
        self._energy_denoise_service = rospy.ServiceProxy(\
                  energy_denoise_topic, AudioProcessingDenoiseSrv)

        ## @brief Detect silence service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::detect_silence
        self._detect_silence_service = rospy.ServiceProxy(\
                  detect_silence_topic, AudioProcessingDetectSilenceSrv)

        ## @brief Transform audio service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::transform_audio
        self._audio_transform_srv = rospy.ServiceProxy( \
            audio_trans_topic, AudioProcessingTransformAudioSrv )
    def __init__(self):
        GlobalParams.__init__(self)

        self._configuration = ''

        self._language = 'el'
        self._words = []
        self._grammar = []
        self._sentences = []
  def __init__(self):
      GlobalParams.__init__(self)

      self._configuration = ''

      self._language = 'el'
      self._words = []
      self._grammar = []
      self._sentences = []
  def __init__(self):
    GlobalParams.__init__(self)

    ## The sphinx wrapper communicates with the actual Sphinx.java process
    #
    # (see sphinx4_wrapper.Sphinx4Wrapper)
    self._sphinx4 = Sphinx4Wrapper()
    ## Greek_support creates necessary files for Greek speech recognition
    #
    # (see greek_support.GreekSupport)
    self._greek_support = GreekSupport()
    ## English creates necessary files for english speech recognition
    #
    # (see english_support.EnglishSupport)
    self._english_support = EnglishSupport()
    ## The Sphinx configuration parameters
    #
    # (see sphinx4_configuration_params.SphinxConfigurationParams)
    self._configuration_params = SphinxConfigurationParams()

    ## A dictionary to transform the englified greek words to actual greek words
    self._word_mapping = {}

    ## Defines whether database authentication should be used
    self._use_db_authentication = rospy.get_param(\
        "rapp_speech_detection_sphinx4_use_db_authentication")

    #---------------------------Check db authentication------------------------#
    if self._use_db_authentication == True:
      serv_db_topic = \
          rospy.get_param("rapp_mysql_wrapper_user_fetch_data_topic")
      ## The database authentication service client
      #
      # Used to identify user performed the speech recognition request.
      # (see mysql_wrapper.MySQLdbWrapper.fetchData)
      self._authentication_service = rospy.ServiceProxy(\
              serv_db_topic, fetchDataSrv)

    if(not self._use_db_authentication):
      rospy.logerror("Sphinx4 Seech Detection use authentication param not found")


    total_path = ".:" + self._sphinx_jar_files_url + \
        "/" + self._sphinx_jar_file + ":" \
            + self._sphinx_package_url + "/src"

    sphinx_configuration = { \
      'jar_path' : total_path, \
      'configuration_path' : self._language_models_url + "/greekPack/default.config.xml", \
      'acoustic_model' : self._acoustic_models_url , \
      'grammar_name' : 'hello', \
      'grammar_folder' : self._language_models_url + "/greekPack/", \
      'dictionary' : self._language_models_url + "/greekPack/custom.dict", \
      'language_model' : self._language_models_url + "/greekPack/sentences.lm.bin", \
      'grammar_disabled' : True
      }
    self._sphinx4.initializeSphinx(sphinx_configuration)
  def __init__(self):
      GlobalParams.__init__(self)

      ## The language of the request
      self._language = 'el'
      ## The words to be identified
      self._words = []
      ## Sphinx grammar attribute
      self._grammar = []
      ## Sphinx sentence attribute
      self._sentences = []
    def __init__(self):
        GlobalParams.__init__(self)

        ## The language of the request
        self._language = 'el'
        ## The words to be identified
        self._words = []
        ## Sphinx grammar attribute
        self._grammar = []
        ## Sphinx sentence attribute
        self._sentences = []
Exemplo n.º 13
0
    def __init__(self):
        GlobalParams.__init__(self)

        ## The limited vocabulary creator
        #
        # Instantiates limited_vocabulary_creator.LimitedVocabularyCreator
        self._vocabulary = LimitedVocabularyCreator()

        # TODO: Split the rapp_sphinx4_java_libraries package into libraries and
        # language models
        english_dictionary = self._language_models_url + \
            "/englishPack/cmudict-en-us.dict"

        jar_path = ".:" + \
            self._sphinx_jar_files_url + \
            "/" + self._sphinx_jar_file + ":" \
                + self._sphinx_package_url + "/src"

        # Grammar is dummy here..
        ## The generic Sphinx configuration
        #
        # @note Check acoustic model!!
        self._generic_sphinx_configuration = { \
          'jar_path' : jar_path, \
          'configuration_path' : self._language_models_url + "/greekPack/default.config.xml", \
          'acoustic_model' : self._acoustic_models_url, \
          'grammar_name' : 'hello', \
          'grammar_folder' : self._language_models_url + "/greekPack/", \
          'dictionary' : self._language_models_url + "/englishPack/cmudict-en-us.dict", \
          'language_model' : self._language_models_url + "/englishPack/en-us.lm.bin", \
          'grammar_disabled' : True
          }

        ## The English dictionary file
        #
        # Located in path global_parameters.GlobalParams#_language_models_url +
        # "/englishPack/cmudict-en-us.dict"
        self._english_dict_file = None
        ## The mmap of the English dictionary file contents
        self._english_dict_mapping = None

        # Open the generic english dictionary file
        try:
            self._english_dict_file = open(english_dictionary, 'r')
        except IOError:
            rapp_print("English dictionary could not be opened!")
        # Create a mapping of the file
        self._english_dict_mapping = mmap.mmap(self._english_dict_file.fileno(), 0, \
            access = mmap.ACCESS_READ)
    def __init__(self):
        ## Contains global Sphinx parameters
        #
        # (see global_parameters.GlobalParams)
        self._globalParams = GlobalParams()

        if not os.path.exists(self._globalParams._tmp_language_models_url):
            rospy.logwarn( "Language temporary directory does not exist. Path: " + \
                self._globalParams._tmp_language_models_url )
            os.makedirs(self._globalParams._tmp_language_models_url)

        ## The temporary directory containing the configurations
        self._languages_package = tempfile.mkdtemp( prefix='tmp_language_pack_', \
            dir = self._globalParams._tmp_language_models_url )

        # Delete temp file at termination
        atexit.register(shutil.rmtree, self._languages_package)

        ## The default configuration
        self._sphinx_configuration = { \
          'jar_path' : ".:" + self._globalParams._sphinx_jar_files_url + \
                "/" + self._globalParams._sphinx_jar_file + ":" \
                + self._globalParams._sphinx_package_url + "/src", \
          'configuration_path' : self._globalParams._language_models_url + \
                                          "/greekPack/default.config.xml", \
          'acoustic_model' : self._globalParams._acoustic_models_url, \
          'grammar_name' : '', \
          'grammar_folder' : '', \
          'dictionary' : '', \
          'language_model' : '', \
          'grammar_disabled' : True
          }
    def __init__(self, configurationName=None):

        ## Contains global Sphinx parameters
        #
        # (see global_parameters.GlobalParams)
        self._globalParams = GlobalParams()

        ## The sphinx wrapper communicates with the actual Sphinx.java process
        #
        # (see sphinx4_wrapper.Sphinx4Wrapper)
        self._sphinx4 = Sphinx4Wrapper()
        ## Greek_support creates necessary files for Greek speech recognition
        #
        # (see greek_support.GreekSupport)
        self._greek_support = GreekEnglishSupport()
        ## English creates necessary files for english speech recognition
        #
        # (see english_support.EnglishSupport)
        self._english_support = EnglishSupport()
        ## The Sphinx configuration parameters
        #
        # (see sphinx4_configuration_params.SphinxConfigurationParams)
        self._configuration_params = SphinxConfigurationParams()

        ## A dictionary to transform the englified greek words to actual greek words
        self._word_mapping = {}

        if configurationName != None:
            self._createPreconfiguration(configurationName)
Exemplo n.º 16
0
    def __init__(self):
        ## Contains global Sphinx parameters
        #
        # (see global_parameters.GlobalParams)
        self._globalParams = GlobalParams()

        ## The limited vocabulary creator
        #
        # Instantiates limited_vocabulary_creator.LimitedVocabularyCreator
        self._vocabulary = LimitedVocabularyCreator()

        jar_path = ".:" + self._globalParams._sphinx_jar_files_url + "/" + \
            self._globalParams._sphinx_jar_file + ":" + \
            self._globalParams._sphinx_package_url + "/src"

        # Grammar is dummy here..
        ## The generic Sphinx configuration
        #
        # @note Check acoustic model!!
        self._generic_sphinx_configuration = { \
          'jar_path' : jar_path, \
          'configuration_path' : self._globalParams._language_models_url + \
                                          "/greekPack/default.config.xml", \
          'acoustic_model' : self._globalParams._acoustic_models_url, \
          'grammar_name' : 'hello', \
          'grammar_folder' : self._globalParams._language_models_url + \
                                                        "/greekPack/", \
          'dictionary' : self._globalParams._language_models_url + \
                                "/englishPack/cmudict-en-us.dict", \
          'language_model' : self._globalParams._language_models_url + \
                                          "/englishPack/en-us.lm.bin", \
          'grammar_disabled' : True
          }
Exemplo n.º 17
0
    def __init__(self):
        GlobalParams.__init__(self)

        #self.generic_sphinx_configuration = {}
        self.limited_sphinx_configuration = {}

        self.vocabulary = LimitedVocabularyCreator()
        # TODO: Split the rapp_sphinx4_java_libraries package into libraries and
        # language models
        # NOTE: This does not exist yet
        self.greek_dictionary = self.language_models_url + \
            "/englishPack/cmudict-en-us.dict"

        jar_path = ".:" + self.sphinx_jar_files_url + "/" + \
            self.sphinx_jar_file + ":" \
                + self.sphinx_package_url + "/src"

        # Grammar is dummy here..
        # NOTE: Fix this according to the generic Greek model
        self.generic_sphinx_configuration = { \
          'jar_path' : jar_path, \
          'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
          'acoustic_model' : self.acoustic_models_url + "/acoustic_model/", \
          'grammar_name' : 'hello', \
          'grammar_folder' : self.language_models_url + "/greekPack/", \
          'dictionary' : self.language_models_url +  "/englishPack/cmudict-en-us.dict", \
          'language_model' : self.language_models_url + "/englishPack/en-us.lm.bin", \
          'grammar_disabled' : True
          }

        self._english_support = EnglishSupport()
        # Open the generic english dictionary file
        # NOTE: Fix this according to the Greek generic dictionary
        #try:
        #self.english_dict_file = open(self.english_dictionary, 'r')
        #except IOError:
        #print "English dictionary could not be opened!"
        # Create a mapping of the file
        #self.english_dict_mapping = mmap.mmap(self.english_dict_file.fileno(), 0, \
        #access = mmap.ACCESS_READ)

        self.configureLetters()
Exemplo n.º 18
0
    def __init__(self):
        GlobalParams.__init__(self)

        # self.generic_sphinx_configuration = {}
        self.limited_sphinx_configuration = {}

        self.vocabulary = LimitedVocabularyCreator()
        # TODO: Split the rapp_sphinx4_java_libraries package into libraries and
        # language models
        # NOTE: This does not exist yet
        self.greek_dictionary = self.language_models_url + "/englishPack/cmudict-en-us.dict"

        jar_path = (
            ".:" + self.sphinx_jar_files_url + "/" + self.sphinx_jar_file + ":" + self.sphinx_package_url + "/src"
        )

        # Grammar is dummy here..
        # NOTE: Fix this according to the generic Greek model
        self.generic_sphinx_configuration = {
            "jar_path": jar_path,
            "configuration_path": self.language_models_url + "/greekPack/default.config.xml",
            "acoustic_model": self.acoustic_models_url + "/acoustic_model/",
            "grammar_name": "hello",
            "grammar_folder": self.language_models_url + "/greekPack/",
            "dictionary": self.language_models_url + "/englishPack/cmudict-en-us.dict",
            "language_model": self.language_models_url + "/englishPack/en-us.lm.bin",
            "grammar_disabled": True,
        }

        self._english_support = EnglishSupport()
        # Open the generic english dictionary file
        # NOTE: Fix this according to the Greek generic dictionary
        # try:
        # self.english_dict_file = open(self.english_dictionary, 'r')
        # except IOError:
        # print "English dictionary could not be opened!"
        # Create a mapping of the file
        # self.english_dict_mapping = mmap.mmap(self.english_dict_file.fileno(), 0, \
        # access = mmap.ACCESS_READ)

        self.configureLetters()
Exemplo n.º 19
0
  def __init__(self):
    GlobalParams.__init__(self)

    #self.generic_sphinx_configuration = {}
    self.limited_sphinx_configuration = {}

    self.vocabulary = LimitedVocabularyCreator()
    # TODO: Split the rapp_sphinx4_java_libraries package into libraries and
    # language models
    self.english_dictionary = self.language_models_url + \
        "/englishPack/cmudict-en-us.dict"

    jar_path = ".:" + \
        self.sphinx_jar_files_url + \
        "/" + self.sphinx_jar_file + ":" \
            + self.sphinx_package_url + "/src"

    # Grammar is dummy here..
    # NOTE: Check acoustic model!!
    self.generic_sphinx_configuration = { \
      'jar_path' : jar_path, \
      'configuration_path' : self.language_models_url + "/greekPack/default.config.xml", \
      'acoustic_model' : self.acoustic_models_url, \
      'grammar_name' : 'hello', \
      'grammar_folder' : self.language_models_url + "/greekPack/", \
      'dictionary' : self.language_models_url + "/englishPack/cmudict-en-us.dict", \
      'language_model' : self.language_models_url + "/englishPack/en-us.lm.bin", \
      'grammar_disabled' : True
      }

    # Open the generic english dictionary file
    try:
      self.english_dict_file = open(self.english_dictionary, 'r')
    except IOError:
      rapp_print("English dictionary could not be opened!")
    # Create a mapping of the file
    self.english_dict_mapping = mmap.mmap(self.english_dict_file.fileno(), 0, \
        access = mmap.ACCESS_READ)
    def __init__(self, configuration=None):

        ## Contains global Sphinx parameters
        #
        # (see global_parameters.GlobalParams)
        self._globalParams = GlobalParams()

        ## The language of the request
        self._language = 'el'
        ## The words to be identified
        self._words = []
        ## Sphinx grammar attribute
        self._grammar = []
        ## Sphinx sentence attribute
        self._sentences = []

        if configuration != None:
            self._readConfigurationYaml(configuration)
Exemplo n.º 21
0
  def __init__(self):
    GlobalParams.__init__(self)

    ## The limited vocabulary creator
    #
    # Instantiates limited_vocabulary_creator.LimitedVocabularyCreator
    self._vocabulary = LimitedVocabularyCreator()
    # TODO: Split the rapp_sphinx4_java_libraries package into libraries and
    # language models
    # NOTE: This does not exist yet
    #self._greek_dictionary = self._language_models_url + \
        #"/englishPack/cmudict-en-us.dict"

    jar_path = ".:" + self._sphinx_jar_files_url + "/" + \
        self._sphinx_jar_file + ":" \
            + self._sphinx_package_url + "/src"

    ## The generic Sphinx configuration
    #
    # Grammar is dummy here..
    # @todo Fix this according to the generic Greek model
    self._generic_sphinx_configuration = { \
      'jar_path' : jar_path, \
      'configuration_path' : self._language_models_url + "/greekPack/default.config.xml", \
      'acoustic_model' : self._acoustic_models_url + "/acoustic_model/", \
      'grammar_name' : 'hello', \
      'grammar_folder' : self._language_models_url + "/greekPack/", \
      'dictionary' : self._language_models_url +  "/englishPack/cmudict-en-us.dict", \
      'language_model' : self._language_models_url + "/englishPack/en-us.lm.bin", \
      'grammar_disabled' : True
      }

    ## Allows the creation of configuration files for English words
    #
    # Instantiates english_support.EnglishSupport to identify english words
    self._english_support = EnglishSupport()
    # Open the generic english dictionary file
    # NOTE: Fix this according to the Greek generic dictionary
    #try:
      #self.english_dict_file = open(self.english_dictionary, 'r')
    #except IOError:
      #print "English dictionary could not be opened!"
    # Create a mapping of the file
    #self.english_dict_mapping = mmap.mmap(self.english_dict_file.fileno(), 0, \
        #access = mmap.ACCESS_READ)

    ## Greek uppercase to lowercase mapping
    self._capital_letters = {}
    ## Greek words->English standard phonemes mapping
    self._phonemes = {}
    ## Two digit Greek letters->English phonemes mapping
    self._two_digit_letters = {}
    ## Special two digit Greek letter->English phonemes mapping
    self._special_two_digit_letters = []
    ## All special two digit Greek letter->English phonemes mapping
    self._all_special_two_digit_letters = {}
    ## Special Greek words ->English phonemes mapping
    self._s_specific_rules = {}
    ## Standard Greek letter->English phonemes mapping
    self._letters = {}
    ## Greek letters->English letters mapping
    self._literal_letters = {}

    self._configureLetters()
Exemplo n.º 22
0
    def __init__(self):
        ## Contains global Sphinx parameters
        #
        # (see global_parameters.GlobalParams)
        self._globalParams = GlobalParams()

        ## Sphinx configuration
        self._conf = ''
        ## Sphinx status flag
        self._sphinxDied = False

        ## The IPC socket
        self._sphinx_socket = None
        ## The IPC socket port
        self._sphinx_socket_PORT = None

        ## The Sphinx subprocess
        self._sphinxSubprocess = None

        # Denoise service topic name
        denoise_topic = rospy.get_param("rapp_audio_processing_denoise_topic")
        # Energy denoise service topic name
        energy_denoise_topic = \
            rospy.get_param("rapp_audio_processing_energy_denoise_topic")
        # Detect silence service topic name
        detect_silence_topic = \
            rospy.get_param("rapp_audio_processing_detect_silence_topic")
        # Transform audio service topic name
        audio_trans_topic = \
            rospy.get_param("rapp_audio_processing_transform_audio_topic")

        if (not denoise_topic):
            rospy.logerror("Audio processing denoise topic not found")
        if (not energy_denoise_topic):
            rospy.logerror("Audio processing energy denoise topic not found")
        if (not detect_silence_topic):
            rospy.logerror("Audio processing detect silence topic not found")
        if (not audio_trans_topic):
            rospy.logerror("Audio processing transform audio topic not found")

        ## @brief Denoise service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::denoise
        self._denoise_service = rospy.ServiceProxy(\
                  denoise_topic, AudioProcessingDenoiseSrv)

        ## @brief Energy denoise service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::energy_denoise
        self._energy_denoise_service = rospy.ServiceProxy(\
                  energy_denoise_topic, AudioProcessingDenoiseSrv)

        ## @brief Detect silence service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::detect_silence
        self._detect_silence_service = rospy.ServiceProxy(\
                  detect_silence_topic, AudioProcessingDetectSilenceSrv)

        ## @brief Transform audio service client
        #
        # rapp_audio_processing.rapp_audio_processing.AudioProcessing::transform_audio
        self._audio_transform_srv = rospy.ServiceProxy( \
            audio_trans_topic, AudioProcessingTransformAudioSrv )

        ## Contains the absolute path for the Sphinx jar file
        self._jar_path = ".:" + self._globalParams._sphinx_jar_files_url + \
            "/" + self._globalParams._sphinx_jar_file + ":" \
                + self._globalParams._sphinx_package_url + "/src"

        self._initializeSphinxProcess()