Languages
import { createAgentInput } from 'alkove'
const input = await createAgentInput({ langs: ['fr', 'en'] })input.on('language', ({ lang, p }) => stt.setLanguage(lang))Each utterance gives a language event once it ends, 0.8 s after the last speech: { lang, p, start, end }, the language heard among the ones loaded and its probability among them, start and end in seconds. It comes from a small head (264 KB, alkove-spot-1-lang.alk) on the first layers Spot shares with Cue: no wake word or command model runs for it.
Which languages
Section titled “Which languages”French, English, Spanish, Portuguese, Italian, Catalan, Romanian, German, Dutch, Polish and Swedish (fr, en, es, pt, it, ca, ro, de, nl, pl, sv).
The head chooses only among the languages loaded: load the ones your users speak, two at least. With one language there is no head and no event. A language outside the list comes out as the closest one loaded.
The languages of an input’s wake words and commands count too: an input with French and English commands gives language without langs. The commands of the language heard are the ones decoded; when that language has none, the first language’s are.
On every platform
Section titled “On every platform”- Web:
langsoncreateAgentInput,createCallInputandcreateWakeListener;input.on('language', …). - React Native:
langson the agent input and the wake listener;on.language. - Flutter:
langsinAgentOptionsandWakeOptions; theLanguageevent. - Android:
langsinAgentOptionsandWakeOptions;Event.Language. For aListeneron your own audio,Models.load(context, listOf("cue", "spot-lang"), langs = listOf("fr", "en")). - iOS:
langsinAgentOptionsandWakeOptions;.language(LanguageEvent). For aListeneron your own audio,Models.load(["cue", "spot-lang"], langs: ["fr", "en"]). - Python:
Models.load(["cue", "spot-lang"], langs=["fr", "en"]);LiveandListeneron those models givelanguageevents.Processorandprocess()do not.
On an agent or a call input, the head hears the audio after Focus; on a wake listener, the microphone.
Alkove.preload('agent', { langs: ['fr', 'en'] }) and Alkove.cached count the head and Spot’s bottom in, on the web, in React Native, in Flutter, on Android and on iOS, as they do for a call.
How well
Section titled “How well”FLEURS dev (CC BY 4.0): 3,849 sentences read aloud in the 11 languages (171 to 400 per language), through the SDK’s core with the files this version ships, the 11 languages loaded. The same sentences whole, then cut after 1, 2 and 3 s of speech:
| Speech heard | Right among the 11 | Right between its language and one other |
|---|---|---|
| A whole sentence (9 to 14 s on average) | 99.2 % | 99.9 % |
| 3 s | 91.2 % | 97.1 % |
| 2 s | 81.1 % | 93.4 % |
| 1 s | 60.1 % | 85.5 % |
The last column is an app with two languages loaded: the mean of the 10 pairs. At 3 s of speech, among the 11: English 98.0 %, Spanish 97.3 %, Portuguese 96.9 %, Italian 96.4 %, Catalan 96.0 %, Swedish 93.0 %, Polish 92.6 %, French 89.6 %, Romanian 86.1 %, Dutch 84.8 %, German 72.5 %.
Limits
Section titled “Limits”- It needs speech: a short command of a second or two is often given the wrong language among many. Load only the languages your users speak.
- German said briefly is the weakest: at 3 s of speech it is told from English 75.8 % of the time. Romanian, when wrong, is most often taken for Italian.
- One language per utterance: a sentence that mixes two gets one of them.