diff --git a/Prototyp/.Prototype-0.ipynb b/Prototyp/.Prototype-0.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.Prototype-0.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.Prototype-1.ipynb b/Prototyp/.Prototype-1.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.Prototype-1.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.Prototype-10.ipynb b/Prototyp/.Prototype-10.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-10.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-11.ipynb b/Prototyp/.Prototype-11.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-11.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-12.ipynb b/Prototyp/.Prototype-12.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-12.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-13.ipynb b/Prototyp/.Prototype-13.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-13.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-14.ipynb b/Prototyp/.Prototype-14.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-14.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-2.ipynb b/Prototyp/.Prototype-2.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.Prototype-2.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.Prototype-3.ipynb b/Prototyp/.Prototype-3.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.Prototype-3.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.Prototype-4.ipynb b/Prototyp/.Prototype-4.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.Prototype-4.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.Prototype-5.ipynb b/Prototyp/.Prototype-5.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-5.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-6.ipynb b/Prototyp/.Prototype-6.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-6.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-7.ipynb b/Prototyp/.Prototype-7.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-7.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-8.ipynb b/Prototyp/.Prototype-8.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-8.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.Prototype-9.ipynb b/Prototyp/.Prototype-9.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.Prototype-9.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-0-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-0-checkpoint.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-0-checkpoint.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-1-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-1-checkpoint.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-1-checkpoint.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-10-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-10-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-10-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-11-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-11-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-11-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-12-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-12-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-12-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-13-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-13-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-13-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-14-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-14-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-14-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-2-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-2-checkpoint.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-2-checkpoint.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-3-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-3-checkpoint.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-3-checkpoint.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-4-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-4-checkpoint.ipynb new file mode 100644 index 00000000..37cbca29 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-4-checkpoint.ipynb @@ -0,0 +1,2373 @@ +{ + "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": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6a24b25b44a846aea1b396e744d222e4", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2bfcacdb87c640bb93cde56d3dd5aeaf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2da49b6bc0c64b468368c639db95a1a6", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "16d4e37ff391417f8844c35944a3f1af", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "dd913832ab444630a3842fcf7fd8609b", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "79ed4f2f30324ca582faa59671224d92", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-5-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-5-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-5-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-6-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-6-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-6-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-7-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-7-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-7-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-8-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-8-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-8-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/.Prototype-9-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/.Prototype-9-checkpoint.ipynb new file mode 100644 index 00000000..50a76c09 --- /dev/null +++ b/Prototyp/.ipynb_checkpoints/.Prototype-9-checkpoint.ipynb @@ -0,0 +1,2313 @@ +{ + "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": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", + "\n", + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [], + "source": [ + "#%%html\n", + "#" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "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": 7, + "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": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "106e70dd208f4de29ae10874823d30a8", + "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": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "dawidth = '100%'\n", + "daheight = '100%'\n", + "KonjunktiveErsetzen = widgets.ToggleButton(\n", + " value=False,\n", + " description='Konjunktive ersetzen',\n", + " disabled=False,\n", + ")\n", + "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", + "GenitiveErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Genitiv ersetzen',\n", + " disabled=False\n", + ")\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", + "PassivErsetzen = widgets.ToggleButton(\n", + " value=True,\n", + " description='Passiv ersetzen',\n", + " disabled=False\n", + ")\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", + "SayYes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Verneinungen ersetzen',\n", + " disabled=False\n", + ")\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", + "SentSeg = widgets.ToggleButton(\n", + " value=True,\n", + " description='Eine Aussage pro Satz',\n", + " disabled=False\n", + ")\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", + "SolveShorts = widgets.ToggleButton(\n", + " value=False,\n", + " description='Abkürzungen erklären',\n", + " disabled=False\n", + ")\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", + "FremdWB = widgets.ToggleButton(\n", + " value=True,\n", + " description='FremdWoerterbuch',\n", + " disabled=False\n", + ")\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", + "\n", + "Appendixes = widgets.ToggleButton(\n", + " value=True,\n", + " description='Charakterisierung pro Satz',\n", + " disabled=False\n", + ")\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", + "\n", + "Medio = widgets.ToggleButton(\n", + " value=True,\n", + " description='Mediopunkte',\n", + " disabled=False\n", + ")\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\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": 10, + "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=\"320px\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c08292c98ddf447ca1c19117241980b8", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "\n", + "display(HTML('
'))\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": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3ca86c6e7e39437eafa36439e3337b42", + "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 = '60px'\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": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", + "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": 14, + "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": 15, + "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": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1713cde35a884104b20056d5694d168a", + "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": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4100a2d84d34630acf974f78d316abc", + "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('
'))\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 = '60px'\n", + "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%html\n", + "" + ] + } + ], + "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 +} diff --git a/Prototyp/.ipynb_checkpoints/Prototype-checkpoint.ipynb b/Prototyp/.ipynb_checkpoints/Prototype-checkpoint.ipynb index 77e11898..00f9af04 100644 --- a/Prototyp/.ipynb_checkpoints/Prototype-checkpoint.ipynb +++ b/Prototyp/.ipynb_checkpoints/Prototype-checkpoint.ipynb @@ -30,14 +30,20 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ + "\n", "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "

Du kommst zu dem Code - wenn du auf das Logo klickst!

\n", - "\n" + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" ], "text/plain": [ "" @@ -67,8 +632,14 @@ ], "source": [ "%%html\n", + "\n", "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "

Du kommst zu dem Code - wenn du auf das Logo klickst!

\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", "\n" ] }, @@ -102,44 +1223,36 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "%%html\n", - "\n", - "\n" + "#body {\n", + "# align: center;\n", + "# font-size: 24;\n", + "# }\n", + "\n", + "\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -160,7 +1273,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -177,7 +1290,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": { "scrolled": true }, @@ -243,7 +1356,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "scrolled": true }, @@ -251,7 +1364,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "8550b5ce616f4cd89a39ee2a05c5da15", + "model_id": "106e70dd208f4de29ae10874823d30a8", "version_major": 2, "version_minor": 0 }, @@ -353,69 +1466,82 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "dawidth = '100%'\n", + "daheight = '100%'\n", "KonjunktiveErsetzen = widgets.ToggleButton(\n", " value=False,\n", " description='Konjunktive ersetzen',\n", " disabled=False,\n", ")\n", "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", "GenitiveErsetzen = widgets.ToggleButton(\n", " value=True,\n", " description='Genitiv ersetzen',\n", " disabled=False\n", ")\n", - "GenitiveErsetzen.layout.width = dawidth\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", "PassivErsetzen = widgets.ToggleButton(\n", " value=True,\n", " description='Passiv ersetzen',\n", " disabled=False\n", ")\n", - "PassivErsetzen.layout.width = dawidth\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", "SayYes = widgets.ToggleButton(\n", " value=True,\n", " description='Verneinungen ersetzen',\n", " disabled=False\n", ")\n", - "SayYes.layout.width = dawidth\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", "SentSeg = widgets.ToggleButton(\n", " value=True,\n", " description='Eine Aussage pro Satz',\n", " disabled=False\n", ")\n", - "SentSeg.layout.width = dawidth\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", "SolveShorts = widgets.ToggleButton(\n", " value=False,\n", " description='Abkürzungen erklären',\n", " disabled=False\n", ")\n", - "SolveShorts.layout.width = dawidth\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", "FremdWB = widgets.ToggleButton(\n", " value=True,\n", " description='FremdWoerterbuch',\n", " disabled=False\n", ")\n", - "FremdWB.layout.width = dawidth\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", "\n", "Appendixes = widgets.ToggleButton(\n", " value=True,\n", " description='Charakterisierung pro Satz',\n", " disabled=False\n", ")\n", - "Appendixes.layout.width = dawidth\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", "\n", "Medio = widgets.ToggleButton(\n", " value=True,\n", " description='Mediopunkte',\n", " disabled=False\n", ")\n", - "Medio.layout.width = dawidth\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\n", "\n", "#items1 = [SentSeg, SolveShorts]\n", "#items2 = [SayYes, PassivErsetzen]\n", @@ -433,7 +1559,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -445,12 +1571,12 @@ "#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=\"1.5%\", height=\"200px\"))\n" + "Grid = widgets.GridBox(items, layout=widgets.Layout(justify_items=\"center\", grid_template_columns=\"repeat(3, 30%)\", grid_gap=\"4.5%\", height=\"320px\"))\n" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -468,12 +1594,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "fbf6f63cc46248088133806a354dfa01", + "model_id": "c08292c98ddf447ca1c19117241980b8", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(width='100%')), …" + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" ] }, "metadata": {}, @@ -653,22 +1779,13 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "scrolled": false - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "79e1775235dc46c0a6c14a0a261b1518", + "model_id": "3ca86c6e7e39437eafa36439e3337b42", "version_major": 2, "version_minor": 0 }, @@ -692,7 +1809,7 @@ "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.height = '60px'\n", "ola.widget.children[0].layout.width = '99%'\n", "\n", "#widgets.GridBox([ola], layout=widgets.Layout(grid_template_columns=\"repeat(2, 300px)\"))" @@ -700,7 +1817,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": { "scrolled": true }, @@ -708,7 +1825,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d1ee481103c54bde9e7ee8eb7ca0a76c", + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", "version_major": 2, "version_minor": 0 }, @@ -730,7 +1847,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -743,7 +1860,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -824,13 +1941,13 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c70e059820e44adb92a4b4532ebeb959", + "model_id": "1713cde35a884104b20056d5694d168a", "version_major": 2, "version_minor": 0 }, @@ -856,7 +1973,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "04c03c250bae489895ff8b738c3ce30e", + "model_id": "d4100a2d84d34630acf974f78d316abc", "version_major": 2, "version_minor": 0 }, @@ -875,14 +1992,14 @@ "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.height = '60px'\n", "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", "\n" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -895,15 +2012,16 @@ " vertical-align: middle;\n", " }\n", ".jupyter-button {\n", + " align: center;\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", + " letter-spacing: .07rem;\n", + " font-size: 95%;\n", " font-weight: bold;\n", " color: rgba(0, 0, 0, 0.3);\n", " background-color: pink;\n", - " border-radius: 20px;\n", + " border-radius: 30px;\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", @@ -938,15 +2056,16 @@ " vertical-align: middle;\n", " }\n", ".jupyter-button {\n", + " align: center;\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", + " letter-spacing: .07rem;\n", + " font-size: 95%;\n", " font-weight: bold;\n", " color: rgba(0, 0, 0, 0.3);\n", " background-color: pink;\n", - " border-radius: 20px;\n", + " border-radius: 30px;\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", @@ -967,7 +2086,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -977,19 +2096,22 @@ ".thetext > .widget-label {\n", " font-style: italic;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", "}\n", ".thetext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-opacity: 0.8;\n", + " border-width : 10px;\n", + " border-color: lightgrey;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1002,16 +2124,19 @@ " font-size: 20px;\n", "}\n", ".thetext3 > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightblue;\n", + " border-color: lightgrey;\n", + " border-opacity: 0.8;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext3 > ::placeholder {\n", " opacity: 0.5;\n", @@ -1033,19 +2158,22 @@ ".thetext > .widget-label {\n", " font-style: italic;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", "}\n", ".thetext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-opacity: 0.8;\n", + " border-width : 10px;\n", + " border-color: lightgrey;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1058,16 +2186,19 @@ " font-size: 20px;\n", "}\n", ".thetext3 > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightblue;\n", + " border-color: lightgrey;\n", + " border-opacity: 0.8;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext3 > ::placeholder {\n", " opacity: 0.5;\n", @@ -1078,7 +2209,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": { "scrolled": false }, @@ -1090,20 +2221,23 @@ ".thotext > .widget-label {\n", " font-style: ;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", " \n", "}\n", ".thotext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", + " \n", + " border-color: lightgrey;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thotext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1126,20 +2260,23 @@ ".thotext > .widget-label {\n", " font-style: ;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", " \n", "}\n", ".thotext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", + " \n", + " border-color: lightgrey;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thotext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1148,20 +2285,6 @@ "\n", "" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/Prototyp/Prototype.ipynb b/Prototyp/Prototype.ipynb index 711f10cb..00f9af04 100644 --- a/Prototyp/Prototype.ipynb +++ b/Prototyp/Prototype.ipynb @@ -30,14 +30,20 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ + "\n", "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "

Du kommst zu dem Code - wenn du auf das Logo klickst!

\n", - "\n" + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", + "\n" ], "text/plain": [ "" @@ -67,8 +632,14 @@ ], "source": [ "%%html\n", + "\n", "\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "\n", "\n", - "

Du kommst zu dem Code - wenn du auf das Logo klickst!

\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "

Ein Klick auf das Logo - und es geht zum Code

\n", + "\n", + "\n", + " \n", + "\n", + " \n", "\n" ] }, @@ -102,44 +1223,36 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "%%html\n", - "\n", - "\n" + "#body {\n", + "# align: center;\n", + "# font-size: 24;\n", + "# }\n", + "\n", + "\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#\n", + "#

Ein Klick auf das Logo - und es geht zum Code

\n", + "#" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -160,7 +1273,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -177,7 +1290,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": { "scrolled": true }, @@ -243,7 +1356,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "scrolled": true }, @@ -251,7 +1364,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "3daf3708d77e4098b826524460104e31", + "model_id": "106e70dd208f4de29ae10874823d30a8", "version_major": 2, "version_minor": 0 }, @@ -353,69 +1466,82 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "dawidth = '100%'\n", + "daheight = '100%'\n", "KonjunktiveErsetzen = widgets.ToggleButton(\n", " value=False,\n", " description='Konjunktive ersetzen',\n", " disabled=False,\n", ")\n", "KonjunktiveErsetzen.layout.width = dawidth\n", + "KonjunktiveErsetzen.layout.height = '80%'\n", + "\n", "GenitiveErsetzen = widgets.ToggleButton(\n", " value=True,\n", " description='Genitiv ersetzen',\n", " disabled=False\n", ")\n", - "GenitiveErsetzen.layout.width = dawidth\n", + "GenitiveErsetzen.layout.width = '60%'\n", + "GenitiveErsetzen.layout.height = daheight\n", + "\n", "PassivErsetzen = widgets.ToggleButton(\n", " value=True,\n", " description='Passiv ersetzen',\n", " disabled=False\n", ")\n", - "PassivErsetzen.layout.width = dawidth\n", + "PassivErsetzen.layout.width = '70%'\n", + "PassivErsetzen.layout.height = '90%'\n", + "\n", "SayYes = widgets.ToggleButton(\n", " value=True,\n", " description='Verneinungen ersetzen',\n", " disabled=False\n", ")\n", - "SayYes.layout.width = dawidth\n", + "SayYes.layout.width = '80%'\n", + "SayYes.layout.height = '80%'\n", "SentSeg = widgets.ToggleButton(\n", " value=True,\n", " description='Eine Aussage pro Satz',\n", " disabled=False\n", ")\n", - "SentSeg.layout.width = dawidth\n", + "SentSeg.layout.width = '60%'\n", + "SentSeg.layout.height = daheight\n", "SolveShorts = widgets.ToggleButton(\n", " value=False,\n", " description='Abkürzungen erklären',\n", " disabled=False\n", ")\n", - "SolveShorts.layout.width = dawidth\n", + "SolveShorts.layout.width = '80%'\n", + "SolveShorts.layout.height = '90%'\n", "FremdWB = widgets.ToggleButton(\n", " value=True,\n", " description='FremdWoerterbuch',\n", " disabled=False\n", ")\n", - "FremdWB.layout.width = dawidth\n", + "FremdWB.layout.width = '90%'\n", + "FremdWB.layout.height = '90%'\n", "\n", "Appendixes = widgets.ToggleButton(\n", " value=True,\n", " description='Charakterisierung pro Satz',\n", " disabled=False\n", ")\n", - "Appendixes.layout.width = dawidth\n", + "Appendixes.layout.width = '120%'\n", + "Appendixes.layout.height = '80%'\n", "\n", "Medio = widgets.ToggleButton(\n", " value=True,\n", " description='Mediopunkte',\n", " disabled=False\n", ")\n", - "Medio.layout.width = dawidth\n", + "Medio.layout.width = '50%'\n", + "Medio.layout.height = '90%'\n", "\n", "#items1 = [SentSeg, SolveShorts]\n", "#items2 = [SayYes, PassivErsetzen]\n", @@ -433,7 +1559,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -445,12 +1571,12 @@ "#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=\"1.5%\", height=\"200px\"))\n" + "Grid = widgets.GridBox(items, layout=widgets.Layout(justify_items=\"center\", grid_template_columns=\"repeat(3, 30%)\", grid_gap=\"4.5%\", height=\"320px\"))\n" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -468,12 +1594,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "a45cde93f5394cf6b262cc31f14c0d2e", + "model_id": "c08292c98ddf447ca1c19117241980b8", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(width='100%')), …" + "GridBox(children=(ToggleButton(value=True, description='Eine Aussage pro Satz', layout=Layout(height='100%', w…" ] }, "metadata": {}, @@ -653,22 +1779,13 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "scrolled": false - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5b0d573af12e4e1f9276834123b062a7", + "model_id": "3ca86c6e7e39437eafa36439e3337b42", "version_major": 2, "version_minor": 0 }, @@ -692,7 +1809,7 @@ "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.height = '60px'\n", "ola.widget.children[0].layout.width = '99%'\n", "\n", "#widgets.GridBox([ola], layout=widgets.Layout(grid_template_columns=\"repeat(2, 300px)\"))" @@ -700,7 +1817,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": { "scrolled": true }, @@ -708,7 +1825,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "be9b40c345ca4105a3810de0872fa144", + "model_id": "0d6f03c93f0147cd9f33d2a053672b0c", "version_major": 2, "version_minor": 0 }, @@ -730,7 +1847,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -743,7 +1860,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -824,13 +1941,13 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "01404ad96cc34dd5af96915447731bea", + "model_id": "1713cde35a884104b20056d5694d168a", "version_major": 2, "version_minor": 0 }, @@ -856,7 +1973,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "39c27a696cbd470fa8f5c58d10460336", + "model_id": "d4100a2d84d34630acf974f78d316abc", "version_major": 2, "version_minor": 0 }, @@ -875,14 +1992,14 @@ "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.height = '60px'\n", "AbsendenUndSchreiben.widget.children[0].layout.width = '99%'\n", "\n" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -895,15 +2012,16 @@ " vertical-align: middle;\n", " }\n", ".jupyter-button {\n", + " align: center;\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", + " letter-spacing: .07rem;\n", + " font-size: 95%;\n", " font-weight: bold;\n", " color: rgba(0, 0, 0, 0.3);\n", " background-color: pink;\n", - " border-radius: 20px;\n", + " border-radius: 30px;\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", @@ -938,15 +2056,16 @@ " vertical-align: middle;\n", " }\n", ".jupyter-button {\n", + " align: center;\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", + " letter-spacing: .07rem;\n", + " font-size: 95%;\n", " font-weight: bold;\n", " color: rgba(0, 0, 0, 0.3);\n", " background-color: pink;\n", - " border-radius: 20px;\n", + " border-radius: 30px;\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", @@ -967,7 +2086,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -977,19 +2096,22 @@ ".thetext > .widget-label {\n", " font-style: italic;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", "}\n", ".thetext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-opacity: 0.8;\n", + " border-width : 10px;\n", + " border-color: lightgrey;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1002,16 +2124,19 @@ " font-size: 20px;\n", "}\n", ".thetext3 > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightblue;\n", + " border-color: lightgrey;\n", + " border-opacity: 0.8;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext3 > ::placeholder {\n", " opacity: 0.5;\n", @@ -1033,19 +2158,22 @@ ".thetext > .widget-label {\n", " font-style: italic;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", "}\n", ".thetext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-opacity: 0.8;\n", + " border-width : 10px;\n", + " border-color: lightgrey;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1058,16 +2186,19 @@ " font-size: 20px;\n", "}\n", ".thetext3 > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightblue;\n", + " border-color: lightgrey;\n", + " border-opacity: 0.8;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thetext3 > ::placeholder {\n", " opacity: 0.5;\n", @@ -1078,7 +2209,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": { "scrolled": false }, @@ -1090,20 +2221,23 @@ ".thotext > .widget-label {\n", " font-style: ;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", " \n", "}\n", ".thotext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", + " \n", + " border-color: lightgrey;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thotext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1126,20 +2260,23 @@ ".thotext > .widget-label {\n", " font-style: ;\n", " color: blue;\n", - " font-size: 30px;\n", + " font-size: 35px;\n", " \n", "}\n", ".thotext > textarea {\n", + " align: center;\n", " padding: 10px 0 0 10px;\n", " resize: none;\n", - " font-size: 15px;\n", + " font-size: 16px;\n", " color: black;\n", " background-color: lightgreen;\n", + " \n", + " border-color: lightgrey;\n", " border-radius: 20px;\n", - " border-width : 0px\n", + " border-width : 10px;\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", + " #box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.29);\n", "}\n", ".thotext > ::placeholder {\n", " opacity: 0.5;\n", @@ -1148,20 +2285,6 @@ "\n", "" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/Prototyp/Use_Fremd_WB.ipynb b/Prototyp/Use_Fremd_WB.ipynb index 78acb485..c46b978e 100644 --- a/Prototyp/Use_Fremd_WB.ipynb +++ b/Prototyp/Use_Fremd_WB.ipynb @@ -105,6 +105,96 @@ "print(outsentences, punctuations)" ] }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "oi\n" + ] + } + ], + "source": [ + "print('oi')\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Aktiv.txt hkldb_AllAktiv_old.hkl\r\n", + "atest1 hkldb_AllVorgangspassiv.hkl\r\n", + "atest1out hkldb_AllVorgangspassiv_old.hkl\r\n", + "Babelfish.jpg hkldb_AllZustandspassiv.hkl\r\n", + "Babelfish.png hkldb_AllZustandspassiv_old.hkl\r\n", + "bagofwordshkldb1Aktiv.pkl hkldbFremd_WB1.hkl\r\n", + "bagofwordshkldb1Vorgangspassiv.pkl hkldbFremd_WB2.hkl\r\n", + "bagofwordshkldb1Zustandspassiv.pkl hkldbFremd_WB_All.hkl\r\n", + "bagofwordshkldb2Aktiv.pkl hkldbIndi_Conju1.hkl\r\n", + "bagofwordshkldb2Vorgangspassiv.pkl hkldbIndi_Conju2.hkl\r\n", + "bagofwordshkldb2Zustandspassiv.pkl hkldbIndi_Conju_All.hkl\r\n", + "bagofwordshkldbFremd_WB1.pkl hkldbMedio1.hkl\r\n", + "bagofwordshkldbFremd_WB2.pkl hkldbMedio2.hkl\r\n", + "bagofwordshkldbIndi_Conju1.pkl hkldbMedio_All.hkl\r\n", + "bagofwordshkldbIndi_Conju2.pkl hkldbOpposites1.hkl\r\n", + "bagofwordshkldbMedio1.pkl hkldbOpposites2.hkl\r\n", + "bagofwordshkldbMedio2.pkl hkldbOpposites_All.hkl\r\n", + "bagofwordshkldbOpposites1.pkl hkldbShorts_All.hkl\r\n", + "bagofwordshkldbOpposites2.pkl hkldbShorts.hkl\r\n", + "bagofwordshkldbShorts.pkl \u001b[0m\u001b[01;34mhtml\u001b[0m/\r\n", + "bagofwords.pkl HurrakiWoerterbuch_nodoubles.txt\r\n", + "bagofwordstwolabel.pkl Indikativ_Conjunktiv.txt\r\n", + "brainBasaBuuka5.png Medio.py\r\n", + "ConjunctSolve.py mediowords.txt\r\n", + "DataBaseOneZeroshkldb1Aktiv.hkl oi.py\r\n", + "DataBaseOneZeroshkldb1Vorgangspassiv.hkl Passiv2Aktiv.py\r\n", + "DataBaseOneZeroshkldb1Zustandspassiv.hkl Prototype.ipynb\r\n", + "DataBaseOneZeroshkldb2Aktiv.hkl \u001b[01;34m__pycache__\u001b[0m/\r\n", + "DataBaseOneZeroshkldb2Vorgangspassiv.hkl requirements.txt\r\n", + "DataBaseOneZeroshkldb2Zustandspassiv.hkl SayYes.py\r\n", + "DataBaseOneZeroshkldbFremd_WB1.hkl SentGlue.py\r\n", + "DataBaseOneZeroshkldbFremd_WB2.hkl SentSeg.py\r\n", + "DataBaseOneZeroshkldbIndi_Conju1.hkl SolveShorts.py\r\n", + "DataBaseOneZeroshkldbIndi_Conju2.hkl svg.py\r\n", + "DataBaseOneZeroshkldbMedio1.hkl test1out\r\n", + "DataBaseOneZeroshkldbMedio2.hkl trainedSGD.pkl\r\n", + "DataBaseOneZeroshkldbOpposites1.hkl trainedSGD_twolabel.pkl\r\n", + "DataBaseOneZeroshkldbOpposites2.hkl untitled.txt\r\n", + "DataBaseOneZeroshkldbShorts.hkl UseConjunctiveSolve.ipynb\r\n", + "FASTsearch.py Use_ConjunctSolve.py\r\n", + "FremdWB.py Use_Fremd_WB.ipynb\r\n", + "Gegenwoerter.csv UseGenitivSolve.ipynb\r\n", + "GenitivSolve.py Use_GenitivSolve.py\r\n", + "GS_Utils.py Use_Medio.ipynb\r\n", + "hkldb1Aktiv.hkl UsePassiv2Aktiv.ipynb\r\n", + "hkldb1Aktiv_old.hkl Use_Passiv2Aktiv.py\r\n", + "hkldb1Vorgangspassiv.hkl UseSayYes.ipynb\r\n", + "hkldb1Vorgangspassiv_old.hkl Use_SayYes.py\r\n", + "hkldb1Zustandspassiv.hkl UseSentSeg.ipynb\r\n", + "hkldb1Zustandspassiv_old.hkl Use_SentSeg.py\r\n", + "hkldb2Aktiv.hkl UseSolveShorts.ipynb\r\n", + "hkldb2Aktiv_old.hkl Use_SolveShorts.py\r\n", + "hkldb2Vorgangspassiv.hkl \u001b[01;34mVerbesserungen\u001b[0m/\r\n", + "hkldb2Vorgangspassiv_old.hkl voilastate.db\r\n", + "hkldb2Zustandspassiv.hkl Vorgangspassiv.txt\r\n", + "hkldb2Zustandspassiv_old.hkl Zustandspassiv.txt\r\n", + "hkldb_AllAktiv.hkl\r\n" + ] + } + ], + "source": [ + "ls\n" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/Prototyp/Verbesserungen/Input152.txt b/Prototyp/Verbesserungen/Input152.txt new file mode 100644 index 00000000..8d79e395 --- /dev/null +++ b/Prototyp/Verbesserungen/Input152.txt @@ -0,0 +1 @@ +ich würde über die Straße gehen, wenn das Wetter schöner wäre . diff --git a/Prototyp/Verbesserungen/Input153.txt b/Prototyp/Verbesserungen/Input153.txt new file mode 100644 index 00000000..064d90ca --- /dev/null +++ b/Prototyp/Verbesserungen/Input153.txt @@ -0,0 +1 @@ +der Gang des Lennart war nicht ominös, weil Trüffelschweine nicht lukrativ sind . diff --git a/Prototyp/Verbesserungen/Input154.txt b/Prototyp/Verbesserungen/Input154.txt new file mode 100644 index 00000000..8ae69fe1 --- /dev/null +++ b/Prototyp/Verbesserungen/Input154.txt @@ -0,0 +1 @@ +ich gehe nach oben, da es unten etwas zu dunkel ist . diff --git a/Prototyp/Verbesserungen/Input155.txt b/Prototyp/Verbesserungen/Input155.txt new file mode 100644 index 00000000..f8344098 --- /dev/null +++ b/Prototyp/Verbesserungen/Input155.txt @@ -0,0 +1,7 @@ +wie auch immer die Präsidentschaftswahl in den USA am Ende ausgehen wird, etwas steht jetzt schon fest : +wer in der Meinungsforschung beschäftigt ist, sollte einen Berufswechsel ins Auge fassen . +jede Kristallkugel ist zuverlässiger als diese Branche . +einmal kann eine katastrophale Fehleinschätzung wie die von 2016 verziehen werden, als ein Sieg von Hillary Clinton sicher zu sein schien . +sobald es aber ein zweites Mal passiert, ist Vertrauen dauerhaft verspielt . +selbst wenn Joe Biden die Präsidentschaft doch noch erringen sollte : +von einer tiefgreifenden Trendwende, einem Erdrutschsieg gar, kann keine Rede sein . diff --git a/Prototyp/Verbesserungen/Input156.txt b/Prototyp/Verbesserungen/Input156.txt new file mode 100644 index 00000000..ace7ad17 --- /dev/null +++ b/Prototyp/Verbesserungen/Input156.txt @@ -0,0 +1,4 @@ +in den nächsten Tagen und Wochen gilt es die Ursachen für das Ergebnis zu analysieren . +allerdings bitte nicht allzu eilfertig . +wenn sich ein so großer Teil der politischen Fachwelt verschätzt – es waren ja nicht nur die Demoskopen ! +–, dann ist es keine dumme Idee, erst einmal tief Luft zu holen . diff --git a/Prototyp/Verbesserungen/Input157.txt b/Prototyp/Verbesserungen/Input157.txt new file mode 100644 index 00000000..7f684445 --- /dev/null +++ b/Prototyp/Verbesserungen/Input157.txt @@ -0,0 +1,7 @@ +Beispiel: Corona . +in den USA und andernorts wurde vor allem darüber gestritten, wie sehr Donald Trump sein Umgang mit der Seuche geschadet hat, ob nämlich mehr oder weniger . +aber vielleicht hat er ihm gar nicht geschadet, sondern genutzt . +die Wahrheit ist : +wir wissen es nicht . +wir wissen offenbar insgesamt sehr viel weniger über Stimmungen und grundsätzliche Einstellungen eines großen Teils der Bevölkerung, als wir glauben . +das ist bedrückend . diff --git a/Prototyp/Verbesserungen/Input158.txt b/Prototyp/Verbesserungen/Input158.txt new file mode 100644 index 00000000..d33c1fc9 --- /dev/null +++ b/Prototyp/Verbesserungen/Input158.txt @@ -0,0 +1,8 @@ +das Problem ist nicht in erster Linie, dass jemand derlei versucht . +das Problem ist, dass ein beträchtlicher Teil der Öffentlichkeit dazu stehend applaudiert . +die Amis sind halt blöd ? +von wegen . +auch in Teilen Europas steht Demokratie derzeit nicht hoch im Kurs, ein Blick nach Ungarn oder Polen ist aufschlussreich . +und der Verlauf der US-Präsidentschaftswahlen kann nur Wasser auf die Mühlen von Rechtspopulisten sein . +trübe Aussichten . +unabhängig davon, wie der nächste Präsident der Vereinigten Staaten heißen wird . diff --git a/Prototyp/Verbesserungen/Output152.txt b/Prototyp/Verbesserungen/Output152.txt new file mode 100644 index 00000000..1d51d132 --- /dev/null +++ b/Prototyp/Verbesserungen/Output152.txt @@ -0,0 +1,6 @@ +ich werde ueber die Strasse gehen . +wenn das Wetter schoener war . +das Wetter entsteht draussen an der Erd·ober·flaeche . +es gibt verschiedenes Wetter . +zum Beispiel : +Sonnenschein Bewoelkung Regen Wind Hitze Kaelte . diff --git a/Prototyp/Verbesserungen/Output153.txt b/Prototyp/Verbesserungen/Output153.txt new file mode 100644 index 00000000..1980b3cb --- /dev/null +++ b/Prototyp/Verbesserungen/Output153.txt @@ -0,0 +1,2 @@ +der Gang des Lennart war nicht ominoes . +weil Trueffelschweine nicht lukrativ sind . diff --git a/Prototyp/Verbesserungen/Output154.txt b/Prototyp/Verbesserungen/Output154.txt new file mode 100644 index 00000000..974a84ec --- /dev/null +++ b/Prototyp/Verbesserungen/Output154.txt @@ -0,0 +1,2 @@ +ich gehe nach oben . +da es unten etwas zu dunkel ist . diff --git a/Prototyp/Verbesserungen/Output155.txt b/Prototyp/Verbesserungen/Output155.txt new file mode 100644 index 00000000..60642510 --- /dev/null +++ b/Prototyp/Verbesserungen/Output155.txt @@ -0,0 +1,16 @@ +von einer tiefgreifenden Trendwende . +eine Trend-Wende ist eine Änderung . +eine Änderung von einer bestimmten Richtung . +wie auch immer die Praesidentschaftswahl am Ende ausgegangen wird . +etwas steht jetzt schon fest . +die Praesidentschaftswahl ist in den USA . +die USA sind ein Land in Amerika . +wer in der Meinungsforschung beschaeftigt ist . +sollte einen Berufswechsel ins Auge fassen . +jede Kristallkugel ist zuverlaessiger als diese Branche . +einmal kann eine katastrophale Fehleinschaetzung wie die von 2016 verziehen werden . +als ein Sieg von Hillary Clinton sicher zu sein schien es . +sobald es aber ein zweites Mal passiert . +ist Vertrauen dauerhaft verspielt . +selbst wenn Joe Biden die Praesidentschaft doch noch erringen sollte . +von einer tiefgreifenden Trendwende, einem Erdrutschsieg gar, kann eine schweigene sein . diff --git a/Prototyp/Verbesserungen/Output156.txt b/Prototyp/Verbesserungen/Output156.txt new file mode 100644 index 00000000..13e4d92d --- /dev/null +++ b/Prototyp/Verbesserungen/Output156.txt @@ -0,0 +1,7 @@ +in den naechsten Tagen und Wochen gilt es die Ursachen fuer das Ergebnis zu analysieren . +allerdings bitte nicht allzu eilfertig . +wenn sich ein so grosser Teil der politischen Fachwelt verschaetzt – es waren ja nicht nur die Demoskopen ! +–, dann ist es eine kluge Idee, erst einmal tief Luft zu holen . +eine Idee ist ein Einfall im Kopf . +an eine Idee denkt man . +sie ist ein Gedanke . diff --git a/Prototyp/Verbesserungen/Output157.txt b/Prototyp/Verbesserungen/Output157.txt new file mode 100644 index 00000000..6c07c450 --- /dev/null +++ b/Prototyp/Verbesserungen/Output157.txt @@ -0,0 +1,13 @@ +in den USA und andernorts vor allem darueber stritt jemand . +die USA sind ein Land in Amerika . +Beispiel : +Corona . +in den USA und andernorts wurde vor allem darueber gestritten, wie sehr Donald Trump sein Umgang mit der Seuche geschadet hat, ob naemlich mehr oder weniger . +aber vielleicht hat er ihm gar nicht geschadet . +Sondern genutzt . +die Wahrheit ist . +wir wissen es nicht . +wir wissen offenbar insgesamt sehr viel weniger ueber Stimmungen und grundsaetzliche Einstellungen eines grossen Teils der Bevoelkerung . +das Wort offenbar ist ein Adjektiv . +als wir glauben . +das ist bedrueckend . diff --git a/Prototyp/Verbesserungen/Output158.txt b/Prototyp/Verbesserungen/Output158.txt new file mode 100644 index 00000000..5bba1633 --- /dev/null +++ b/Prototyp/Verbesserungen/Output158.txt @@ -0,0 +1,27 @@ +das Problem ist nicht in erster Linie . +dass jemand derlei versucht . +das Problem ist . +dass ein betraechtlicher Teil der Öffentlichkeit dazu stehend applaudiert . +die Amis sind halt bloed ? +von wegen . +auch in Teilen Europas steht Demokratie derzeit niedrig im Kurs . +das Wort Demokratie ist griechisch . +es heisst auf deutsch : +"Herrschaft des Volkes" . +ein Blick nach Ungarn oder Polen ist aufschlussreich . +Ungarn ist ein Land in Mittel-Europa . +der ungarische Name lautet Magyarország . +Ungarn ist ein Binnen·staat . +das heisst : +um Ungarn herum sind nur Laender . +kein Meer . +die Haupt·stadt von Ungarn ist : +Budapest . +Polen ist ein Land in Mittel·europa . +die Menschen die in Polen leben heissen Polen . +die Haupt·stadt von Polen ist Warschau . +und der Verlauf der US-Praesidentschaftswahlen kann nur Wasser auf die Muehlen von Rechtspopulisten sein . +Truebe Aussichten . +unabhaengig davon . +wie der naechste Praesident der Vereinigten Staaten heissen wird . +Praesident gibt es in verschiedenen Bedeutungen . diff --git a/Prototyp/Verbesserungen/Verbesserungen152.txt b/Prototyp/Verbesserungen/Verbesserungen152.txt new file mode 100644 index 00000000..cbbe2b46 --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen152.txt @@ -0,0 +1,6 @@ +ich werde ueber die Strasse gehen . +wenn das Wetter schoener ist . +das Wetter entsteht draussen an der Erd·ober·flaeche . +es gibt verschiedenes Wetter . +zum Beispiel : +Sonnenschein Bewoelkung Regen Wind Hitze Kaelte . diff --git a/Prototyp/Verbesserungen/Verbesserungen153.txt b/Prototyp/Verbesserungen/Verbesserungen153.txt new file mode 100644 index 00000000..1980b3cb --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen153.txt @@ -0,0 +1,2 @@ +der Gang des Lennart war nicht ominoes . +weil Trueffelschweine nicht lukrativ sind . diff --git a/Prototyp/Verbesserungen/Verbesserungen154.txt b/Prototyp/Verbesserungen/Verbesserungen154.txt new file mode 100644 index 00000000..974a84ec --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen154.txt @@ -0,0 +1,2 @@ +ich gehe nach oben . +da es unten etwas zu dunkel ist . diff --git a/Prototyp/Verbesserungen/Verbesserungen155.txt b/Prototyp/Verbesserungen/Verbesserungen155.txt new file mode 100644 index 00000000..0c328914 --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen155.txt @@ -0,0 +1,17 @@ +wie auch immer die Praesidentschaftswahl am Ende ausgehen wird . +etwas steht jetzt schon fest . +die Praesidentschaftswahl ist in den USA . +die USA sind ein Land in Amerika . +wer in der Meinungsforschung beschaeftigt ist . +der sollte einen Berufswechsel ins Auge fassen . +jede Kristallkugel ist zuverlaessiger als diese Branche . +einmal kann eine katastrophale Fehleinschaetzung verziehen werden . +wie die von 2016 . +als ein Sieg von Hillary Clinton sicher zu sein schien . +sobald es aber ein zweites Mal passiert . +dann ist Vertrauen dauerhaft verspielt . +selbst wenn Joe Biden die Praesidentschaft doch noch erringen sollte . +von einer tiefgreifenden Trendwende kann keine Rede sein . +eine Trend-Wende ist eine Änderung . +eine Änderung von einer bestimmten Richtung . +und von einem Erdrutschsieg kann keine Rede sein . diff --git a/Prototyp/Verbesserungen/Verbesserungen156.txt b/Prototyp/Verbesserungen/Verbesserungen156.txt new file mode 100644 index 00000000..e1955e65 --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen156.txt @@ -0,0 +1,9 @@ +in den naechsten Tagen und Wochen gilt es die Ursachen fuer das Ergebnis zu analysieren . +allerdings bitte nicht allzu eilfertig . +wenn sich ein so grosser Teil der politischen Fachwelt verschaetzt . +es waren ja nicht nur die Demoskopen ! +erst einmal tief Luft zu holen . +das ist dann eine kluge Idee . +eine Idee ist ein Einfall im Kopf . +an eine Idee denkt man . +sie ist ein Gedanke . diff --git a/Prototyp/Verbesserungen/Verbesserungen157.txt b/Prototyp/Verbesserungen/Verbesserungen157.txt new file mode 100644 index 00000000..f580600e --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen157.txt @@ -0,0 +1,14 @@ +Beispiel : +Corona . +wie sehr Donald Trump sein Umgang mit der Seuche geschadet hat . +naemlich ob mehr oder weniger . +vor allem darueber stritt jemand in den USA und andernorts . +die USA sind ein Land in Amerika . +aber vielleicht hat er ihm gar nicht geschadet . +sondern er hat ihm genutzt . +die Wahrheit ist . +wir wissen es nicht . +wir wissen offenbar insgesamt sehr viel weniger ueber Stimmungen und grundsaetzliche Einstellungen eines grossen Teils der Bevoelkerung . +das Wort offenbar ist ein Adjektiv . +als wir glauben . +das ist bedrueckend . diff --git a/Prototyp/Verbesserungen/Verbesserungen158.txt b/Prototyp/Verbesserungen/Verbesserungen158.txt new file mode 100644 index 00000000..5c47e470 --- /dev/null +++ b/Prototyp/Verbesserungen/Verbesserungen158.txt @@ -0,0 +1,27 @@ +das Problem ist nicht in erster Linie . +dass jemand derlei versucht . +das Problem ist . +dass ein betraechtlicher Teil der Öffentlichkeit dazu stehend applaudiert . +die Amis sind halt bloed ? +von wegen . +auch in Teilen Europas steht Demokratie derzeit niedrig im Kurs . +das Wort Demokratie ist griechisch . +es heisst auf deutsch : +"Herrschaft des Volkes" . +ein Blick nach Ungarn oder Polen ist aufschlussreich . +Ungarn ist ein Land in Mittel-Europa . +der ungarische Name lautet Magyarország . +Ungarn ist ein Binnen·staat . +das heisst : +um Ungarn herum sind nur Laender . +kein Meer . +die Haupt·stadt von Ungarn ist : +Budapest . +Polen ist ein Land in Mittel·europa . +die Menschen die in Polen leben heissen Polen . +die Haupt·stadt von Polen ist Warschau . +und der Verlauf der US-Praesidentschaftswahlen kann nur Wasser auf die Muehlen von Rechtspopulisten sein . +Truebe Aussichten . +wie der naechste Praesident der Vereinigten Staaten heissen wird . +davon ist das unabhaengig . +Praesident gibt es in verschiedenen Bedeutungen . diff --git a/Prototyp/Verbesserungen/indexDerVerbesserungen.txt b/Prototyp/Verbesserungen/indexDerVerbesserungen.txt index c663e4d0..147ea53b 100644 --- a/Prototyp/Verbesserungen/indexDerVerbesserungen.txt +++ b/Prototyp/Verbesserungen/indexDerVerbesserungen.txt @@ -1 +1 @@ -151 \ No newline at end of file +158 \ No newline at end of file diff --git a/Prototyp/hkldbFremd_WB1.hkl b/Prototyp/hkldbFremd_WB1.hkl index 4526bc61..150bbbda 100644 Binary files a/Prototyp/hkldbFremd_WB1.hkl and b/Prototyp/hkldbFremd_WB1.hkl differ diff --git a/Prototyp/hkldbFremd_WB2.hkl b/Prototyp/hkldbFremd_WB2.hkl index c427bbfb..896a2023 100644 Binary files a/Prototyp/hkldbFremd_WB2.hkl and b/Prototyp/hkldbFremd_WB2.hkl differ diff --git a/Prototyp/hkldbFremd_WB_All.hkl b/Prototyp/hkldbFremd_WB_All.hkl index 6c042296..00d3c962 100644 Binary files a/Prototyp/hkldbFremd_WB_All.hkl and b/Prototyp/hkldbFremd_WB_All.hkl differ diff --git a/Prototyp/html/example.html b/Prototyp/html/example.html new file mode 100644 index 00000000..3f7051bf --- /dev/null +++ b/Prototyp/html/example.html @@ -0,0 +1,560 @@ + + + + + + + + + + example of animation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prototyp/html/pathformer.js b/Prototyp/html/pathformer.js new file mode 100644 index 00000000..06747130 --- /dev/null +++ b/Prototyp/html/pathformer.js @@ -0,0 +1,276 @@ +'use strict'; + +/** + * Pathformer + * Beta version + * + * Take any SVG version 1.1 and transform + * child elements to 'path' elements + * + * This code is purely forked from + * https://github.com/Waest/SVGPathConverter + */ + +/** + * Class constructor + * + * @param {DOM|String} element Dom element of the SVG or id of it + */ +function Pathformer(element) { + // Test params + if (typeof element === 'undefined') { + throw new Error('Pathformer [constructor]: "element" parameter is required'); + } + + // Set the element + if (element.constructor === String) { + element = document.getElementById(element); + if (!element) { + throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID'); + } + } + if (element instanceof window.SVGElement || + element instanceof window.SVGGElement || + /^svg$/i.test(element.nodeName)) { + this.el = element; + } else { + throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement'); + } + + // Start + this.scan(element); +} + +/** + * List of tags which can be transformed + * to path elements + * + * @type {Array} + */ +Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect']; + +/** + * List of attribute names which contain + * data. This array list them to check if + * they contain bad values, like percentage. + * + * @type {Array} + */ +Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', 'y1', 'y2']; + +/** + * Finds the elements compatible for transform + * and apply the liked method + * + * @param {object} options Object from the constructor + */ +Pathformer.prototype.scan = function (svg) { + var fn, element, pathData, pathDom, + elements = svg.querySelectorAll(this.TYPES.join(',')); + + for (var i = 0; i < elements.length; i++) { + element = elements[i]; + fn = this[element.tagName.toLowerCase() + 'ToPath']; + pathData = fn(this.parseAttr(element.attributes)); + pathDom = this.pathMaker(element, pathData); + element.parentNode.replaceChild(pathDom, element); + } +}; + + +/** + * Read `line` element to extract and transform + * data, to make it ready for a `path` object. + * + * @param {DOMelement} element Line element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.lineToPath = function (element) { + var newElement = {}, + x1 = element.x1 || 0, + y1 = element.y1 || 0, + x2 = element.x2 || 0, + y2 = element.y2 || 0; + + newElement.d = 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2; + return newElement; +}; + +/** + * Read `rect` element to extract and transform + * data, to make it ready for a `path` object. + * The radius-border is not taken in charge yet. + * (your help is more than welcomed) + * + * @param {DOMelement} element Rect element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.rectToPath = function (element) { + var newElement = {}, + x = parseFloat(element.x) || 0, + y = parseFloat(element.y) || 0, + width = parseFloat(element.width) || 0, + height = parseFloat(element.height) || 0; + + if (element.rx || element.ry) { + var rx = parseInt(element.rx, 10) || -1, + ry = parseInt(element.ry, 10) || -1; + rx = Math.min(Math.max(rx < 0 ? ry : rx, 0), width/2); + ry = Math.min(Math.max(ry < 0 ? rx : ry, 0), height/2); + + newElement.d = 'M ' + (x + rx) + ',' + y + ' ' + + 'L ' + (x + width - rx) + ',' + y + ' ' + + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width) + ',' + (y + ry) + ' ' + + 'L ' + (x + width) + ',' + (y + height - ry) + ' ' + + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width - rx) + ',' + (y + height) + ' ' + + 'L ' + (x + rx) + ',' + (y + height) + ' ' + + 'A ' + rx + ',' + ry + ',0,0,1,' + x + ',' + (y + height - ry) + ' ' + + 'L ' + x + ',' + (y + ry) + ' ' + + 'A ' + rx + ',' + ry + ',0,0,1,' + (x + rx) + ',' + y; + } + else { + newElement.d = 'M' + x + ' ' + y + ' ' + + 'L' + (x + width) + ' ' + y + ' ' + + 'L' + (x + width) + ' ' + (y + height) + ' ' + + 'L' + x + ' ' + (y + height) + ' Z'; + } + return newElement; +}; + +/** + * Read `polyline` element to extract and transform + * data, to make it ready for a `path` object. + * + * @param {DOMelement} element Polyline element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.polylineToPath = function (element) { + var newElement = {}, + points = element.points.trim().split(' '), + i, path; + + // Reformatting if points are defined without commas + if (element.points.indexOf(',') === -1) { + var formattedPoints = []; + for (i = 0; i < points.length; i+=2) { + formattedPoints.push(points[i] + ',' + points[i+1]); + } + points = formattedPoints; + } + + // Generate the path.d value + path = 'M' + points[0]; + for(i = 1; i < points.length; i++) { + if (points[i].indexOf(',') !== -1) { + path += 'L' + points[i]; + } + } + newElement.d = path; + return newElement; +}; + +/** + * Read `polygon` element to extract and transform + * data, to make it ready for a `path` object. + * This method rely on polylineToPath, because the + * logic is similar. The path created is just closed, + * so it needs an 'Z' at the end. + * + * @param {DOMelement} element Polygon element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.polygonToPath = function (element) { + var newElement = Pathformer.prototype.polylineToPath(element); + + newElement.d += 'Z'; + return newElement; +}; + +/** + * Read `ellipse` element to extract and transform + * data, to make it ready for a `path` object. + * + * @param {DOMelement} element ellipse element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.ellipseToPath = function (element) { + var newElement = {}, + rx = parseFloat(element.rx) || 0, + ry = parseFloat(element.ry) || 0, + cx = parseFloat(element.cx) || 0, + cy = parseFloat(element.cy) || 0, + startX = cx - rx, + startY = cy, + endX = parseFloat(cx) + parseFloat(rx), + endY = cy; + + newElement.d = 'M' + startX + ',' + startY + + 'A' + rx + ',' + ry + ' 0,1,1 ' + endX + ',' + endY + + 'A' + rx + ',' + ry + ' 0,1,1 ' + startX + ',' + endY; + return newElement; +}; + +/** + * Read `circle` element to extract and transform + * data, to make it ready for a `path` object. + * + * @param {DOMelement} element Circle element to transform + * @return {object} Data for a `path` element + */ +Pathformer.prototype.circleToPath = function (element) { + var newElement = {}, + r = parseFloat(element.r) || 0, + cx = parseFloat(element.cx) || 0, + cy = parseFloat(element.cy) || 0, + startX = cx - r, + startY = cy, + endX = parseFloat(cx) + parseFloat(r), + endY = cy; + + newElement.d = 'M' + startX + ',' + startY + + 'A' + r + ',' + r + ' 0,1,1 ' + endX + ',' + endY + + 'A' + r + ',' + r + ' 0,1,1 ' + startX + ',' + endY; + return newElement; +}; + +/** + * Create `path` elements form original element + * and prepared objects + * + * @param {DOMelement} element Original element to transform + * @param {object} pathData Path data (from `toPath` methods) + * @return {DOMelement} Path element + */ +Pathformer.prototype.pathMaker = function (element, pathData) { + var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path'); + for(i = 0; i < element.attributes.length; i++) { + attr = element.attributes[i]; + if (this.ATTR_WATCH.indexOf(attr.name) === -1) { + pathTag.setAttribute(attr.name, attr.value); + } + } + for(i in pathData) { + pathTag.setAttribute(i, pathData[i]); + } + return pathTag; +}; + +/** + * Parse attributes of a DOM element to + * get an object of attribute => value + * + * @param {NamedNodeMap} attributes Attributes object from DOM element to parse + * @return {object} Object of attributes + */ +Pathformer.prototype.parseAttr = function (element) { + var attr, output = {}; + for (var i = 0; i < element.length; i++) { + attr = element[i]; + // Check if no data attribute contains '%', or the transformation is impossible + if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) { + throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.'); + } + output[attr.name] = attr.value; + } + return output; +}; diff --git a/Prototyp/html/vivus.js b/Prototyp/html/vivus.js new file mode 100644 index 00000000..7127c575 --- /dev/null +++ b/Prototyp/html/vivus.js @@ -0,0 +1,859 @@ +'use strict'; + +var setupEnv, requestAnimFrame, cancelAnimFrame, parsePositiveInt; + +/** + * Vivus + * Beta version + * + * Take any SVG and make the animation + * to give give the impression of live drawing + * + * This in more than just inspired from codrops + * At that point, it's a pure fork. + */ + +/** + * Class constructor + * option structure + * type: 'delayed'|'sync'|'oneByOne'|'script' (to know if the items must be drawn synchronously or not, default: delayed) + * duration: (in frames) + * start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport) + * delay: (delay between the drawing of first and last path) + * dashGap whitespace extra margin between dashes + * pathTimingFunction timing animation function for each path element of the SVG + * animTimingFunction timing animation function for the complete SVG + * forceRender force the browser to re-render all updated path items + * selfDestroy removes all extra styling on the SVG, and leaves it as original + * + * The attribute 'type' is by default on 'delayed'. + * - 'delayed' + * all paths are draw at the same time but with a + * little delay between them before start + * - 'sync' + * all path are start and finish at the same time + * - 'oneByOne' + * only one path is draw at the time + * the end of the first one will trigger the draw + * of the next one + * + * All these values can be overwritten individually + * for each path item in the SVG + * The value of frames will always take the advantage of + * the duration value. + * If you fail somewhere, an error will be thrown. + * Good luck. + * + * @constructor + * @this {Vivus} + * @param {DOM|String} element Dom element of the SVG or id of it + * @param {Object} options Options about the animation + * @param {Function} callback Callback for the end of the animation + */ +function Vivus(element, options, callback) { + setupEnv(); + + // Setup + this.isReady = false; + this.setElement(element, options); + this.setOptions(options); + this.setCallback(callback); + + if (this.isReady) { + this.init(); + } +} + +/** + * Timing functions + ************************************** + * + * Default functions to help developers. + * It always take a number as parameter (between 0 to 1) then + * return a number (between 0 and 1) + */ +Vivus.LINEAR = function(x) { + return x; +}; +Vivus.EASE = function(x) { + return -Math.cos(x * Math.PI) / 2 + 0.5; +}; +Vivus.EASE_OUT = function(x) { + return 1 - Math.pow(1 - x, 3); +}; +Vivus.EASE_IN = function(x) { + return Math.pow(x, 3); +}; +Vivus.EASE_OUT_BOUNCE = function(x) { + var base = -Math.cos(x * (0.5 * Math.PI)) + 1, + rate = Math.pow(base, 1.5), + rateR = Math.pow(1 - x, 2), + progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI))) + 1; + return 1 - rateR + progress * rateR; +}; + +/** + * Setters + ************************************** + */ + +/** + * Check and set the element in the instance + * The method will not return anything, but will throw an + * error if the parameter is invalid + * + * @param {DOM|String} element SVG Dom element or id of it + */ +Vivus.prototype.setElement = function(element, options) { + var onLoad, self; + + // Basic check + if (typeof element === 'undefined') { + throw new Error('Vivus [constructor]: "element" parameter is required'); + } + + // Set the element + if (element.constructor === String) { + element = document.getElementById(element); + if (!element) { + throw new Error( + 'Vivus [constructor]: "element" parameter is not related to an existing ID' + ); + } + } + this.parentEl = element; + + // Load the SVG with XMLHttpRequest and extract the SVG + if (options && options.file) { + self = this; + onLoad = function() { + var domSandbox = document.createElement('div'); + domSandbox.innerHTML = this.responseText; + + var svgTag = domSandbox.querySelector('svg'); + if (!svgTag) { + throw new Error( + 'Vivus [load]: Cannot find the SVG in the loaded file : ' + + options.file + ); + } + + self.el = svgTag; + self.el.setAttribute('width', '100%'); + self.el.setAttribute('height', '100%'); + self.parentEl.appendChild(self.el); + self.isReady = true; + self.init(); + self = null; + }; + + var oReq = new window.XMLHttpRequest(); + oReq.addEventListener('load', onLoad); + oReq.open('GET', options.file); + oReq.send(); + return; + } + + switch (element.constructor) { + case window.SVGSVGElement: + case window.SVGElement: + case window.SVGGElement: + this.el = element; + this.isReady = true; + break; + + case window.HTMLObjectElement: + self = this; + onLoad = function(e) { + if (self.isReady) { + return; + } + self.el = + element.contentDocument && + element.contentDocument.querySelector('svg'); + if (!self.el && e) { + throw new Error( + 'Vivus [constructor]: object loaded does not contain any SVG' + ); + } else if (self.el) { + if (element.getAttribute('built-by-vivus')) { + self.parentEl.insertBefore(self.el, element); + self.parentEl.removeChild(element); + self.el.setAttribute('width', '100%'); + self.el.setAttribute('height', '100%'); + } + self.isReady = true; + self.init(); + self = null; + } + }; + + if (!onLoad()) { + element.addEventListener('load', onLoad); + } + break; + + default: + throw new Error( + 'Vivus [constructor]: "element" parameter is not valid (or miss the "file" attribute)' + ); + } +}; + +/** + * Set up user option to the instance + * The method will not return anything, but will throw an + * error if the parameter is invalid + * + * @param {object} options Object from the constructor + */ +Vivus.prototype.setOptions = function(options) { + var allowedTypes = [ + 'delayed', + 'sync', + 'async', + 'nsync', + 'oneByOne', + 'scenario', + 'scenario-sync' + ]; + var allowedStarts = ['inViewport', 'manual', 'autostart']; + + // Basic check + if (options !== undefined && options.constructor !== Object) { + throw new Error( + 'Vivus [constructor]: "options" parameter must be an object' + ); + } else { + options = options || {}; + } + + // Set the animation type + if (options.type && allowedTypes.indexOf(options.type) === -1) { + throw new Error( + 'Vivus [constructor]: ' + + options.type + + ' is not an existing animation `type`' + ); + } else { + this.type = options.type || allowedTypes[0]; + } + + // Set the start type + if (options.start && allowedStarts.indexOf(options.start) === -1) { + throw new Error( + 'Vivus [constructor]: ' + + options.start + + ' is not an existing `start` option' + ); + } else { + this.start = options.start || allowedStarts[0]; + } + + this.isIE = + window.navigator.userAgent.indexOf('MSIE') !== -1 || + window.navigator.userAgent.indexOf('Trident/') !== -1 || + window.navigator.userAgent.indexOf('Edge/') !== -1; + this.duration = parsePositiveInt(options.duration, 120); + this.delay = parsePositiveInt(options.delay, null); + this.dashGap = parsePositiveInt(options.dashGap, 1); + this.forceRender = options.hasOwnProperty('forceRender') + ? !!options.forceRender + : this.isIE; + this.reverseStack = !!options.reverseStack; + this.selfDestroy = !!options.selfDestroy; + this.onReady = options.onReady; + this.map = []; + this.frameLength = this.currentFrame = this.delayUnit = this.speed = this.handle = null; + + this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') + ? !!options.ignoreInvisible + : false; + + this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR; + this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR; + + if (this.delay >= this.duration) { + throw new Error('Vivus [constructor]: delay must be shorter than duration'); + } +}; + +/** + * Set up callback to the instance + * The method will not return enything, but will throw an + * error if the parameter is invalid + * + * @param {Function} callback Callback for the animation end + */ +Vivus.prototype.setCallback = function(callback) { + // Basic check + if (!!callback && callback.constructor !== Function) { + throw new Error( + 'Vivus [constructor]: "callback" parameter must be a function' + ); + } + this.callback = callback || function() {}; +}; + +/** + * Core + ************************************** + */ + +/** + * Map the svg, path by path. + * The method return nothing, it just fill the + * `map` array. Each item in this array represent + * a path element from the SVG, with informations for + * the animation. + * + * ``` + * [ + * { + * el: the path element + * length: length of the path line + * startAt: time start of the path animation (in frames) + * duration: path animation duration (in frames) + * }, + * ... + * ] + * ``` + * + */ +Vivus.prototype.mapping = function() { + var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint; + timePoint = totalLength = lengthMeter = 0; + paths = this.el.querySelectorAll('path'); + + for (i = 0; i < paths.length; i++) { + path = paths[i]; + if (this.isInvisible(path)) { + continue; + } + pathObj = { + el: path, + length: Math.ceil(path.getTotalLength()) + }; + // Test if the path length is correct + if (isNaN(pathObj.length)) { + if (window.console && console.warn) { + console.warn( + 'Vivus [mapping]: cannot retrieve a path element length', + path + ); + } + continue; + } + this.map.push(pathObj); + path.style.strokeDasharray = + pathObj.length + ' ' + (pathObj.length + this.dashGap * 2); + path.style.strokeDashoffset = pathObj.length + this.dashGap; + pathObj.length += this.dashGap; + totalLength += pathObj.length; + + this.renderPath(i); + } + + totalLength = totalLength === 0 ? 1 : totalLength; + this.delay = this.delay === null ? this.duration / 3 : this.delay; + this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1); + + // Reverse stack if asked + if (this.reverseStack) { + this.map.reverse(); + } + + for (i = 0; i < this.map.length; i++) { + pathObj = this.map[i]; + + switch (this.type) { + case 'delayed': + pathObj.startAt = this.delayUnit * i; + pathObj.duration = this.duration - this.delay; + break; + + case 'oneByOne': + pathObj.startAt = (lengthMeter / totalLength) * this.duration; + pathObj.duration = (pathObj.length / totalLength) * this.duration; + break; + + case 'sync': + case 'async': + case 'nsync': + pathObj.startAt = 0; + pathObj.duration = this.duration; + break; + + case 'scenario-sync': + path = pathObj.el; + pAttrs = this.parseAttr(path); + pathObj.startAt = + timePoint + + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0); + pathObj.duration = parsePositiveInt( + pAttrs['data-duration'], + this.duration + ); + timePoint = + pAttrs['data-async'] !== undefined + ? pathObj.startAt + : pathObj.startAt + pathObj.duration; + this.frameLength = Math.max( + this.frameLength, + pathObj.startAt + pathObj.duration + ); + break; + + case 'scenario': + path = pathObj.el; + pAttrs = this.parseAttr(path); + pathObj.startAt = + parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0; + pathObj.duration = parsePositiveInt( + pAttrs['data-duration'], + this.duration + ); + this.frameLength = Math.max( + this.frameLength, + pathObj.startAt + pathObj.duration + ); + break; + } + lengthMeter += pathObj.length; + this.frameLength = this.frameLength || this.duration; + } +}; + +/** + * Interval method to draw the SVG from current + * position of the animation. It update the value of + * `currentFrame` and re-trace the SVG. + * + * It use this.handle to store the requestAnimationFrame + * and clear it one the animation is stopped. So this + * attribute can be used to know if the animation is + * playing. + * + * Once the animation at the end, this method will + * trigger the Vivus callback. + * + */ +Vivus.prototype.drawer = function() { + var self = this; + this.currentFrame += this.speed; + + if (this.currentFrame <= 0) { + this.stop(); + this.reset(); + } else if (this.currentFrame >= this.frameLength) { + this.stop(); + this.currentFrame = this.frameLength; + this.trace(); + if (this.selfDestroy) { + this.destroy(); + } + } else { + this.trace(); + this.handle = requestAnimFrame(function() { + self.drawer(); + }); + return; + } + + this.callback(this); + if (this.instanceCallback) { + this.instanceCallback(this); + this.instanceCallback = null; + } +}; + +/** + * Draw the SVG at the current instant from the + * `currentFrame` value. Here is where most of the magic is. + * The trick is to use the `strokeDashoffset` style property. + * + * For optimisation reasons, a new property called `progress` + * is added in each item of `map`. This one contain the current + * progress of the path element. Only if the new value is different + * the new value will be applied to the DOM element. This + * method save a lot of resources to re-render the SVG. And could + * be improved if the animation couldn't be played forward. + * + */ +Vivus.prototype.trace = function() { + var i, progress, path, currentFrame; + currentFrame = + this.animTimingFunction(this.currentFrame / this.frameLength) * + this.frameLength; + for (i = 0; i < this.map.length; i++) { + path = this.map[i]; + progress = (currentFrame - path.startAt) / path.duration; + progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress))); + if (path.progress !== progress) { + path.progress = progress; + path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress)); + this.renderPath(i); + } + } +}; + +/** + * Method forcing the browser to re-render a path element + * from it's index in the map. Depending on the `forceRender` + * value. + * The trick is to replace the path element by it's clone. + * This practice is not recommended because it's asking more + * ressources, too much DOM manupulation.. + * but it's the only way to let the magic happen on IE. + * By default, this fallback is only applied on IE. + * + * @param {Number} index Path index + */ +Vivus.prototype.renderPath = function(index) { + if (this.forceRender && this.map && this.map[index]) { + var pathObj = this.map[index], + newPath = pathObj.el.cloneNode(true); + pathObj.el.parentNode.replaceChild(newPath, pathObj.el); + pathObj.el = newPath; + } +}; + +/** + * When the SVG object is loaded and ready, + * this method will continue the initialisation. + * + * This this mainly due to the case of passing an + * object tag in the constructor. It will wait + * the end of the loading to initialise. + * + */ +Vivus.prototype.init = function() { + // Set object variables + this.frameLength = 0; + this.currentFrame = 0; + this.map = []; + + // Start + new Pathformer(this.el); + this.mapping(); + this.starter(); + + if (this.onReady) { + this.onReady(this); + } +}; + +/** + * Trigger to start of the animation. + * Depending on the `start` value, a different script + * will be applied. + * + * If the `start` value is not valid, an error will be thrown. + * Even if technically, this is impossible. + * + */ +Vivus.prototype.starter = function() { + switch (this.start) { + case 'manual': + return; + + case 'autostart': + this.play(); + break; + + case 'inViewport': + var self = this, + listener = function() { + if (self.isInViewport(self.parentEl, 1)) { + self.play(); + window.removeEventListener('scroll', listener); + } + }; + window.addEventListener('scroll', listener); + listener(); + break; + } +}; + +/** + * Controls + ************************************** + */ + +/** + * Get the current status of the animation between + * three different states: 'start', 'progress', 'end'. + * @return {string} Instance status + */ +Vivus.prototype.getStatus = function() { + return this.currentFrame === 0 + ? 'start' + : this.currentFrame === this.frameLength + ? 'end' + : 'progress'; +}; + +/** + * Reset the instance to the initial state : undraw + * Be careful, it just reset the animation, if you're + * playing the animation, this won't stop it. But just + * make it start from start. + * + */ +Vivus.prototype.reset = function() { + return this.setFrameProgress(0); +}; + +/** + * Set the instance to the final state : drawn + * Be careful, it just set the animation, if you're + * playing the animation on rewind, this won't stop it. + * But just make it start from the end. + * + */ +Vivus.prototype.finish = function() { + return this.setFrameProgress(1); +}; + +/** + * Set the level of progress of the drawing. + * + * @param {number} progress Level of progress to set + */ +Vivus.prototype.setFrameProgress = function(progress) { + progress = Math.min(1, Math.max(0, progress)); + this.currentFrame = Math.round(this.frameLength * progress); + this.trace(); + return this; +}; + +/** + * Play the animation at the desired speed. + * Speed must be a valid number (no zero). + * By default, the speed value is 1. + * But a negative value is accepted to go forward. + * + * And works with float too. + * But don't forget we are in JavaScript, se be nice + * with him and give him a 1/2^x value. + * + * @param {number} speed Animation speed [optional] + */ +Vivus.prototype.play = function(speed, callback) { + this.instanceCallback = null; + + if (speed && typeof speed === 'function') { + this.instanceCallback = speed; // first parameter is actually the callback function + speed = null; + } else if (speed && typeof speed !== 'number') { + throw new Error('Vivus [play]: invalid speed'); + } + // if the first parameter wasn't the callback, check if the seconds was + if (callback && typeof callback === 'function' && !this.instanceCallback) { + this.instanceCallback = callback; + } + + this.speed = speed || 1; + if (!this.handle) { + this.drawer(); + } + return this; +}; + +/** + * Stop the current animation, if on progress. + * Should not trigger any error. + * + */ +Vivus.prototype.stop = function() { + if (this.handle) { + cancelAnimFrame(this.handle); + this.handle = null; + } + return this; +}; + +/** + * Destroy the instance. + * Remove all bad styling attributes on all + * path tags + * + */ +Vivus.prototype.destroy = function() { + this.stop(); + var i, path; + for (i = 0; i < this.map.length; i++) { + path = this.map[i]; + path.el.style.strokeDashoffset = null; + path.el.style.strokeDasharray = null; + this.renderPath(i); + } +}; + +/** + * Utils methods + * include methods from Codrops + ************************************** + */ + +/** + * Method to best guess if a path should added into + * the animation or not. + * + * 1. Use the `data-vivus-ignore` attribute if set + * 2. Check if the instance must ignore invisible paths + * 3. Check if the path is visible + * + * For now the visibility checking is unstable. + * It will be used for a beta phase. + * + * Other improvments are planned. Like detecting + * is the path got a stroke or a valid opacity. + */ +Vivus.prototype.isInvisible = function(el) { + var rect, + ignoreAttr = el.getAttribute('data-ignore'); + + if (ignoreAttr !== null) { + return ignoreAttr !== 'false'; + } + + if (this.ignoreInvisible) { + rect = el.getBoundingClientRect(); + return !rect.width && !rect.height; + } else { + return false; + } +}; + +/** + * Parse attributes of a DOM element to + * get an object of {attributeName => attributeValue} + * + * @param {object} element DOM element to parse + * @return {object} Object of attributes + */ +Vivus.prototype.parseAttr = function(element) { + var attr, + output = {}; + if (element && element.attributes) { + for (var i = 0; i < element.attributes.length; i++) { + attr = element.attributes[i]; + output[attr.name] = attr.value; + } + } + return output; +}; + +/** + * Reply if an element is in the page viewport + * + * @param {object} el Element to observe + * @param {number} h Percentage of height + * @return {boolean} + */ +Vivus.prototype.isInViewport = function(el, h) { + var scrolled = this.scrollY(), + viewed = scrolled + this.getViewportH(), + elBCR = el.getBoundingClientRect(), + elHeight = elBCR.height, + elTop = scrolled + elBCR.top, + elBottom = elTop + elHeight; + + // if 0, the element is considered in the viewport as soon as it enters. + // if 1, the element is considered in the viewport only when it's fully inside + // value in percentage (1 >= h >= 0) + h = h || 0; + + return elTop + elHeight * h <= viewed && elBottom >= scrolled; +}; + +/** + * Get the viewport height in pixels + * + * @return {integer} Viewport height + */ +Vivus.prototype.getViewportH = function() { + var client = this.docElem.clientHeight, + inner = window.innerHeight; + + if (client < inner) { + return inner; + } else { + return client; + } +}; + +/** + * Get the page Y offset + * + * @return {integer} Page Y offset + */ +Vivus.prototype.scrollY = function() { + return window.pageYOffset || this.docElem.scrollTop; +}; + +setupEnv = function() { + if (Vivus.prototype.docElem) { + return; + } + + /** + * Alias for document element + * + * @type {DOMelement} + */ + Vivus.prototype.docElem = window.document.documentElement; + + /** + * Alias for `requestAnimationFrame` or + * `setTimeout` function for deprecated browsers. + * + */ + requestAnimFrame = (function() { + return ( + window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function(/* function */ callback) { + return window.setTimeout(callback, 1000 / 60); + } + ); + })(); + + /** + * Alias for `cancelAnimationFrame` or + * `cancelTimeout` function for deprecated browsers. + * + */ + cancelAnimFrame = (function() { + return ( + window.cancelAnimationFrame || + window.webkitCancelAnimationFrame || + window.mozCancelAnimationFrame || + window.oCancelAnimationFrame || + window.msCancelAnimationFrame || + function(id) { + return window.clearTimeout(id); + } + ); + })(); +}; + +/** + * Parse string to integer. + * If the number is not positive or null + * the method will return the default value + * or 0 if undefined + * + * @param {string} value String to parse + * @param {*} defaultValue Value to return if the result parsed is invalid + * @return {number} + * + */ +parsePositiveInt = function(value, defaultValue) { + var output = parseInt(value, 10); + return output >= 0 ? output : defaultValue; +}; diff --git a/Prototyp/svg.py b/Prototyp/svg.py new file mode 100644 index 00000000..ba11753a --- /dev/null +++ b/Prototyp/svg.py @@ -0,0 +1,5 @@ + + + + +class svg(object): \ No newline at end of file