瀏覽代碼

fixed visualizzazione contesti singoli

Leonardo Canova 1 年之前
父節點
當前提交
7719a6b007
共有 2 個文件被更改,包括 313 次插入30 次删除
  1. 1 1
      flask_be/engine/test/test_contesti_singoli.py
  2. 312 29
      flask_be/engine/test/test_contesti_singoli_notebook.ipynb

+ 1 - 1
flask_be/engine/test/test_contesti_singoli.py

@@ -56,7 +56,7 @@ def singlecontexts(textlist, index, parole, periodi, brani, listOcc, path):
                 contexts.append(cont)
                 context ['piniz'] = queryresponse["piniz"].min()
                 context ['pfin'] = queryresponse["pfin"].max() 
-    context['contesto'] = contexts
+    context['contesto'] = contexts [0]
     context['formattazione'] = formats
     return pd.DataFrame(context).T.reset_index()
 

+ 312 - 29
flask_be/engine/test/test_contesti_singoli_notebook.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -51,9 +51,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/5\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x2845a3e80>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 3,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"filius\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -63,7 +93,7 @@
     "search=ricercaforme(interpreter(parola), path, 0, 0)\n",
     "textlist=findtexts(type, search, listOcc, path)\n",
     "contexts = findcontexts(textlist, 30, 0, listOcc, path)\n",
-    "context = singlecontexts(contexts, 0, 0, 0, 4, listOcc, path)\n",
+    "context = singlecontexts(contexts, 0, 30, 0, 0, listOcc, path)\n",
     "links = findlinks(context, path)\n",
     "bibliocontext = singlefindbib(links, path)\n",
     "dtale.show(bibliocontext)"
@@ -87,9 +117,65 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 9,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Exception occurred while processing request: 'NoneType' object is not iterable\n",
+      "Traceback (most recent call last):\n",
+      "  File \"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dtale/views.py\", line 111, in _handle_exceptions\n",
+      "    return func(*args, **kwargs)\n",
+      "  File \"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dtale/views.py\", line 2547, in get_data\n",
+      "    curr_dtypes = [c[\"name\"] for c in global_state.get_dtypes(data_id)]\n",
+      "TypeError: 'NoneType' object is not iterable\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "2023-04-05 15:54:27,969 - ERROR    - Exception occurred while processing request: 'NoneType' object is not iterable\n",
+      "Traceback (most recent call last):\n",
+      "  File \"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dtale/views.py\", line 111, in _handle_exceptions\n",
+      "    return func(*args, **kwargs)\n",
+      "  File \"/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dtale/views.py\", line 2547, in get_data\n",
+      "    curr_dtypes = [c[\"name\"] for c in global_state.get_dtypes(data_id)]\n",
+      "TypeError: 'NoneType' object is not iterable\n"
+     ]
+    },
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/9\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x17fbd7f40>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 9,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"tarda\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -123,9 +209,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 10,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/10\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x2858c1bd0>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 10,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"amistade\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -159,9 +275,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/11\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x10823cca0>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 11,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"orgoglia\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -195,9 +341,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 12,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/12\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x17fbc88e0>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 12,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"intradetta\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -224,9 +400,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 13,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/13\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x17fb192a0>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 13,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"intradetta\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -262,9 +468,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 14,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/14\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x17fff8370>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 14,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"pennace\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -314,9 +550,39 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 15,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "\n",
+       "        <iframe\n",
+       "            width=\"100%\"\n",
+       "            height=\"475\"\n",
+       "            src=\"http://MacBook-Air-di-Leonardo-2.local:40000/dtale/iframe/15\"\n",
+       "            frameborder=\"0\"\n",
+       "            allowfullscreen\n",
+       "            \n",
+       "        ></iframe>\n",
+       "        "
+      ],
+      "text/plain": [
+       "<IPython.lib.display.IFrame at 0x2858ddc30>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "data": {
+      "text/plain": []
+     },
+     "execution_count": 15,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
    "source": [
     "parola = \"invitava\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",
@@ -358,9 +624,26 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
+   "execution_count": 16,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Nessun risultato\n"
+     ]
+    },
+    {
+     "ename": "SystemExit",
+     "evalue": "1",
+     "output_type": "error",
+     "traceback": [
+      "An exception has occurred, use %tb to see the full traceback.\n",
+      "\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m 1\n"
+     ]
+    }
+   ],
    "source": [
     "parola = \"altresì\"\n",
     "path = \"/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db\"\n",