5

Sto provando a creare un kit di competenze di Amazon Alexa per eseguire un qualche tipo di automazione che sarebbe necessario per inserire un input vocale composto da stringhe e numeri (a-test12fish).Come dare input alla stringa mista con numeri di Amazon Alexa Skills Kit (ASK)?

Quando ho utilizzato slot personalizzate in Alexa Skills Kit, non mi consente di digitare stringhe con numeri. Quando provo a digitare ask alexa, dangerZone find a-test12fish, sto ottenendo il seguente errore:

Error: Invalid text input. Text should begin with alphabets and should only contain alphabets, whitespaces, periods or apostrophes

Come posso superare questo errore?

+0

Ciao Sathish, hai già scoperto questo? – Kal

risposta

0

Non hai indicato come intendevi che l'utente dicesse il valore. Ad esempio, "un trattino prova dodici pesci" o "un trattino t e s uno due f i s h". In ogni caso, il sistema di riconoscimento è progettato per riconoscere le parole e che i dati non sono una parola valida.

Per risolvere il problema, è possibile provare a creare una soluzione di ortografia (quest'ultimo input) creando un tipo di slot personalizzato con tutti i valori di caratteri validi e le espressioni di esempio supportano le lunghezze valide.

Si avrà del lavoro per riassemblare il messaggio, ma non dovrebbe essere troppo complicato. La probabile sfida sarà ancora dal riconoscimento. Sebbene non abbia provato questo scenario con Alexa, la maggior parte di quelli che ho usato è piuttosto scadente con stringhe alfanumeriche a lunghezza variabile. I suoni sono troppo simili e ci sono diversi valori che potrebbero facilmente essere scambiati per pause e rumori di sottofondo. Il tipico aggiramento è usare un phonetic alphabet.

+0

Grazie per l'input, mi piacerebbe dirlo come "un trattino test a due pesci", Mean mentre provo ad usare l'alfabeto fonetico come suggerito – Sathish

0

Un approccio diverso potrebbe essere giocato all'interno del limite del sistema. Potresti riferirlo con un nome diverso.

Richiedi all'utente con "diciamo 1 per a-test12fish" e così via. E mappalo internamente al tuo valore specifico.

-3

Usa SSML, dove puoi progettare il tuo stile di pronuncia. Per favore controlla.

2

Ecco una soluzione.

Probabilmente non si desidera completare questo nello schema di intento. Prova invece a creare una modalità personalizzata con Node.js che componga lettere, numeri e simboli in un'unica risposta. Questa è la mia interpretazione di una modalità di input alfanumerico. Nota: ho appena scritto questo in risposta alla tua domanda e non l'ho testato con abilità maggiori. Detto questo, ho avuto un grande successo con MODES e certamente lo implementerò nelle mie capacità quando ne avrò la possibilità.

L'idea alla base di questo codice è che si spinge gli utenti in una modalità separata che ignora tutti gli intenti diversi da NumberIntent, LetterIntent, SymbolIntent e alcune funzionalità di guida. L'utente inserisce rapidamente il loro valore alfanumerico e al completamento attiva il CompletedIntent. Questo valore alfanumerico può quindi essere usato altrove nella tua abilità. Se non hai utilizzato Modes, ricorda che al completamento o all'uscita sarai reindirizzato a LOBBYMODE dove puoi continuare ad accedere ad altri intenti nella tua abilità.

var lobbyHandlers = Alexa.CreateStateHandler(states.LOBBYMODE, { 

    'enterPasswordIntent': function() { 
     this.attributes['BUILDPASSWORD'] = ''; 
     this.handler.state = states.PASSWORDMODE; 
     message = ` You will now create a password one letter, number or symbol at a time. there will be no message after each entry. simply wait for alexa's ring to become solid blue then stay your next value. When you are satisfied say complete. Begin now by saying a number, letter, or keyboard symbol. `; 
     reprompt = `Please say a number letter or symbol`; 
     this.emit(':ask', message, reprompt); 
    }, 

    //Place other useful intents for your Skill here 

    'Unhandled': function() { 
     console.log("UNHANDLED"); 
     var reprompt = ` You're kind of in the middle of something. Say exit to end createing this password. otherwise say complete if you've stated the whole password. or repeat to hear the current password you've entered. `; 
     this.emit(':ask', reprompt, reprompt); 
    } 
}); 


var buildAlphaNumericPasswordHandlers = Alexa.CreateStateHandler(states.PASSWORDMODE, { 
    'numberIntent': function() {// Sample Utterance: ninty nine AMAZON.NUMBER 
     var number = this.event.request.intent.slots.number.value; //I believe this returns a string of digits ex: '999' 
     this.attributes['BUILDPASSWORD'] = this.attributes['BUILDPASSWORD'].concat(number); 
     message = ``; //No message to make saying the next letter, number or symbol as fluid as possible. 
     reprompt = `Please say the next number letter or symbol`; 
     this.emit(':ask', message, reprompt); 
    }, 
    'letterIntent': function() {// Sample Utterance: A -- Custom Slot LETTERS [A, b, c, d, e, ... ] 
     var letter = this.event.request.intent.slots.letter.value; 
     this.attributes['BUILDPASSWORD'] = this.attributes['BUILDPASSWORD'].concat(letter); 
     message = ``; //No message to make saying the next letter, number or symbol as fluid as possible. 
     reprompt = `Please say the next number letter or symbol`; 
     this.emit(':ask', message, reprompt); 
    }, 
    'symbolIntent': function() {// Sample Utterance: Dash -- Custom Slot SYMBOLS [Pound, Dash, Dollar Sign, At, Exclamation point... ] 
     var symbol = this.event.request.intent.slots.symbol.value; 

     // Create a dictionary object to map words to symbols ex Dollar Sign => $. Will need this because you likely cant put $ as a custom slot value. Can also map multiple names to the same value ex. Dash => Tack = \> "-" 
     var singleCharacterSymbol = symbolDict[symbol]; //^^^ Need to create dictionary 

     this.attributes['BUILDPASSWORD'] = this.attributes['BUILDPASSWORD'].concat(singleCharacterSymbol); 
     message = ``; //No message to make saying the next letter, number or symbol as fluid as possible. 
     reprompt = `Please say the next number letter or symbol`; 
     this.emit(':ask', message, reprompt); 
    }, 
    'CompleteIntent': function() { //Sample Utterance: Complete 
     console.log("COMPLETE"); 
     this.handler.state = states.LOBBYMODE; 
     var reprompt = ` Your entry has been saved, used to execute another function or checked against our database. `; 
     this.emit(':ask', reprompt, reprompt); 
    }, 
    'ExitIntent': function() { //Sample Utterance: Exit 
     console.log("EXIT"); 
     this.handler.state = states.LOBBYMODE; 
     message = `You have returned to the lobby, continue with the app or say quit to exit.`; 
     this.emit(':ask', message, message); 
    }, 
    'RepeatIntent': function() { 
     var currentPassword = this.attributes['BUILDPASSWORD']; 
     var currentPasswordExploded = currentPassword.replace(/(.)(?=.)/g, "$1 "); //insert a space between each character so alexa reads correctly. 
     var message = ` Your current entry is as follows. `+currentPasswordExploded; 
     var reprompt = ` say complete if you've stated the whole password. Otherwise continue to say numbers letters and symbols. `; 
     this.emit(':ask', reprompt, reprompt); 
    }, 
    'Unhandled': function() { 
     console.log("UNHANDLED"); 
     var reprompt = ` You're kind of in the middle of something. Say exit to end creating this password, say complete if you've stated the whole password, say repeat to hear the current password you've entered, or continue to state letters, numbers and symbols `; 
     this.emit(':ask', reprompt, reprompt); 
    } 
});