Se preferisci lavorare con un agente esistente, va bene. Assicurati solo di attivare l'adattamento automatico del parlato nelle impostazioni dell'agente. Questa opzione è attiva per impostazione predefinita per i nuovi agenti.
Creazione di un'entità di riconoscimento delle sequenze
La funzione principale di questo agente è comprendere sequenze alfanumeriche tramite la voce. Nello specifico, configurerai l'agente in modo che ascolti alcuni caratteri alla volta, combinando infine tutte le sottosequenze prima di convalidare la sequenza finale in base a un datastore. Iniziamo definendo un'entità per riconoscere le sequenze parziali.
Crea le entità della sequenza regexp
Dobbiamo utilizzare un'entità regexp per acquisire le sequenze in modo che l'adattamento automatico del parlato sappia ascoltare "ABC" anziché "a bee sea".
Configuraremo l'entità in modo che accetti qualsiasi sequenza alfanumerica di almeno 3 caratteri. In un secondo momento, aggiungerai un webhook per convalidare la sequenza finale rispetto a un datastore o a un'API.
Crea una nuova entità. Lo chiameremo "alfanumerico" perché accetterà qualsiasi input alfanumerico.
Seleziona la casella Entità regexp.
Aggiungi una singola voce, ^[a-zA-Z0-9]{3}[a-zA-Z0-9]*$
Fai clic su SALVA.
Tieni presente che la regex che hai aggiunto è molto rigida in quanto cerca solo una stringa di caratteri alfanumerici, senza spazi o trattini. Questo è importante per due motivi:
Questa regex segue i requisiti per l'adattamento automatico del parlato per attivare la modalità di riconoscimento "sequenza dettata".
Se non cerchi spazi e cerchi solo frasi intere (^...$),
consenti agli utenti finali di uscire facilmente dal riconoscimento di sequenze. Ad esempio,
quando chiedi "qual è il tuo numero d'ordine" e un utente finale risponde
"no, voglio effettuare un ordine", la regexp viene rifiutata e Dialogflow lo sa
che deve cercare un altro intento che potrebbe corrispondere a quella frase.
Se ti interessano solo i valori numerici, puoi creare un'entità più personalizzata come [0-9]{3}[0-9]* o anche utilizzare semplicemente l'entità @sys.number-sequence integrata.
Il resto del tutorial presuppone che tu stia raccogliendo sequenze alfanumeriche. Vai alla sezione successiva per scoprire come configurare gli intent per raccogliere queste sequenze.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis tutorial guides users through setting up a Dialogflow agent to recognize alphanumeric sequences over voice input.\u003c/p\u003e\n"],["\u003cp\u003eUsers should first create a new Dialogflow agent, or use an existing one that has auto speech adaptation enabled in the agent settings.\u003c/p\u003e\n"],["\u003cp\u003eA regexp entity, named "alphanumeric," is created to recognize partial alphanumeric sequences, adhering to auto speech adaptation guidelines with the format \u003ccode\u003e^[a-zA-Z0-9]{3}[a-zA-Z0-9]*$\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe defined regexp entity strictly looks for strings of alphanumerics without spaces or dashes, allowing for recognition of spelled-out sequences and easy exit from sequence recognition.\u003c/p\u003e\n"],["\u003cp\u003eFor numeric-only values, the user could opt to make a more tailored entity like \u003ccode\u003e[0-9]{3}[0-9]*\u003c/code\u003e, or use the built-in \u003ccode\u003e@sys.number-sequence\u003c/code\u003e entity.\u003c/p\u003e\n"]]],[],null,["# Before you begin\n\nBefore trying this tutorial,\nyou should be familiar with Dialogflow basics covered in\n[Quickstarts](/dialogflow/docs/quick).\n\nCreate an agent\n---------------\n\nUse the [Dialogflow ES console](https://dialogflow.cloud.google.com) to create an agent named \"PackageTracker\".\nIf you are unsure how to do this,\nrevisit the [Quickstarts](/dialogflow/docs/quick).\n\nIf you prefer to work with an existing agent, that is okay too. Just be sure that you\n[enable auto speech adaptation](/dialogflow/es/docs/speech-adaptation#enable_or_disable_auto_speech_adaptation)\nin the agent settings. This is enabled by default for new agents.\n\nCreate a sequence recognizer entity\n===================================\n\nThe core function of this agent is understanding alphanumeric sequences over\nvoice. Specifically, you'll set up the agent to listen for a handful of characters\nat a time, eventually putting all sub-sequences together before validating the\nfinal sequence against a data store. Let's start by defining an entity to\nrecognize the partial sequences.\n\nCreate the regexp sequence entities\n-----------------------------------\n\nWe need to use a regexp entity to capture sequences so that auto speech\nadaptation will know to listen for \"ABC\" instead of \"a bee sea\".\n\nThese entities must conform to the\n[auto speech adaptation regexp enitity guidelines](/dialogflow/es/docs/speech-adaptation#regexp_entities)\nto ensure the speech recognition is tuned to recognize spelled-out sequences.\n\n### Partial sequence entity\n\nWe'll set up the entity to accept any alphanumeric sequence of at least 3\ncharacters. Later, you'll add a webhook so that you can validate the final\nsequence against a data store or API.\n\n1. Create a new entity. We'll name it \"alphanumeric\" because it will accept any alphanumeric input.\n2. Check the box for **Regexp entity**\n3. Add a single entry, `^[a-zA-Z0-9]{3}[a-zA-Z0-9]*$`\n4. Click **SAVE**.\n\nNotice that the regexp you added is very strict in that it is looking only for\na string of alphanumerics, without any spaces or dashes. This is important for\ntwo reasons:\n\n1. This regexp follows the auto speech adaptation [requirements](/dialogflow/es/docs/speech-adaptation#regexp_entities) for enabling the \"spelled-out sequence\" recognizer mode.\n2. By not looking for spaces and only looking for entire phrases (`^`...`$`), you allow end-users to easily exit the sequence recognition. For example, when you prompt \"what's your order number\" and an end-user replies \"no I want to place an order\", the regexp will reject and Dialogflow will know to look for another intent that might match that phrase.\n\nIf you are only interested in numeric values, you could create a more tailored\nentity like `[0-9]{3}[0-9]*`, or even just use the built-in `@sys.number-sequence`\nentity.\n\nThe rest of the tutorial assumes you are collecting alphanumeric sequences. Jump\nto the next section to see how to set up intents to collect these sequences."]]