// ARRAY DI PAROLE NORMALE, POI PYTHON -> split, for loop, POS e <span con classe POS in html
// The Myth of the Natural Language %%
// Speech2Design!!
@ -12,13 +11,11 @@
// An API is a set of defined rules that explain how computers or applications communicate with one another.
// APIs sit between an application and the web server, acting as an intermediary layer that processes data transfer between systems.
// GLOBAL VARIABLES
letinterimTranscripts="";// Variable for interim results, the Speech-to-text try different worlds before to give us the most correct one.
letallTheInterim="";// Variable to store *all* the interim results
letfinalTranscripts="";// Variable for the... final transcripts
letfinalTranscripts="";// Variable for the final transcripts
// To define bridges to the html file:
letspeech=document.getElementById("result");// where to print the final result of the recognition
@ -28,12 +25,13 @@ let process = document.getElementById("process"); // and here the process, pri
lettextStorage=localStorage.getItem("speech");// This define where to save the results.
speech.innerHTML=textStorage;// LocalStorage is a type of web storage that allows you to access a local Storage object and store the data in the browser with no expiration date.
finalTranscripts=textStorage;
// RESET STORAGE
letresetStorage=document.getElementById("reset");// This will just reset, through a button, all the results got by that moment.
}else{// There are also shown the interim results and according to their "confidence" (the percentage of how much the word is correct) the color of each word could change
finalTranscripts+=transcript+"\n";
}else{
// There are also shown the interim results and according to their "confidence" (the percentage of how much the word is correct) the color of each word could change
interimTranscripts+=transcript;
allTheInterim+=`<span style="opacity: ${
event.results[i][0].confidence+0.3
}">${interimTranscripts}</span>`;
allTheInterim+=`<span style="opacity:
${event.results[i][0].confidence+0.3}
">${interimTranscripts}</span>`;
}
}
process.innerHTML=allTheInterim;
@ -119,13 +123,15 @@ function startConverting() {
speech.innerHTML=final;
textStorage=final;
console.log(textStorage);
localStorage.setItem("speech",final);// Here is where is stored the recognized text in the Local Storage