有适用于 Android 的土耳其语 TTS api 吗?

发布于 2025-01-06 13:40:00 字数 56 浏览 0 评论 0原文

Android 上有免费的土耳其语 TTS(文本转语音)服务吗?我在谷歌上没有找到任何有用的东西。

Is there any free TTS (text-to-speech) service for Android in Turkish? I've not found anything useful in google.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

挽手叙旧 2025-01-13 13:40:00

我还没有在 Android 上尝试过,但我最近发现了这个: http://www.ispeech.org
网络应用程序上的语音质量看起来很有希望。

试一试:)

I didnt try it yet on android, but I recently discovered this one: http://www.ispeech.org
The speech quality looks promising on the web app.

Give it a shot :)

锦欢 2025-01-13 13:40:00

在这里您可以使用 Google TTS,如下所示:

strText =  converToTurkishCharacter(strText);
     if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {


                            @Override
                            public void onInit(int status) {

                                Locale locale = new Locale("tr_TR");//set Locale
                                textToSpeech.setLanguage(locale);


                                if (status != TextToSpeech.ERROR) {

                                }
                                if (status == TextToSpeech.SUCCESS) {


                                    String[] text = strText.split("\\.");//split with every "dot"

                                    for (int i = 0; i < text.length; i++) {
                                        HashMap uttrerance = new HashMap();
                                        uttrerance.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, Integer.toString(i));
                                        textToSpeech.speak(text[i], 1, uttrerance);

                                    }
                                }


                                //-------checks engine
                                List engineList = textToSpeech.getEngines();

                                for(Object strEngine : engineList){
                                    Log.d("tagg",strEngine.toString());
                                    if(strEngine.toString().equals("EngineInfo{name=com.google.android.tts}")){//check if google tts api engine is installed on device

                                        isGoogleAvaible = true;
                                    }
                                }
                                if(!isGoogleAvaible){
                                    Toast toast = Toast.makeText(ActivityColumnistArticle.this,
                                            "Google TTS Eksik...Lutfen yukleyin", Toast.LENGTH_LONG);
                                    toast.setGravity(Gravity.BOTTOM, 0, 0);
                                    toast.show();
                                    Intent intent = new Intent(Intent.ACTION_VIEW);
                                    intent.setData(Uri.parse("market://details?id=com.google.android.tts"));
                                    startActivity(intent);//user should install google tts , if it is defaultly not installed
                                }
                                //---------------For missing data
                                int code = textToSpeech.isLanguageAvailable(locale);
                                if (code == -2 || code == -1) {
                                    Intent installIntent = new Intent();
                                    installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                                    startActivity(installIntent);
                                }
                            }

                        }, "com.google.android.tts");
                    }
                    else{
                        Toast toast = Toast.makeText(ActivityColumnistArticle.this,
                                "Ses destegi icin minumum Icecream Sandwich yuklu olmalı...", Toast.LENGTH_LONG);
                        toast.setGravity(Gravity.BOTTOM, 0, 0);
                        toast.show();
                    }

此外,Google TTS 对土耳其语字符(如“ö”、“ğ”)有错误,因此您应该使用 unicode 转换它们:

    private String converToTurkishCharacter(String text){


           text = text.replace("\u015f", "\u015f");
           text = text.replace("\u00e7", "\u00e7");
           text = text.replace("\u011f", "\u011f");
           text = text.replace("\u0131", "\u0131");
           text = text.replace("\u00fc", "\u00fc");
           text = text.replace("\u00f6", "\u00f6");
          // ----
           text = text.replace("\u011e", "\u011e");
           text = text.replace("\u0130", "\u0130");
           text = text.replace("\u00d6", "\u00d6");
           text = text.replace("\u00dc", "\u00dc");
           text = text.replace("\u015e", "\u015e");
           text = text.replace("\u00c7", "\u00c7");
           return  text;
       }

有些 Android 设备只有 pico TTS,所以这就是您检查 Google 的原因TTS,并要求用户安装...

不是:为了 tts 工作,您应该有真正的 Android 设备

Here you can use Google TTS as below:

strText =  converToTurkishCharacter(strText);
     if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {


                            @Override
                            public void onInit(int status) {

                                Locale locale = new Locale("tr_TR");//set Locale
                                textToSpeech.setLanguage(locale);


                                if (status != TextToSpeech.ERROR) {

                                }
                                if (status == TextToSpeech.SUCCESS) {


                                    String[] text = strText.split("\\.");//split with every "dot"

                                    for (int i = 0; i < text.length; i++) {
                                        HashMap uttrerance = new HashMap();
                                        uttrerance.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, Integer.toString(i));
                                        textToSpeech.speak(text[i], 1, uttrerance);

                                    }
                                }


                                //-------checks engine
                                List engineList = textToSpeech.getEngines();

                                for(Object strEngine : engineList){
                                    Log.d("tagg",strEngine.toString());
                                    if(strEngine.toString().equals("EngineInfo{name=com.google.android.tts}")){//check if google tts api engine is installed on device

                                        isGoogleAvaible = true;
                                    }
                                }
                                if(!isGoogleAvaible){
                                    Toast toast = Toast.makeText(ActivityColumnistArticle.this,
                                            "Google TTS Eksik...Lutfen yukleyin", Toast.LENGTH_LONG);
                                    toast.setGravity(Gravity.BOTTOM, 0, 0);
                                    toast.show();
                                    Intent intent = new Intent(Intent.ACTION_VIEW);
                                    intent.setData(Uri.parse("market://details?id=com.google.android.tts"));
                                    startActivity(intent);//user should install google tts , if it is defaultly not installed
                                }
                                //---------------For missing data
                                int code = textToSpeech.isLanguageAvailable(locale);
                                if (code == -2 || code == -1) {
                                    Intent installIntent = new Intent();
                                    installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                                    startActivity(installIntent);
                                }
                            }

                        }, "com.google.android.tts");
                    }
                    else{
                        Toast toast = Toast.makeText(ActivityColumnistArticle.this,
                                "Ses destegi icin minumum Icecream Sandwich yuklu olmalı...", Toast.LENGTH_LONG);
                        toast.setGravity(Gravity.BOTTOM, 0, 0);
                        toast.show();
                    }

Moreover, Google TTS have bug with türkish character like "ö", "ğ" so that you should convert them with unicode:

    private String converToTurkishCharacter(String text){


           text = text.replace("\u015f", "\u015f");
           text = text.replace("\u00e7", "\u00e7");
           text = text.replace("\u011f", "\u011f");
           text = text.replace("\u0131", "\u0131");
           text = text.replace("\u00fc", "\u00fc");
           text = text.replace("\u00f6", "\u00f6");
          // ----
           text = text.replace("\u011e", "\u011e");
           text = text.replace("\u0130", "\u0130");
           text = text.replace("\u00d6", "\u00d6");
           text = text.replace("\u00dc", "\u00dc");
           text = text.replace("\u015e", "\u015e");
           text = text.replace("\u00c7", "\u00c7");
           return  text;
       }

Some android device have pico TTS only, so that is why you check Google TTS, and ask user to install...

Not:In order tts to work,You should have real android device

卖梦商人 2025-01-13 13:40:00

我在我的例子中解决了这个问题,

定义该变量:

最终语言环境 locale = new Locale("tr", "TR");

在onCreate方法中:

 tts = new TextToSpeech(getApplicationContext(), new
      TextToSpeech.OnInitListener() {
            @覆盖
            公共无效onInit(int状态){

                 如果(状态== TextToSpeech.SUCCESS){
                    int 结果 = tts.setLanguage(locale);
                    如果(结果== TextToSpeech.LANG_MISSING_DATA
                            ||结果== TextToSpeech.LANG_NOT_SUPPORTED) {
                        tts.speak("bir sorun oluştu", TextToSpeech.QUEUE_FLUSH, null);
                    }
                } 别的 {
                    tts.speak("bir sorun oluştu.", TextToSpeech.QUEUE_FLUSH, null);
                    Log.d(TAG, "文字转语音不成功");
                }
            }
        });
       tts.speak("bağlanıyor", TextToSpeech.QUEUE_FLUSH, null);

它会说“bağlanıyor”

I fixed this problem in my case,

define that variable:

final Locale locale = new Locale("tr", "TR");

in onCreate method:

      tts = new TextToSpeech(getApplicationContext(), new
      TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int status) {

                 if (status == TextToSpeech.SUCCESS) {
                    int result = tts.setLanguage(locale);
                    if (result == TextToSpeech.LANG_MISSING_DATA
                            || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                        tts.speak("bir sorun oluştu", TextToSpeech.QUEUE_FLUSH, null);
                    }
                } else {
                    tts.speak("bir sorun oluştu.", TextToSpeech.QUEUE_FLUSH, null);
                    Log.d(TAG, "Text to speech is not successful");
                }
            }
        });
       tts.speak("bağlanıyor", TextToSpeech.QUEUE_FLUSH, null);

it will say "bağlanıyor"

皇甫轩 2025-01-13 13:40:00

只需使用 Locale.getDefault()

tts.setLanguage(Locale.getDefault())

just use Locale.getDefault()

tts.setLanguage(Locale.getDefault())

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文