Skip to content

Commit

Permalink
remove demo-code from recognizer, addes source
Browse files Browse the repository at this point in the history
  • Loading branch information
wasnoplus committed Sep 25, 2020
1 parent ff9a80a commit dff3399
Show file tree
Hide file tree
Showing 4 changed files with 447 additions and 494 deletions.
19 changes: 18 additions & 1 deletion demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="marking.js"></script>
<script type="text/javascript">
const resultHandler = markWord;
const resetHandler = resetColors;
</script>
<script type="text/javascript" src="../script/resultHandling.js"></script>
</head>
<body style='width: 100%; height: 100%'>
Expand Down Expand Up @@ -74,7 +78,7 @@

if ($i == 5) {
echo '<td colspan="2">';
echo '<vosk-recognizer model-url="model-nl.tar.gz" oneshot></vosk-recognizer>';
// echo '<vosk-recognizer model-url="model-nl.tar.gz" oneshot></vosk-recognizer>';
echo '<script src="../script/VoskJS.js"></script>';
echo '</td>';
}
Expand All @@ -84,5 +88,18 @@
}
?>
</table>


<script type="text/javascript">
thisRec = new VoskJS.Recognizer("model-nl.tar.gz")
thisRec.onresult = result => {
if (result.result) {
handleResult(result, markWord, resetColors)
}
}
thisRec.getActive().then(active => thisRec.setActive(!active));
</script>


</body>
</html>
7 changes: 1 addition & 6 deletions demo/marking.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ function markWord(word, conf) {
}
function resetColors() {
$('td').css('background-color', 'white');
}


$(document).ready(function(){
// todo start listening
})
}
Loading

0 comments on commit dff3399

Please sign in to comment.