From fd296e49a2f6ab7a8fd31fd092d2df345ab1d94e Mon Sep 17 00:00:00 2001 From: lzzfnc Date: Wed, 6 Oct 2021 18:46:56 +0200 Subject: [PATCH] fixxees --- 0_speech/index.js | 3 +- 1_pythoning/1-2_NLTKing.py | 30 +++-- 1_pythoning/3_imageScraping.py | 41 +++---- 2_layout/1.html | 196 +++++++++++---------------------- 2_layout/2.html | 196 +++++++++++---------------------- 2_layout/styles/2.css | 163 ++++++++++++++------------- 2_layout/styles/3.css | 103 +++++++++-------- 2_layout/styles/style.css | 54 --------- speech.txt | 36 +++--- 9 files changed, 314 insertions(+), 508 deletions(-) delete mode 100755 2_layout/styles/style.css diff --git a/0_speech/index.js b/0_speech/index.js index 50918f8..efce599 100644 --- a/0_speech/index.js +++ b/0_speech/index.js @@ -103,7 +103,6 @@ function startConverting() { for (let i = event.resultIndex; i < event.results.length; i++) { let transcript = event.results[i][0].transcript; - transcript.replace("\n", "
"); if (event.results[i].isFinal) { finalTranscripts += transcript.trim() + "\n"; @@ -121,7 +120,7 @@ function startConverting() { let final = finalTranscripts + '' + interimTranscripts + ""; - speech.innerHTML = final; + speech.innerHTML = final.replaceAll("\n", "
"); window.scrollTo(0, document.body.scrollHeight); textStorage = final; diff --git a/1_pythoning/1-2_NLTKing.py b/1_pythoning/1-2_NLTKing.py index df1d084..9738e77 100644 --- a/1_pythoning/1-2_NLTKing.py +++ b/1_pythoning/1-2_NLTKing.py @@ -26,16 +26,15 @@ with open('../speech.txt', 'r') as speech: # let's import the text time.sleep(2) # check it in the console! - -text = text.replace('', - '').replace('\n', '. ') # delete this from the results - tokens = nltk.word_tokenize(text) # Tokenize the words :: split each word + # Elaborate the Part of Speech! It will create an array, a list pos = nltk.pos_tag(tokens) -print(pos) # print the array! -time.sleep(2) # check it in the console! + +# print(pos) # print the array! +# time.sleep(2) # check it in the console! + # To see all the POS tags, open the terminal and copy: # @@ -43,6 +42,10 @@ time.sleep(2) # check it in the console! # import nltk # nltk.help.upenn_tagset() +# see also: +# https://cheatography.com/deacondesperado/cheat-sheets/nltk-part-of-speech-tags/ + + # start the layouting :: html + css + paged.js >> # # declare html :: we will fill it in the process with loops @@ -51,26 +54,26 @@ time.sleep(2) # check it in the console! html = '' html1 = ''' - + + - 📡 💻📘 ''' html2 = ''' - + + - 📡 💻📘 @@ -80,6 +83,7 @@ html2 = ''' for e in pos: # e is the current element, pos is the array to process + print(e) if e[0] == '.': # if e is a dot, its class will be 'dot' html += " .
\n" @@ -95,10 +99,12 @@ html = html.replace(' .', '.').replace(" '", "'") # Save the files! -with open('../2_layout/1.html', 'w') as index: +with open('../2_layout/1.html', 'w', encoding='utf-8') as index: index.write(html1) index.write(html) + index.close() -with open('../2_layout/2.html', 'w') as index: +with open('../2_layout/2.html', 'w', encoding='utf-8') as index: index.write(html2) index.write(html) + index.close() diff --git a/1_pythoning/3_imageScraping.py b/1_pythoning/3_imageScraping.py index 8aa83bc..a7142f6 100644 --- a/1_pythoning/3_imageScraping.py +++ b/1_pythoning/3_imageScraping.py @@ -5,19 +5,20 @@ # With duckduckgo_images_api! -from duckduckgo_images_api import search # import the library for scrape -import time # to create delays :: for having a few seconds to check the console +from duckduckgo_images_api import search # import the library for scrape +# to create delays :: for having a few seconds to check the console +import time -with open('../speech.txt','r') as speech: # let's import the text - qq = speech.readlines() # and split it in lines, it will create an array, a list +with open('../speech.txt', 'r') as speech: # let's import the text + # and split it in lines, it will create an array, a list + qq = speech.readlines() print(qq) # print the array! time.sleep(2) # check qq in the console! - - # declare the first part of the text of the html, we will fill it - # in the process with loops +# declare the first part of the text of the html, we will fill it +# in the process with loops html = ''' @@ -32,11 +33,10 @@ html = ''' ''' +# Elaborate each line :: process every element of the array qq - # Elaborate each line :: process every element of the array qq - - # q is for "query", qq for "queries", because we will send requests to - # DuckDuckGo searching the text of each line of speech.txt +# q is for "query", qq for "queries", because we will send requests to +# DuckDuckGo searching the text of each line of speech.txt for q in qq: @@ -44,29 +44,24 @@ for q in qq: time.sleep(2) # check current q in the console! - q = q.strip() + q = q.strip() - if q == '''''': # This nope. - continue - - q = q.replace("\n","") # remove "\n", which means "return to the next line" + # remove "\n", which means "return to the next line" + q = q.replace("\n", "") - # Scrape images with search()! - # q is, indeed, the query for DuckDuckGo + # Scrape images with search()! + # q is, indeed, the query for DuckDuckGo results = search(q) r = results["results"][0]["image"] # get the http link to the image html += f""" {q} \n""" # Now let's fill the html with text and the pic html += f""" \n""" - - # Close the html text + # Close the html text html += ''' ''' html = html.replace(" '", "'") -with open(',,/2_layout/3.html','w') as index: # Save the file! +with open('../2_layout/3.html', 'w') as index: # Save the file! index.write(html) - - \ No newline at end of file diff --git a/2_layout/1.html b/2_layout/1.html index 12587e6..f77fd3d 100644 --- a/2_layout/1.html +++ b/2_layout/1.html @@ -1,149 +1,83 @@ - + + - 📡 💻📘 - ok - let - 's - talk - in - English - for - awhile - what - are - we - eating - .
- or - not - so + 12345 + multiply + function + hello 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 - .
+ working so - basically - sentence - .
- where - is - to - go - a - couple - and - then - you - put - the - adult - .
- a - bit - easier - to - understand - .
- actually - maybe - people - just - do - n't - just - .
- I - 'm - just - thinking - it - 's - not - the - centres - do - n't - put - the - dot - and - just - put - a - couple - .
- because - then - .
- they - are - talking - they - are - a - booklet - but - they - are - not - writing - .
+ much + better + now + good + purple so it - is - just - fine - .
- so + means + that + it + works + pumpkinMichaelnewspaper + canGoogle + speaker + small + America + to + see + how + it + goes + email + Sterling + Knight + part + of + speech + 20 + ok + independent + boilerplate + IKEA + where are + my + next + Tuesday + mum + barrister + assisted + into + months + turn + off + living + room + TVmaterial + lightstream + todayhello + to you - done - .
- and - now - is - f - * - * - * - * - * - up - .
+ CBR + 929 + ca + n't + encode + this + one + kodi + turn + bedroom + twoalways \ No newline at end of file diff --git a/2_layout/2.html b/2_layout/2.html index c22bdb1..13cd4b7 100644 --- a/2_layout/2.html +++ b/2_layout/2.html @@ -1,149 +1,83 @@ - + + - 📡 💻📘 - ok - let - 's - talk - in - English - for - awhile - what - are - we - eating - .
- or - not - so + 12345 + multiply + function + hello 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 - .
+ working so - basically - sentence - .
- where - is - to - go - a - couple - and - then - you - put - the - adult - .
- a - bit - easier - to - understand - .
- actually - maybe - people - just - do - n't - just - .
- I - 'm - just - thinking - it - 's - not - the - centres - do - n't - put - the - dot - and - just - put - a - couple - .
- because - then - .
- they - are - talking - they - are - a - booklet - but - they - are - not - writing - .
+ much + better + now + good + purple so it - is - just - fine - .
- so + means + that + it + works + pumpkinMichaelnewspaper + canGoogle + speaker + small + America + to + see + how + it + goes + email + Sterling + Knight + part + of + speech + 20 + ok + independent + boilerplate + IKEA + where are + my + next + Tuesday + mum + barrister + assisted + into + months + turn + off + living + room + TVmaterial + lightstream + todayhello + to you - done - .
- and - now - is - f - * - * - * - * - * - up - .
+ CBR + 929 + ca + n't + encode + this + one + kodi + turn + bedroom + twoalways \ No newline at end of file diff --git a/2_layout/styles/2.css b/2_layout/styles/2.css index b8c8883..2bdcb16 100644 --- a/2_layout/styles/2.css +++ b/2_layout/styles/2.css @@ -1,83 +1,80 @@ -@media print{ - - /* Define the size of the pages and layout settings */ - - @page { - size: 148mm 210mm; - marks: crop cross; - margin: 15mm; - } - - /* Custom font */ - - @font-face { - font-family: "neuzeit"; - src: url("../fonts/NeuzeitOffice-Regular.ttf") - } - - @font-face { - font-family: "fivo"; - src: url("../fonts/fivo-sans.medium.otf") - } - - /* Custom variables */ - - :root{ - --first: #19B7B9; - --second: #0B1136; - --third: #2E4473; - } - - /* Rules for everything */ - - body{ - font-family: "neuzeit"; - font-size: 20px; - line-height: 35px; - } - - /* Rules for the rest */ - - div{ - box-sizing: border-box; - } - - span{ - color: white; - } - - /* Rules for dots */ - - .dot{ - color: var(--third); - } - - /* Rules for Part Of Speech (POS), defined in classes in */ - /* This case, conjunctions + verbs ) */ - - span.CC{ - font-size: 3vw; - color: var(--first) - } - - - span.VB{ - color: var(--second); - } - span.VBD{ - color: var(--second); - } - span.VBG{ - color: var(--second); - } - span.VBN{ - color: var(--second); - } - span.VBP{ - color: var(--second); - } - span.VBZ{ - color: var(--second); - } - - } \ No newline at end of file +@media print { + /* Define the size of the pages and layout settings */ + + @page { + size: 148mm 210mm; + marks: crop cross; + margin: 15mm; + } + + /* Custom font */ + + @font-face { + font-family: "neuzeit"; + src: url("./fonts/NeuzeitOffice-Regular.ttf"); + } + + @font-face { + font-family: "fivo"; + src: url("./fonts/fivo-sans.medium.otf"); + } + + /* Custom variables */ + + :root { + --first: #19b7b9; + --second: #0b1136; + --third: #2e4473; + } + + /* Rules for everything */ + + body { + font-family: "neuzeit"; + font-size: 20px; + line-height: 35px; + } + + /* Rules for the rest */ + + div { + box-sizing: border-box; + } + + span { + color: white; + } + + /* Rules for dots */ + + .dot { + color: var(--third); + } + + /* Rules for Part Of Speech (POS), defined in classes in */ + /* This case, conjunctions + verbs ) */ + + span.NN { + font-size: 3vw; + color: var(--first); + } + + span.VB { + color: var(--second); + } + span.VBD { + color: var(--second); + } + span.VBG { + color: var(--second); + } + span.VBN { + color: var(--second); + } + span.VBP { + color: var(--second); + } + span.VBZ { + color: var(--second); + } +} diff --git a/2_layout/styles/3.css b/2_layout/styles/3.css index 8cd8e3f..4bdd7c4 100644 --- a/2_layout/styles/3.css +++ b/2_layout/styles/3.css @@ -1,54 +1,49 @@ -@media print{ - - /* Define the size of the pages and layout settings */ - - @page { - size: 148mm 210mm; - marks: crop cross; - margin: 15mm; - } - - /* Custom fonts */ - - @font-face { - font-family: "neuzeit"; - src: url("../fonts/NeuzeitOffice-Regular.ttf") - } - - @font-face { - font-family: "fivo"; - src: url("../fonts/fivo-sans.medium.otf") - } - - /* Custom variables */ - - :root{ - - - } - - /* Rules for everything */ - - body{ - font-family: "neuzeit"; - } - - /* Rules for the rest */ - - div{ - box-sizing: border-box; - } - - span{ - font-size: 20px; - line-height: 60px; - } - - img { - margin: 0 5px; - height: 50px; - vertical-align: middle; - } - - - } \ No newline at end of file +@media print { + /* Define the size of the pages and layout settings */ + + @page { + size: 148mm 210mm; + marks: crop cross; + margin: 15mm; + } + + /* Custom fonts */ + + @font-face { + font-family: "neuzeit"; + src: url("./fonts/NeuzeitOffice-Regular.ttf"); + } + + @font-face { + font-family: "fivo"; + src: url("./fonts/fivo-sans.medium.otf"); + } + + /* Custom variables */ + + :root { + } + + /* Rules for everything */ + + body { + font-family: "neuzeit"; + } + + /* Rules for the rest */ + + div { + box-sizing: border-box; + } + + span { + font-size: 20px; + line-height: 60px; + } + + img { + margin: 0 5px; + height: 50px; + vertical-align: middle; + } +} diff --git a/2_layout/styles/style.css b/2_layout/styles/style.css deleted file mode 100755 index e9eb2b4..0000000 --- a/2_layout/styles/style.css +++ /dev/null @@ -1,54 +0,0 @@ -@media print{ - -/* Define the size of the pages and layout settings */ - -@page { - size: 148mm 210mm; - marks: crop cross; - bleed: 5mm; -} - -/* Custom font */ - -@font-face { - font-family: "neuzeit"; - src: url("fonts/NeuzeitOffice-Regular.ttf") format("ttf") -} - -@font-face { - font-family: "fivo"; - src: url("fonts/fivo-sans.medium.otf") format("otf") -} - -/* Custom variables */ - -:root{ - - -} - -/* Rules for everything */ - -body{ - font-family: "neuzeit"; -} - -/* Rules for the rest */ - -div{ - box-sizing: border-box; -} - - -p{ - text-align: left; - font-size: 12px; - line-height: 15.5px; -} - -h1{ - text-align: center; -} - - -} \ No newline at end of file diff --git a/speech.txt b/speech.txt index f683a1f..c319bed 100644 --- a/speech.txt +++ b/speech.txt @@ -1,18 +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 - \ No newline at end of file +why is pink the colour for girls and blue the colours for boys in the 19th century girls and boys were bored dress in white because it was easier to clean after WWI World War One department store in the US realise that could make more money if baby products will be gender specific +pastel swearing fashion and it was decided that thing would be the colour for boys and blue for girls in the 94 days market research in the US just that the current should be the other way around and the baby boom generation was the first where the girl dress in pink and boys in blue +blue +lupilu +Balle Balle +hello +hello hello you when I can theoretically +distinguish between 75 and 10 meal on heels +play some +0 +ok +green is the colour of metal +green is the colour of netta in many cultures +early retail centre of only hope for good harvest with green vegetables green is in the traditional colour of Islam yeah the colour of Prophet Muhammad which is why many flags in this number call you with the colour green +since 1980s Green has been kind colourful environmental parties and organisation +the word green washing is used to describe advising of companies that use positive environmental practice +cease to cover-up environmentally unfriendly activities +rear room is used in television and Theatre to quite nervous performer