2013-07-13 1 views
2

영어 단어 목록이 있습니다. 목소리로 검색하고 싶습니다. 나는 단어의 단어 표시 목록을 말할 때. 나는 Android: Speech Recognition without using google server 을 읽었다. 그리고 몇 가지 예를 시도했습니다.인터넷 및 Google 서버 없이도 음성을 Android로 텍스트로 변환

package com.uz.VoiceRecognizw; 

import android.app.Activity; 
import android.content.Intent; 
import android.content.pm.PackageManager; 
import android.content.pm.ResolveInfo; 
import android.os.Bundle; 
import android.speech.RecognizerIntent; 
import android.view.View; 
import android.widget.ArrayAdapter; 
import android.widget.Button; 
import android.widget.ListView; 

import java.util.ArrayList; 
import java.util.List; 

public class MyActivity extends Activity { 
    private static final int REQUEST_CODE = 1234; 
    private ListView wordsList; 
    /** 
    * Called when the activity is first created. 
    */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.voice_recog); 

     Button speakButton = (Button) findViewById(R.id.speakButton); 

     wordsList = (ListView) findViewById(R.id.list); 

     // Disable button if no recognition service is present 
     PackageManager pm = getPackageManager(); 
     List<ResolveInfo> activities = pm.queryIntentActivities(
       new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); 
     if (activities.size() == 0) 
     { 
      speakButton.setEnabled(false); 
      speakButton.setText("Recognizer not present"); 
     } 
    } 
    public void speakButtonClicked(View v) 
    { 
     startVoiceRecognitionActivity(); 
    } 
    private void startVoiceRecognitionActivity() 
    { 
     Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); 
     intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, 
       RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); 
     intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo..."); 
     startActivityForResult(intent, REQUEST_CODE); 
    } 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
    { 
     if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) 
     { 
      // Populate the wordsList with the String values the recognition engine thought it heard 
      ArrayList<String> matches = data.getStringArrayListExtra(
        RecognizerIntent.EXTRA_RESULTS); 
      wordsList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, 
        matches)); 
     } 
     super.onActivityResult(requestCode, resultCode, data); 
    } 
} 

이 예제는 인터넷에서 작동합니다. 인터넷 및 Google 서버없이 검색 단어를 원합니다. 어떻게해야합니까?

답변

1

사도르 (Sardor), 귀하의 요구를 직접 충족시킬 방법이 없습니다. 귀하의 설명을 통해, 당신은 오프라인 ASR이 영어 단어 목록을 포함하는 여분의 자원을 찾고 있습니다. 일부 음성 회사는 오프라인 ASR을 지원합니다. 리소스를 사용자 지정하기 위해 연락을 시도 할 수 있습니다. 행운을 빕니다.

1

당신은 포켓 스핑크스 http://cmusphinx.sourceforge.net/

를 사용하지만 음성 인식 분야에 익숙하고, 음향 모델 자신을 구축해야합니다. http://voxforge.org의 무료 음성 코퍼스를 사용하여 음향 모델을 구축하거나 인터넷에서 이미 제작 된 음향 모델을 찾을 수 있습니다.

+0

CMUSphinx 배포본의 모델이 voxforge 모델보다 나은 점만 제외하면 모든 것이 정확합니다. 최신 모델은 http://cmusphinx.sourceforge.net/wiki/download에서 찾을 수 있습니다. –

1

Android JellyBean (이상)을 사용하는 경우 언어 팩을 다운로드하여 오프라인 음성 인식에 사용할 수 있습니다.

로 이동 : 설정 -> 언어 및 입력 -> 음성 검색 -> 오프라인 음성 인식. 사용할 언어 팩을 다운로드하십시오.