Skip to content

Commit

Permalink
inputs are utf-8 encoded now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardicus committed Dec 28, 2019
1 parent 65c93a0 commit fd0dd43
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ <h2 id="h2-descriptor">LSTM Neural Network, sample output viewer</h2>
'<' : "&lt",
'>' : "&gt",
'&' : "&amp"
};

function encode_utf8(s) {
return unescape(encodeURIComponent(s));
}

function decode_utf8(s) {
return decodeURIComponent(escape(s));
}

function write_positive_msg(msg, timeout=4) {
Expand Down Expand Up @@ -521,20 +529,6 @@ <h2 id="h2-descriptor">LSTM Neural Network, sample output viewer</h2>

report.sort(sort_feature_entries);



if ( debug ) {
/*
i = 0;
console.log("====== Top 10 probability (input: " + String.fromCharCode(parseInt(input_value)) + ")======");
while ( i < 10 && i < F ) {
console.log((i+1) + ". " + report[i]["feature"] + ": " + report[i]["probability"]);
i++;
}
*/
}


return report;
}

Expand Down Expand Up @@ -744,7 +738,7 @@ <h2 id="h2-descriptor">LSTM Neural Network, sample output viewer</h2>
var last_timeout;

function read_from_chars(i, time_in_between=500){
var string = document.getElementById('chars-input').value;
var string = encode_utf8(document.getElementById('chars-input').value);

if ( i == string.length ) {
document.getElementById('chars-input').value = "";
Expand Down

0 comments on commit fd0dd43

Please sign in to comment.