5

Próbuję utworzyć zestaw umiejętności Alexy Alexa, aby wykonać jakąś automatyzację, która byłaby wymagana przy wprowadzaniu głosowym składającym się z ciągów i liczb (a-test12fish).Jak wprowadzić dane wejściowe do zestawu Alexa Skills Kit (ASK) z liczbami?

Kiedy korzystam z niestandardowych automatów do gry Alexa Skills Kit, to nie pozwalam mi wpisywać ciągów liczbowych. Kiedy próbuję wprowadzić ask alexa, dangerZone find a-test12fish, otrzymuję następujący błąd:

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

Jak mogę przezwyciężyć ten błąd?

+0

Witaj Sathish, wymyśliłeś to jeszcze? – Kal

Odpowiedz

0

Nie wskazałeś, w jaki sposób zamierzasz podać wartość. Na przykład: "test dwufajtowy", "myślnik dwanaście ryb" lub "myślnik", jeden drugi, drugi i trzeci ". W każdym przypadku system rozpoznawania został zaprojektowany do rozpoznawania słów, a dane nie są poprawnym słowem.

W celu rozwiązania problemu można spróbować utworzyć rozwiązanie do sprawdzania pisowni (ostatnie wejście), tworząc niestandardowy typ gniazda z wszystkimi ważnymi wartościami znaków i przykładowymi wypowiedziami, które obsługują prawidłowe długości.

Będziesz musiał trochę popracować nad złożeniem wiadomości, ale nie powinno to być zbyt skomplikowane. Prawdopodobne wyzwanie nadal będzie pochodzić od urządzenia rozpoznającego. Chociaż nie testowałem tego scenariusza pod Alexa, większość z nich użyłem raczej słabo ze zmienną długością, ciągi znaków alfanumerycznych. Dźwięki są zbyt podobne i istnieje kilka wartości, które można łatwo pomylić z pauzami i szumami tła. Typową pracą jest używanie phonetic alphabet.

+0

Dziękuję za wejście, chciałbym powiedzieć, że to "test łącznika jedna dwie ryby", oznacza to, że staram się używać alfabetu fonetycznego zgodnie z sugestią – Sathish

0

W ramach ograniczenia systemu można zastosować inne podejście. Można to nazwać inną nazwą.

Pytaj użytkownika o "powiedz 1 za testową rybę" i tak dalej. I wewnętrznie odwzoruj ją na określoną wartość.

-3

Użyj SSML, gdzie możesz zaprojektować swój własny styl wymowy. Sprawdź.

2

Oto rozwiązanie.

Prawdopodobnie nie chcesz tego robić w schemacie intencji. Zamiast tego spróbuj utworzyć tryb niestandardowy za pomocą Node.js, który kompiluje litery, cyfry i symbole w jedną odpowiedź. To jest moja interpretacja trybu wprowadzania liczb alfanumerycznych. Uwaga: Właśnie napisałem to w odpowiedzi na twoje pytanie i nie przetestowałem tego z większą umiejętnością. Powiedziałem, że odniosłem wielki sukces z MODES i na pewno zrealizuję to na własne umiejętności, gdy będę miał szansę.

Ideą tego kodu jest to, że pchasz użytkowników w trybie oddzielnym że ignoruje wszystkie zamiary inne niż NumberIntent, LetterIntent, SymbolIntent, a kilka funkcji pomocy. Użytkownik szybko wprowadza swoją wartość alfanumeryczną i po zakończeniu aktywuje Ukończony komunikat. Ta wartość alfanumeryczna może być następnie wykorzystana w innym miejscu w twoich umiejętnościach. Jeśli nie użyłeś Modes, zapamiętaj, że po zakończeniu lub wyjściu nastąpi przekierowanie z powrotem do LOBBYMODE, gdzie możesz kontynuować dostęp do innych intencji w swoich umiejętnościach.

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); 
    } 
}); 
Powiązane problemy