master
funix 3 years ago
parent affd553d22
commit daa4767889

BIN
layout/.DS_Store vendored

Binary file not shown.

@ -0,0 +1,17 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/1.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
<div class="newchapter">
<h1>I WISH I COULD SHOW YOU A PICTURE OF WHAT I GOT🤮</h1>
</div>
</body>
</html>

@ -0,0 +1,35 @@
import nltk
nltk.download('punkt')
with open('speech.txt','r') as result:
r = result.read()
r = r.replace('<span class="interim"></span>','').replace('\n','. ')
l=nltk.word_tokenize(r)
pos = nltk.pos_tag(l)
html = '''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/1.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
'''
for x in pos:
if x[0] == '.':
html += "<span class='dot'>.<span><br> "
else:
html += "<span class='"+x[1]+"'>"+x[0]+"<span> "
html = '''</body>
</html>'''
with open('index.html','w') as index:
index.write(html)

@ -0,0 +1,3 @@
and again are we are
let's see if it works again with these fantastic xt500
<span class="interim"></span>

@ -0,0 +1,37 @@
import nltk
with open('speech.txt','r') as result:
r = result.read()
r = r.replace('<span class="interim"></span>','').replace('\n','. ')
l=nltk.word_tokenize(r)
pos = nltk.pos_tag(l)
html = '''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/1.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
'''
for x in pos:
if x[0] == '.':
html += "<span class='dot'>.</span><br> "
else:
html += "<span class='"+x[1]+"'> "+x[0]+"</span>"
html += '''</body>
</html>'''
html = html.replace(' .','.').replace(" '", "'")
with open('index.html','w') as index:
index.write(html)

@ -1,3 +1,4 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -7,11 +8,6 @@
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
<div class="newchapter">
<h1>I WISH I COULD SHOW YOU A PICTURE OF WHAT I GOT🤮</h1>
</div>
</body>
<span class='JJ'> ok</span><span class='NN'> let</span><span class='POS'>'s</span><span class='NN'> talk</span><span class='IN'> in</span><span class='NNP'> English</span><span class='IN'> for</span><span class='NN'> awhile</span><span class='WP'> what</span><span class='VBP'> are</span><span class='PRP'> we</span><span class='VBG'> eating</span><span class='dot'>.</span><br> <span class='CC'> or</span><span class='RB'> not</span><span class='IN'> so</span><span class='PRP'> it</span><span class='VBZ'> is</span><span class='VBG'> starting</span><span class='RB'> again</span><span class='dot'>.</span><br> <span class='JJ'> ok</span><span class='NN'> navigate</span><span class='dot'>.</span><br> <span class='PRP'> you</span><span class='VBP'> need</span><span class='TO'> to</span><span class='VB'> rest</span><span class='RB'> sometimes</span><span class='dot'>.</span><br> <span class='RB'> also</span><span class='VBD'> implemented</span><span class='IN'> that</span><span class='VBG'> implementing</span><span class='dot'>.</span><br> <span class='PRP'> he</span><span class='VBZ'>'s</span><span class='DT'> a</span><span class='NN'> sentence</span><span class='CC'> and</span><span class='PRP'> we</span><span class='VBP'> are</span><span class='RB'> not</span><span class='JJ'> interested</span><span class='dot'>.</span><br> <span class='VB'> remember</span><span class='dot'>.</span><br> <span class='RB'> so</span><span class='RB'> basically</span><span class='NN'> sentence</span><span class='dot'>.</span><br> <span class='WRB'> where</span><span class='VBZ'> is</span><span class='TO'> to</span><span class='VB'> go</span><span class='DT'> a</span><span class='NN'> couple</span><span class='CC'> and</span><span class='RB'> then</span><span class='PRP'> you</span><span class='VBP'> put</span><span class='DT'> the</span><span class='NN'> adult</span><span class='dot'>.</span><br> <span class='DT'> a</span><span class='RB'> bit</span><span class='JJR'> easier</span><span class='TO'> to</span><span class='VB'> understand</span><span class='dot'>.</span><br> <span class='RB'> actually</span><span class='RB'> maybe</span><span class='NNS'> people</span><span class='RB'> just</span><span class='VBP'> do</span><span class='RB'> n't</span><span class='RB'> just</span><span class='dot'>.</span><br> <span class='PRP'> I</span><span class='VBP'>'m</span><span class='RB'> just</span><span class='VBG'> thinking</span><span class='PRP'> it</span><span class='VBZ'>'s</span><span class='RB'> not</span><span class='DT'> the</span><span class='NNS'> centres</span><span class='VBP'> do</span><span class='RB'> n't</span><span class='VB'> put</span><span class='DT'> the</span><span class='NN'> dot</span><span class='CC'> and</span><span class='RB'> just</span><span class='VB'> put</span><span class='DT'> a</span><span class='NN'> couple</span><span class='dot'>.</span><br> <span class='IN'> because</span><span class='RB'> then</span><span class='dot'>.</span><br> <span class='PRP'> they</span><span class='VBP'> are</span><span class='VBG'> talking</span><span class='PRP'> they</span><span class='VBP'> are</span><span class='DT'> a</span><span class='NN'> booklet</span><span class='CC'> but</span><span class='PRP'> they</span><span class='VBP'> are</span><span class='RB'> not</span><span class='VBG'> writing</span><span class='dot'>.</span><br> <span class='IN'> so</span><span class='PRP'> it</span><span class='VBZ'> is</span><span class='RB'> just</span><span class='JJ'> fine</span><span class='dot'>.</span><br> <span class='RB'> so</span><span class='VBP'> are</span><span class='PRP'> you</span><span class='VBN'> done</span><span class='dot'>.</span><br> <span class='CC'> and</span><span class='RB'> now</span><span class='VBZ'> is</span><span class='JJ'> f</span><span class='NNP'> *</span><span class='NNP'> *</span><span class='NNP'> *</span><span class='NNP'> *</span><span class='NNP'> *</span><span class='RB'> up</span><span class='dot'>.</span><br> </body>
</html>

@ -0,0 +1,131 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "35367849-a425-404c-bbbd-d8d7138f1838",
"metadata": {},
"outputs": [],
"source": [
"import nltk\n",
"\n",
"with open('../speech.txt','r') as result:\n",
" r = result.read()\n",
" \n",
"r = r.replace('<span class=\"interim\"></span>','').replace('\\n','. ')\n",
"\n",
"l=nltk.word_tokenize(r)\n",
"pos = nltk.pos_tag(l)\n",
"\n",
"html = ''\n",
"for x in pos:\n",
" if x[0] == '.':\n",
" html += \"<span class='dot'>.<span><br> \"\n",
" else:\n",
" html += \"<span class='\"+x[1]+\"'> \"+x[0]+\"<span>\"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "0d1737d0-cda2-4208-9585-487ef809bdff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"<span class='CC'>and<span> <span class='RB'>again<span> <span class='VBP'>are<span> <span class='PRP'>we<span> <span class='VBP'>are<span> <span class='dot'>.<span><br> <span class='NN'>let<span> <span class='POS'>'s<span> <span class='VB'>see<span> <span class='IN'>if<span> <span class='PRP'>it<span> <span class='VBZ'>works<span> <span class='RB'>again<span> <span class='IN'>with<span> <span class='DT'>these<span> <span class='JJ'>fantastic<span> <span class='NN'>xt500<span> <span class='dot'>.<span><br> \""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"html"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "cfe7aecd-bcff-4e3b-81c2-0622434cf62b",
"metadata": {},
"outputs": [],
"source": [
"with open('index.html','w') as index:\n",
" index.write(html)"
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "8d2195b3-dc7a-4cdc-b599-5570766df12d",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 138,
"id": "02f79b41-8238-4fa1-9530-a84b5069bce0",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "c6e3cf8e-3493-463b-807a-89342e7c8731",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac322fc4-db27-42a3-aef0-ac0fbe3e26fb",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "1e02a152-1c3c-4e2c-b1aa-1a1f3172810c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "264c688c-aba4-4cf5-8f6d-b9b35c3a0969",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

@ -0,0 +1,131 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "35367849-a425-404c-bbbd-d8d7138f1838",
"metadata": {},
"outputs": [],
"source": [
"import nltk\n",
"\n",
"with open('../speech.txt','r') as result:\n",
" r = result.read()\n",
" \n",
"r = r.replace('<span class=\"interim\"></span>','').replace('\\n','. ')\n",
"\n",
"l=nltk.word_tokenize(r)\n",
"pos = nltk.pos_tag(l)\n",
"\n",
"html = ''\n",
"for x in pos:\n",
" if x[0] == '.':\n",
" html += \"<span class='dot'>.<span><br> \"\n",
" else:\n",
" html += \"<span class='\"+x[1]+\"'> \"+x[0]+\"<span>\"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "0d1737d0-cda2-4208-9585-487ef809bdff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"<span class='CC'>and<span> <span class='RB'>again<span> <span class='VBP'>are<span> <span class='PRP'>we<span> <span class='VBP'>are<span> <span class='dot'>.<span><br> <span class='NN'>let<span> <span class='POS'>'s<span> <span class='VB'>see<span> <span class='IN'>if<span> <span class='PRP'>it<span> <span class='VBZ'>works<span> <span class='RB'>again<span> <span class='IN'>with<span> <span class='DT'>these<span> <span class='JJ'>fantastic<span> <span class='NN'>xt500<span> <span class='dot'>.<span><br> \""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"html"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "cfe7aecd-bcff-4e3b-81c2-0622434cf62b",
"metadata": {},
"outputs": [],
"source": [
"with open('index.html','w') as index:\n",
" index.write(html)"
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "8d2195b3-dc7a-4cdc-b599-5570766df12d",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 138,
"id": "02f79b41-8238-4fa1-9530-a84b5069bce0",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "c6e3cf8e-3493-463b-807a-89342e7c8731",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac322fc4-db27-42a3-aef0-ac0fbe3e26fb",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "1e02a152-1c3c-4e2c-b1aa-1a1f3172810c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "264c688c-aba4-4cf5-8f6d-b9b35c3a0969",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

@ -0,0 +1 @@
<span class='CC'>and<span> <span class='RB'>again<span> <span class='VBP'>are<span> <span class='PRP'>we<span> <span class='VBP'>are<span> <span class='dot'>.<span><br> <span class='NN'>let<span> <span class='POS'>'s<span> <span class='VB'>see<span> <span class='IN'>if<span> <span class='PRP'>it<span> <span class='VBZ'>works<span> <span class='RB'>again<span> <span class='IN'>with<span> <span class='DT'>these<span> <span class='JJ'>fantastic<span> <span class='NN'>xt500<span> <span class='dot'>.<span><br>

@ -0,0 +1,18 @@
ok let's talk in English for awhile what are we eating
or not so it is starting again
ok navigate
you need to rest sometimes
also implemented that implementing
he's a sentence and we are not interested
remember
so basically sentence
where is to go a couple and then you put the adult
a bit easier to understand
actually maybe people just don't just
I'm just thinking it's not the centres don't put the dot and just put a couple
because then
they are talking they are a booklet but they are not writing
so it is just fine
so are you done
and now is f***** up
<span class="interim"></span>

@ -27,6 +27,163 @@
}
body{
font-size: 1.5vw;
text-align: justify;
text-justify: inter-word;
line-height: 1.8vw;
color: rgb(0,0,0)
}
span.CC{
background-color:#333300
}
span.CD{
background-color:#999900
}
span.DT{
background-color: #ff00ff
}
span.EX{
background-color: #006080
}
span.FW{
background-color:#f6f6ee
}
span.IN{
background-color:#ffccff
}
span.JJ{
background-color: #f2f2f2;
}
span.JJR{
background-color: #b3b3b3
}
span.JJS{
background-color:#737373
}
span.LS{
background-color:#666633
}
span.MD{
background-color:#00cc00
}
span.NN{
background-color:#33ff33
}
span.NNS{
background-color:#80ff80
}
span.NNP{
background-color:#ccffcc
}
span.PDT{
background-color:#ffd1b3
}
span.POS{
background-color:#ffb380
}
span.PRP{
background-color:#ff8533
}
span.PRP${
background-color:#e65c00
}
span.RB{
background-color:#ff8080
}
span.RBR{
background-color:#ff4d4d
}
span.RBS{
background-color:#e60000
}
span.RP{
background-color:#992600
}
span.SYM{
background-color:#99ff33
}
span.TO{
background-color: black
}
span.UH{
background-color:#ffff00
}
span.VB{
background-color: #000099
}
span.VBD{
background-color: #0000e6
}
span.VBG{
background-color:#1a1aff
}
span.VBN{
background-color: #4d4dff
}
span.VBP{
background-color: #b3b3ff
}
span.VBZ{
background-color: #ccccff
}
span.WDT{
background-color:#ccffff
}
span.WP{
background-color:#66ffff
}
span.WP${
background-color:#00e6e6
}
span.WRB{
background-color: #008080
}
.dot{
color: black;
}
/* Rules for everything */
body{
@ -40,15 +197,9 @@
}
p{
text-align: left;
font-size: 12px;
line-height: 15.5px;
}
h1{
text-align: center;
}
span{
color: white
}
}

@ -46,7 +46,7 @@ resetStorage.addEventListener("click", () => { // Reset everything!!!
let saveButton = document.getElementById("save"); // This will let you save the results in your desktop through a button
saveButton.addEventListener("click", () => {
download("speech.html", localStorage.getItem("speech"));
download("speech.txt", localStorage.getItem("speech"));
});
function download(filename, text) {
@ -103,7 +103,8 @@ function startConverting() {
// console.log(event.results[i][0]);
transcript.replace("\n", "<br>");
if (event.results[i].isFinal) {
finalTranscripts += '<span class="oneTranscript">'+transcript+'</span>';
// finalTranscripts += ' <span class="oneTranscript"> '+transcript+' </span> \n';
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: ${

Loading…
Cancel
Save