Skip to content

Commit

Permalink
Use the Amazon package as source for an up-to-date list of supported …
Browse files Browse the repository at this point in the history
…language codes.
  • Loading branch information
rotemdan committed Dec 6, 2024
1 parent eac810f commit 09b4793
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 62 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "echogarden",
"version": "2.0.11",
"version": "2.0.12",
"description": "An easy-to-use speech toolset. Includes tools for synthesis, recognition, alignment, speech translation, language detection, source separation and more.",
"author": "Rotem Dan",
"license": "GPL-3.0",
Expand Down
61 changes: 2 additions & 59 deletions src/recognition/AmazonTranscribeSTT.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Item, LanguageCode, StartStreamTranscriptionCommandInput } from '@aws-sdk/client-transcribe-streaming'
import { Item, LanguageCode, StartStreamTranscriptionCommandInput } from '@aws-sdk/client-transcribe-streaming'
import { wordCharacterPattern } from '../nlp/Segmentation.js'
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
import { Logger } from '../utilities/Logger.js'
Expand All @@ -10,7 +10,7 @@ export async function recgonize(rawAudio: RawAudio, languageCode: string, region

const logger = new Logger()

if (!supportedLanguageCodes.includes(languageCode)) {
if (!(languageCode in LanguageCode)) {
let matchingLanguageCode: string | undefined = undefined

if (languageCode.length === 2) {
Expand Down Expand Up @@ -127,63 +127,6 @@ export async function recgonize(rawAudio: RawAudio, languageCode: string, region
return { transcript, timeline }
}

export const supportedLanguageCodes: string[] = [
'af-ZA',
'ar-AE',
'ar-SA',
'ca-ES',
'cs-CZ',
'da-DK',
'de-CH',
'de-DE',
'el-GR',
'en-AB',
'en-AU',
'en-GB',
'en-IE',
'en-IN',
'en-NZ',
'en-US',
'en-WL',
'en-ZA',
'es-ES',
'es-US',
'eu-ES',
'fa-IR',
'fi-FI',
'fr-CA',
'fr-FR',
'gl-ES',
'he-IL',
'hi-IN',
'hr-HR',
'id-ID',
'it-IT',
'ja-JP',
'ko-KR',
'lv-LV',
'ms-MY',
'nl-NL',
'no-NO',
'pl-PL',
'pt-BR',
'pt-PT',
'ro-RO',
'ru-RU',
'sk-SK',
'so-SO',
'sr-RS',
'sv-SE',
'th-TH',
'tl-PH',
'uk-UA',
'vi-VN',
'zh-CN',
'zh-HK',
'zh-TW',
'zu-ZA',
]

export const languageCodeDefaultDialects: string[] = [
'af-ZA',
'ar-SA',
Expand Down

0 comments on commit 09b4793

Please sign in to comment.