多种语言的语音转文本(支持波斯语和阿拉伯语)
Speech to text in multiple languages (support Persian and Arabic languages)
有谁知道 iOS 中的 Convert Speech to text in multiple languages API 支持波斯语和阿拉伯语?
我使用 Swift 语言
您可以使用 isAvailable
属性 :
检查特定语言环境是否可以使用语音识别
let recognier = SFSpeechRecognizer(locale: Locale(identifier: "fa_IR"))
print(recognier?.isAvailable) //nil
遗憾的是它不适用于波斯语。
但它适用于阿拉伯语及其大部分变体:
let recognier = SFSpeechRecognizer(locale: Locale(identifier: "ar_SA"))
print(recognier?.isAvailable) //Optional(true)
要获取所有受支持的语言环境,请使用类型方法 supportedLocales()
:
print(SFSpeechRecognizer.supportedLocales().sorted {
[=12=].description < .description
})
输出:
[ar-SA (fixed), ca-ES (fixed), cs-CZ (fixed), da-DK (fixed), de-AT (fixed),
de-CH (fixed), de-DE (fixed), el-GR (fixed), en-AE (fixed), en-AU (fixed),
en-CA (fixed), en-GB (fixed), en-ID (fixed), en-IE (fixed), en-IN (fixed),
en-NZ (fixed), en-PH (fixed), en-SA (fixed), en-SG (fixed), en-US (fixed),
en-ZA (fixed), es-419 (fixed), es-CL (fixed), es-CO (fixed), es-ES (fixed),
es-MX (fixed), es-US (fixed), fi-FI (fixed), fr-BE (fixed), fr-CA (fixed),
fr-CH (fixed), fr-FR (fixed), he-IL (fixed), hi-IN (fixed), hi-IN-translit (fixed),
hi-Latn (fixed), hr-HR (fixed), hu-HU (fixed), id-ID (fixed), it-CH (fixed),
it-IT (fixed), ja-JP (fixed), ko-KR (fixed), ms-MY (fixed), nb-NO (fixed),
nl-BE (fixed), nl-NL (fixed), pl-PL (fixed), pt-BR (fixed), pt-PT (fixed),
ro-RO (fixed), ru-RU (fixed), sk-SK (fixed), sv-SE (fixed), th-TH (fixed),
tr-TR (fixed), uk-UA (fixed), vi-VN (fixed), wuu-CN (fixed), yue-CN (fixed),
zh-CN (fixed), zh-HK (fixed), zh-TW (fixed)]
有谁知道 iOS 中的 Convert Speech to text in multiple languages API 支持波斯语和阿拉伯语? 我使用 Swift 语言
您可以使用 isAvailable
属性 :
let recognier = SFSpeechRecognizer(locale: Locale(identifier: "fa_IR"))
print(recognier?.isAvailable) //nil
遗憾的是它不适用于波斯语。
但它适用于阿拉伯语及其大部分变体:
let recognier = SFSpeechRecognizer(locale: Locale(identifier: "ar_SA"))
print(recognier?.isAvailable) //Optional(true)
要获取所有受支持的语言环境,请使用类型方法 supportedLocales()
:
print(SFSpeechRecognizer.supportedLocales().sorted {
[=12=].description < .description
})
输出:
[ar-SA (fixed), ca-ES (fixed), cs-CZ (fixed), da-DK (fixed), de-AT (fixed),
de-CH (fixed), de-DE (fixed), el-GR (fixed), en-AE (fixed), en-AU (fixed),
en-CA (fixed), en-GB (fixed), en-ID (fixed), en-IE (fixed), en-IN (fixed),
en-NZ (fixed), en-PH (fixed), en-SA (fixed), en-SG (fixed), en-US (fixed),
en-ZA (fixed), es-419 (fixed), es-CL (fixed), es-CO (fixed), es-ES (fixed),
es-MX (fixed), es-US (fixed), fi-FI (fixed), fr-BE (fixed), fr-CA (fixed),
fr-CH (fixed), fr-FR (fixed), he-IL (fixed), hi-IN (fixed), hi-IN-translit (fixed),
hi-Latn (fixed), hr-HR (fixed), hu-HU (fixed), id-ID (fixed), it-CH (fixed),
it-IT (fixed), ja-JP (fixed), ko-KR (fixed), ms-MY (fixed), nb-NO (fixed),
nl-BE (fixed), nl-NL (fixed), pl-PL (fixed), pt-BR (fixed), pt-PT (fixed),
ro-RO (fixed), ru-RU (fixed), sk-SK (fixed), sv-SE (fixed), th-TH (fixed),
tr-TR (fixed), uk-UA (fixed), vi-VN (fixed), wuu-CN (fixed), yue-CN (fixed),
zh-CN (fixed), zh-HK (fixed), zh-TW (fixed)]