You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1197 lines
36 KiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#from oi import *\n",
"\n",
"#oi = oi()\n",
"\n",
"#import ipyvuetify as v\n",
"\n",
"#state = False\n",
"#oi.toggle_code(state)\n",
"\n",
"#button = widgets.ToggleButton(state, description = button_descriptions[state])\n",
"\n",
"\n",
"#button.observe(oi.button_action, \"value\")\n",
"\n",
"#button.layout.height = '50px'\n",
"#button.layout.width = '100%'\n",
"#button.add_class(\"thobutton\")\n",
"\n",
"#display(button)\n",
"#button.button_style = 'danger'\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
"\n",
".center {\n",
" display: block;\n",
" margin-left: auto;\n",
" margin-right: auto;\n",
" width: 20%;\n",
"}\n",
"\n",
"body {\n",
" align: center;\n",
" }\n",
"\n",
"</style>\n",
"<body>\n",
"<a href=\"https://basabuuka.zapto.org/alpcentaur/Basabuuka_Prototyp\">\n",
"<img src=\"brainBasaBuuka5.png\" width=\"300\" height=\"200\" class=\"center\"/>\n",
"</a>\n",
"<p style=\"font-family: courier\"><center><b>Du kommst zu dem Code - wenn du auf das Logo klickst!</b></center></p> \n",
"</body>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style>\n",
"\n",
".center {\n",
" display: block;\n",
" margin-left: auto;\n",
" margin-right: auto;\n",
" width: 20%;\n",
"}\n",
"\n",
"body {\n",
" align: center;\n",
" }\n",
"\n",
"</style>\n",
"<body>\n",
"<a href=\"https://basabuuka.zapto.org/alpcentaur/Basabuuka_Prototyp\">\n",
"<img src=\"brainBasaBuuka5.png\" width=\"300\" height=\"200\" class=\"center\"/>\n",
"</a>\n",
"<p style=\"font-family: courier\"><center><b>Du kommst zu dem Code - wenn du auf das Logo klickst!</b></center></p> \n",
"</body>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
".modal-open { position: fixed; }\n",
"\n",
"* {\n",
" font-family: courier;\n",
" }\n",
"\n",
"</style>\n",
"\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style type=\"text/css\">\n",
".modal-open { position: fixed; }\n",
"\n",
"* {\n",
" font-family: courier;\n",
" }\n",
"\n",
"</style>\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"#%%html\n",
"#<style>\n",
"#.jupyter-button.mod-danger {\n",
"# font-style: italic;\n",
"# color: black;\n",
"# background-color: pink;\n",
"#}\n",
"#.jupyter-button.mod-danger.mod-active {\n",
"# \n",
"# color: black;\n",
"# background-color: lightgreen;\n",
"#}\n",
"#</style>"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"\n",
"#from ipywidgets import widgets\n",
"#button = widgets.Button(description='Click me')\n",
"#display(button)\n",
"\n",
"#def on_button_clicked(b):\n",
"# print('button clicked')\n",
"\n",
"#button.on_click(on_button_clicked)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"\n",
"# importing the libraries\n",
"#print('importing libraries')\n",
"#from SolveShorts import *\n",
"#import SentSeg\n",
"#from SayYes import *\n",
"#from Passiv2Aktiv import *\n",
"#from GenitivSolve import *\n",
"#from ConjunctSolve import *\n",
"#from FremdWB import *\n",
"#from Medio import *\n",
"#from oi import *\n",
"#print('done')\n",
"\n",
"\n",
"# Initializing the libraries\n",
"#print('initializing the libraries')\n",
"#print('1')\n",
"#solSh = SolveShorts('hkldbShorts.hkl', 'hkldbShorts_All.hkl')\n",
"#print('2')\n",
"#sent_seg = SentSeg.SentSeg('de')\n",
"#print('3')\n",
"#sy = SayYes(None, None)\n",
"#print('4')\n",
"#p2a = Passiv2Aktiv(None, None, None)\n",
"#print('5')\n",
"#gs = GenitivSolve()\n",
"#print('6')\n",
"#cs = ConjunctSolve(None,None)\n",
"#print('7')\n",
"#oi = oi()\n",
"#print('8')\n",
"#fwb = FremdWB(None,None)\n",
"#print('9')\n",
"#medi = Medio(None,None)\n",
"#print('done')\n",
"\n",
"\n",
"# loading the databases and models\n",
"#print('loading SolveShorts Databases')\n",
"#solSh.load_DB_into_FASTsearch()\n",
"#print('loading SentSeg Databases')\n",
"#sent_seg.LoadSentGlueSGDandGSUtils()\n",
"#print('loading SayYes Databases')\n",
"#sy.load_DB_into_FASTsearch()\n",
"#print('loading passiv2active Databases')\n",
"#p2a.load_DB_into_FASTsearch()\n",
"#print('loading conjunctivesolve Databases')\n",
"#cs.load_DB_into_FASTsearch()\n",
"#print('loading the fremdwb Databases')\n",
"#fwb.load_DB_into_FASTsearch()\n",
"#print('loading the mediodot Databases')\n",
"#medi.load_DB_into_FASTsearch()\n",
"\n",
"#print('done')\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dumping the session\n",
"done\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "74fc341e0a474605b1f95c3e4e35d0b2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Textarea(value='', layout=Layout(height='180px', width='99%'), placeholder='Hier den Text eingeben, darunter k…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"#print('done')\n",
"\n",
"#print('loading passiv2active Databases')\n",
"#from Passiv2Aktiv import *\n",
"#p2a = Passiv2Aktiv(None, None, None)\n",
"#p2a.load_DB_into_FASTsearch()\n",
"#print('done')\n",
"#print('loading genitiv solve')\n",
"#from GenitivSolve import *\n",
"#gs = GenitivSolve()\n",
"\n",
"#from FremdWB import *\n",
"#fwb = FremdWB(None,None)\n",
"#fwb.load_DB_into_FASTsearch()\n",
"\n",
"#from SolveShorts import *\n",
"#print('loading SolveShorts Databases')\n",
"#solSh.load_DB_into_FASTsearch()\n",
"\n",
"#from SayYes import *\n",
"#sy = SayYes(None, None)\n",
"#print('loading SayYes Databases')\n",
"#sy.load_DB_into_FASTsearch()\n",
"\n",
"#import SentSeg\n",
"#sent_seg = SentSeg.SentSeg('de')\n",
"#print('loading SentSeg Databases')\n",
"#sent_seg.LoadSentGlueSGDandGSUtils()\n",
"#print('loading conjunctsolve')\n",
"#from ConjunctSolve import *\n",
"#cs = ConjunctSolve(None,None)\n",
"#print('done')\n",
"#print('loading conjunctivesolve Databases')\n",
"#cs.load_DB_into_FASTsearch()\n",
"#print('done')\n",
"#from oi import *\n",
"#oi = oi()\n",
"\n",
"#print('loading session..')\n",
"\n",
"#print('done')\n",
"import dill\n",
"dill.load_session('voilastate.db')\n",
"\n",
"#from SolveShorts import *\n",
"#print('loading SolveShorts Databases')\n",
"#solSh.load_DB_into_FASTsearch()\n",
"\n",
"#import SentSeg\n",
"#sent_seg = SentSeg.SentSeg('de')\n",
"#print('loading SentSeg Databases')\n",
"#sent_seg.LoadSentGlueSGDandGSUtils()\n",
"\n",
"#from FremdWB import *\n",
"#fwb = FremdWB(None,None)\n",
"#fwb.load_DB_into_FASTsearch()\n",
"\n",
"#from Medio import *\n",
"#medi = Medio(None,None)\n",
"#medi.load_DB_into_FASTsearch()\n",
"\n",
"\n",
"#import dill\n",
"#print('dumping the session')\n",
"#dill.dump_session('voilastate.db')\n",
"#print('done')\n",
"\n",
"#from oi import *\n",
"#oi = oi()\n",
"\n",
"import ipywidgets as widgets\n",
"\n",
"TextFeld = widgets.Textarea(placeholder='Hier den Text eingeben, darunter können die Module aktiviert(grün) oder deaktiviert(pink) werden', disabled=False)\n",
"#print(TextFeld.layout.height)\n",
"TextFeld.layout.height = '180px'\n",
"TextFeld.layout.width = '99%'\n",
"\n",
"TextFelddouble = widgets.Textarea(placeholder='Hier den Text eingeben, darunter können die Module aktiviert(grün) oder deaktiviert(pink) werden', disabled=False)\n",
"#print(TextFeld.layout.height)\n",
"TextFelddouble.layout.height = '180px'\n",
"TextFelddouble.layout.width = '99%'\n",
"TextFelddouble.disabled=True\n",
"\n",
"display(TextFeld)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
"dawidth = '100%'\n",
"KonjunktiveErsetzen = widgets.ToggleButton(\n",
" value=False,\n",
" description='Konjunktive ersetzen',\n",
" disabled=False,\n",
")\n",
"KonjunktiveErsetzen.layout.width = dawidth\n",
"GenitiveErsetzen = widgets.ToggleButton(\n",
" value=True,\n",
" description='Genitiv ersetzen',\n",
" disabled=False\n",
")\n",
"GenitiveErsetzen.layout.width = dawidth\n",
"PassivErsetzen = widgets.ToggleButton(\n",
" value=True,\n",
" description='Passiv ersetzen',\n",
" disabled=False\n",
")\n",
"PassivErsetzen.layout.width = dawidth\n",
"SayYes = widgets.ToggleButton(\n",
" value=True,\n",
" description='Verneinungen ersetzen',\n",
" disabled=False\n",
")\n",
"SayYes.layout.width = dawidth\n",
"SentSeg = widgets.ToggleButton(\n",
" value=True,\n",
" description='Eine Aussage pro Satz',\n",
" disabled=False\n",
")\n",
"SentSeg.layout.width = dawidth\n",
"SolveShorts = widgets.ToggleButton(\n",
" value=False,\n",
" description='Abkürzungen erklären',\n",
" disabled=False\n",
")\n",
"SolveShorts.layout.width = dawidth\n",
"FremdWB = widgets.ToggleButton(\n",
" value=True,\n",
" description='FremdWoerterbuch',\n",
" disabled=False\n",
")\n",
"FremdWB.layout.width = dawidth\n",
"\n",
"Appendixes = widgets.ToggleButton(\n",
" value=True,\n",
" description='Charakterisierung pro Satz',\n",
" disabled=False\n",
")\n",
"Appendixes.layout.width = dawidth\n",
"\n",
"Medio = widgets.ToggleButton(\n",
" value=True,\n",
" description='Mediopunkte',\n",
" disabled=False\n",
")\n",
"Medio.layout.width = dawidth\n",
"\n",
"#items1 = [SentSeg, SolveShorts]\n",
"#items2 = [SayYes, PassivErsetzen]\n",
"#items3 = [GenitiveErsetzen, KonjunktiveErsetzen]\n",
"#items = [Textfeld, SentSeg, SolveShorts, SayYes, PassivErsetzen, GenitiveErsetzen, KonjunktiveErsetzen]\n",
"#display(SentSeg, SolveShorts, SayYes, PassivErsetzen, GenitiveErsetzen, KonjunktiveErsetzen)\n",
"#widgets.GridBox(items, layout=widgets.Layout(grid_template_columns=\"repeat(3, 100px)\"))\n",
"\n",
"\n",
"\n",
"#widgets.HBox(items1)\n",
"#widgets.HBox(items2)\n",
"#widgets.HBox(items3)\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets\n",
"out = 'Hier kommt der übersetzte Text heraus.'\n",
"\n",
"TextFeld.add_class(\"thotext\")\n",
"TextFelddouble.add_class(\"thotext\")\n",
"#display(OutTextFeld)\n",
"items = [SentSeg, SolveShorts, SayYes, PassivErsetzen, GenitiveErsetzen, KonjunktiveErsetzen, FremdWB, Appendixes, Medio] \n",
"#display(SentSeg, SolveShorts, SayYes, PassivErsetzen, GenitiveErsetzen, KonjunktiveErsetzen)\n",
"Grid = widgets.GridBox(items, layout=widgets.Layout(justify_items=\"center\", grid_template_columns=\"repeat(3, 30%)\", grid_gap=\"4.5%\", height=\"150px\"))\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<br>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "082cb6fb58aa41cc82d918d2a056258d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(width='100%')), …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"display(HTML('<br>'))\n",
"display(Grid)\n",
"\n",
"\n",
"\n",
"\n",
"def function():\n",
" out = 'Wählen Sie ein Kästchen aus!'\n",
" try:\n",
" insentences, punctuations = oi.CellInputText2SplitsentencesWithspacy(TextFeld.value)\n",
" except:\n",
" OutTextFeld.placeholder = 'Bitte auf die Zeichensetzung achten! '\n",
" return\n",
" \n",
" check = 0\n",
" #print('insentences',insentences)\n",
" #print(punctuations)\n",
" if SayYes.value == True:\n",
" \n",
" print('ersetze Gegenteile..')\n",
" outsentences = sy.replaceOpposites(insentences)\n",
" check = 1\n",
" \n",
" \n",
" \n",
" \n",
" if Appendixes.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('generiere ist-Aussagen..')\n",
" outsentences, punctuations = sent_seg.putAppendixesIntoOwnSentences(insentences, punctuations)\n",
" \n",
" if SentSeg.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('forme zu einem Satz pro Aussage um..')\n",
" sentsegformattedsentences = []\n",
" for sentence in insentences:\n",
" \n",
" sentsegformattedsentences.append([sentence])\n",
" \n",
" #print(sentsegformattedsentences)\n",
" sentences = sent_seg.CommaSentenceOrNot(sentsegformattedsentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetUtteranceNumber(sentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetQuestionOrNot(sentences)\n",
" #print(sentences)\n",
" sentences, punctuations = sent_seg.AndOrSolver(sentences, punctuations)\n",
" #print(len(punctuations))\n",
" #print('sentences after AndOrSolver', sentences, punctuations)\n",
" sentences = sent_seg.CommaSentenceOrNot(sentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetUtteranceNumber(sentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetQuestionOrNot(sentences)\n",
" #print(sentences)\n",
" sentences, punctuations = sent_seg.SplitSentencesIntoHauptNebenTuple(sentences, punctuations)\n",
" #print(len(punctuations))\n",
" #print('sentences after split haupt neben', sentences)\n",
" sentences = sent_seg.CommaSentenceOrNot(sentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetUtteranceNumber(sentences)\n",
" #print(sentences)\n",
" sentences = sent_seg.GetQuestionOrNot(sentences)\n",
" #print(sentences)\n",
" outsentences, punctuations = sent_seg.SplitCommatas(sentences, punctuations)\n",
" #print(len(punctuations))\n",
" #print('out',outsentences)\n",
" #print('out', punctuations)\n",
" check = 1\n",
" \n",
" \n",
" if SolveShorts.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('erklaere Abkuerzungen..')\n",
" outsentences = solSh.ExplainShortsInSentencesWithBrackets(insentences)\n",
" check = 1\n",
" #print(len(punctuations)) \n",
" #print('sentences after solveshorts', outsentences)\n",
" \n",
" if PassivErsetzen.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('ersetze Passiv Formen..')\n",
" outsentences = p2a.replacePassivForms(insentences)\n",
" check = 1\n",
" #print(len(punctuations))\n",
" #print('sentences after p2a', outsentences)\n",
" \n",
" if GenitiveErsetzen.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" #print('replacing genitiv forms with dativ..')\n",
" outsentences = gs.ReplaceGenitivWithDativ(insentences)\n",
" check = 1\n",
" #print(len(punctuations))\n",
" #print('sentences after gs', outsentences)\n",
" \n",
" if check == 1:\n",
" newinsentences = []\n",
" for sentence in outsentences: \n",
" newinsentences.append([word.replace('ö','oe').replace('ü','ue').replace('ä','ae').replace('ß','ss') for word in sentence])\n",
" \n",
" outsentences =newinsentences\n",
" if check != 1:\n",
" newinsentences = []\n",
" for sentence in insentences: \n",
" newinsentences.append([word.replace('ö','oe').replace('ü','ue').replace('ä','ae').replace('ß','ss') for word in sentence])\n",
" \n",
" insentences =newinsentences\n",
" #print()\n",
" if KonjunktiveErsetzen.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('ersetze Konjunktive..')\n",
" \n",
" outsentences = cs.replaceConjunctives(insentences)\n",
" #print('outsentences')\n",
" check = 1\n",
" \n",
" #print('sentences after cs', outsentences)\n",
" print(len(punctuations))\n",
" \n",
" if FremdWB.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('Suche Woerterbucheintraege..')\n",
" \n",
" outsentences, punctuations = fwb.fremdEintragAppend(insentences, punctuations)\n",
" #print('outsentences')\n",
" check = 1\n",
" \n",
" if Medio.value == True:\n",
" if check == 1:\n",
" insentences = outsentences\n",
" print('Ersetze lange Woerter mit Mediopunkten..')\n",
" \n",
" outsentences, punctuations = medi.Medioreplace(insentences, punctuations)\n",
" #print('outsentences')\n",
" check = 1\n",
" #print('sentences after medios', outsentences)\n",
" \n",
" \n",
" #print('sentences after fwb', outsentences)\n",
" \n",
" print(len(punctuations))\n",
" \n",
" if check == 1:\n",
" out = ''\n",
" #print('just before looking if the lenght is the same')\n",
" #print(len(outsentences), len(punctuations))\n",
" if len(outsentences) == len(punctuations):\n",
" #print('the length is the same')\n",
" for n in range(len(outsentences)):\n",
" outsentence = outsentences[n]\n",
" outsentence[0] = outsentence[0].title()\n",
" out += ' '.join(outsentence) + punctuations[n] + '\\n'\n",
" \n",
" \n",
" OutTextFeld.value = out\n",
" TextFelddouble.value = TextFeld.value\n",
" display(TextFelddouble)\n",
" \n",
" return \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dad4baed09a5407194ae2daf153e8f43",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Button(description='Übersetzen in Leichte Sprache', style=ButtonStyle()), Output()), _do…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#from IPython.display import Image\n",
"#i = Image(filename='Babelfish.png')\n",
"\n",
"#i.width = '60%'\n",
"#display(i)\n",
"\n",
"#print(widgets.interact_manual.opts)\n",
"\n",
"widgets.interact_manual.opts['manual_name']= 'Übersetzen in Leichte Sprache'\n",
"ola = widgets.interact_manual(function)\n",
"ola.widget.children[0].style.button_color = 'lightgreen'\n",
"ola.widget.children[0].layout.height = '50px'\n",
"ola.widget.children[0].layout.width = '99%'\n",
"\n",
"#widgets.GridBox([ola], layout=widgets.Layout(grid_template_columns=\"repeat(2, 300px)\"))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4bff927b0a404ed0b909db2bd766ac65",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Textarea(value='', layout=Layout(height='180px', width='99%'), placeholder='Hier kommt der übersetzte Text her…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"OutTextFeld = ipywidgets.Textarea(placeholder=out, disabled=False)\n",
"OutTextFeld.layout.height = '180px'\n",
"OutTextFeld.layout.width = '99%'\n",
"OutTextFeld.add_class(\"thetext\")\n",
"display(OutTextFeld)\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"beschreibung = 'Textfeld für die verbesserte Übersetzung. Satzzeichen bitte nicht vergessen! \\nFalls ein neuer Eintrag ins Fremdwörterbuch vorgenommen werden soll, schreibe einfach unter die Verbesserungen einen Eintrag der Form: [\\'Abfall\\', \\'Abfall sind Sachen die wir nicht mehr brauchen\\'] \\nFalls ein neuer Eintrag in die Mediopunkte-Datenbank vorgenommen werden soll, bitte schreibe unter die Verbesserungen einen Eintrag der Form: [\\'Mediopunkt\\', \\'Medio·punkt\\']' \n",
"VerbeTextFeld = ipywidgets.Textarea(placeholder=beschreibung, disabled=False)\n",
"VerbeTextFeld.layout.height = '180px'\n",
"VerbeTextFeld.layout.width = '99%'\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
"def Absendefunction():\n",
" \n",
" \n",
"\n",
" \n",
" #print(VerbeTextFeld.value)\n",
" #print(TextFeld.value)\n",
" #print(OutTextFeld.value)\n",
" \n",
" try:\n",
"\n",
" insentences, punctuations = oi.CellInputText2SplitsentencesWithspacy(VerbeTextFeld.value)\n",
" insentences1, punctuations1 = oi.CellInputText2SplitsentencesWithspacy(TextFeld.value)\n",
" insentences2, punctuations2 = oi.CellInputText2SplitsentencesWithspacy(OutTextFeld.value)\n",
"\n",
" #print(insentences2)\n",
"\n",
" #print(insentences, punctuations)\n",
" indexDerVerbesserungen = 0\n",
" number = 0\n",
" with open('Verbesserungen/indexDerVerbesserungen.txt', 'r') as dok:\n",
" for number in dok:\n",
" number = int(number)\n",
" if number >= 0:\n",
" indexDerVerbesserungen = number\n",
" number += 1\n",
"\n",
" with open('Verbesserungen/indexDerVerbesserungen.txt', 'w') as dokk:\n",
" dokk.write(str(number))\n",
"\n",
"\n",
" with open('Verbesserungen/Verbesserungen' + str(number) + '.txt','w+') as doc:\n",
" for n in range(len(insentences)):\n",
" npunct = punctuations[n]\n",
" writeline = insentences[n]+ [npunct]\n",
"\n",
" writestring = ' '.join(writeline)\n",
"\n",
" doc.write(writestring + '\\n')\n",
"\n",
" with open('Verbesserungen/Input' + str(number) + '.txt','w+') as docc:\n",
" for n in range(len(insentences1)):\n",
" npunct = punctuations1[n]\n",
" writeline = insentences1[n]+ [npunct]\n",
"\n",
" writestring = ' '.join(writeline)\n",
"\n",
" docc.write(writestring + '\\n')\n",
" with open('Verbesserungen/Output' + str(number) + '.txt','w+') as dock:\n",
" #print(insentences2)\n",
" for n in range(len(insentences2)):\n",
" #print(len(insentences2))\n",
"\n",
" #print(punctuations2)\n",
" npunct = punctuations2[n]\n",
" writeline = insentences2[n]+ [npunct]\n",
"\n",
" writestring = ' '.join(writeline)\n",
"\n",
" dock.write(writestring + '\\n')\n",
"\n",
" VerbeTextFeld.value = ''\n",
" OutTextFeld.value = ''\n",
" VerbeTextFeld.placeholder = beschreibung\n",
" OutTextFeld.placeholder = 'Hier kommt der übersetzte Text raus.'\n",
" except:\n",
" VerbeTextFeld.placeholder = 'Es gab einen Fehler. Eventuell ist die Zeichensetzung nicht ok. \\n \\n' + beschreibung\n",
" \n",
" \n",
" return \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b6053b85bdcd4446b010b5fb872dc52c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Textarea(value='', layout=Layout(height='180px', width='99%'), placeholder=\"Textfeld für die verbesserte Übers…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<br>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4d3e6e3a2bcb499697a50a1a1e88a8a4",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Button(description='Absenden', style=ButtonStyle()), Output()), _dom_classes=('widget-in…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"VerbeTextFeld.add_class(\"thetext3\")\n",
"display(VerbeTextFeld)\n",
"display(HTML('<br>'))\n",
"widgets.interact_manual.opts['manual_name']= 'Absenden'\n",
"AbsendenUndSchreiben = widgets.interact_manual(Absendefunction)\n",
"AbsendenUndSchreiben.widget.children[0].style.button_color = 'lightblue'\n",
"AbsendenUndSchreiben.widget.children[0].layout.height = '50px'\n",
"AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".output_png {\n",
" display: table-cell;\n",
" text-align: center;\n",
" vertical-align: middle;\n",
" }\n",
".jupyter-button {\n",
" text-shadow: -1px -1px rgba(255, 255, 255, 0.35), 1px 1px rgba(0, 0, 0, 0.40);\n",
" font-family: 'Lato', sans-serif;\n",
" text-decoration: none;\n",
" letter-spacing: .06rem;\n",
" font-size: 90%;\n",
" font-weight: bold;\n",
" color: rgba(0, 0, 0, 0.3);\n",
" background-color: pink;\n",
" border-radius: 20px;\n",
" transition: all 0.2s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
" }\n",
"\n",
".jupyter-button.mod-active {\n",
" \n",
" color: rgba(0, 0, 0, 0.4);\n",
" background-color: lightgreen;\n",
"}\n",
".jupyter-button:hover {\n",
" background-color: .jupyter-button.background-color;\n",
" opacity: 0.6;\n",
" color: rgba(0, 0, 0, 0.3);\n",
"}\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style>\n",
".output_png {\n",
" display: table-cell;\n",
" text-align: center;\n",
" vertical-align: middle;\n",
" }\n",
".jupyter-button {\n",
" text-shadow: -1px -1px rgba(255, 255, 255, 0.35), 1px 1px rgba(0, 0, 0, 0.40);\n",
" font-family: 'Lato', sans-serif;\n",
" text-decoration: none;\n",
" letter-spacing: .06rem;\n",
" font-size: 90%;\n",
" font-weight: bold;\n",
" color: rgba(0, 0, 0, 0.3);\n",
" background-color: pink;\n",
" border-radius: 20px;\n",
" transition: all 0.2s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
" }\n",
"\n",
".jupyter-button.mod-active {\n",
" \n",
" color: rgba(0, 0, 0, 0.4);\n",
" background-color: lightgreen;\n",
"}\n",
".jupyter-button:hover {\n",
" background-color: .jupyter-button.background-color;\n",
" opacity: 0.6;\n",
" color: rgba(0, 0, 0, 0.3);\n",
"}\n",
"</style>"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".thetext > .widget-label {\n",
" font-style: italic;\n",
" color: blue;\n",
" font-size: 30px;\n",
"}\n",
".thetext > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightgreen;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thetext > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
".thetext3 > .widget-label {\n",
" \n",
" font-style: ;\n",
" color: blue;\n",
" font-size: 20px;\n",
"}\n",
".thetext3 > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightblue;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thetext3 > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style>\n",
".thetext > .widget-label {\n",
" font-style: italic;\n",
" color: blue;\n",
" font-size: 30px;\n",
"}\n",
".thetext > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightgreen;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thetext > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
".thetext3 > .widget-label {\n",
" \n",
" font-style: ;\n",
" color: blue;\n",
" font-size: 20px;\n",
"}\n",
".thetext3 > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightblue;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thetext3 > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
"</style>"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".thotext > .widget-label {\n",
" font-style: ;\n",
" color: blue;\n",
" font-size: 30px;\n",
" \n",
"}\n",
".thotext > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightgreen;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thotext > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
"\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style>\n",
".thotext > .widget-label {\n",
" font-style: ;\n",
" color: blue;\n",
" font-size: 30px;\n",
" \n",
"}\n",
".thotext > textarea {\n",
" padding: 10px 0 0 10px;\n",
" resize: none;\n",
" font-size: 15px;\n",
" color: black;\n",
" background-color: lightgreen;\n",
" border-radius: 20px;\n",
" border-width : 0px\n",
" transition: all 0.3s cubic-bezier(0, 0.22, .3, 1);\n",
" #box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 2px 2px rgba(0, 0, 0, 0.19);\n",
" box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n",
"}\n",
".thotext > ::placeholder {\n",
" opacity: 0.5;\n",
" \n",
"}\n",
"\n",
"</style>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 3",
"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.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}