{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 183,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "metadata": {},
   "outputs": [],
   "source": [
    "filepathnav=\"/home/maxwell/Desktop/sdfbsd/wlcling.github.io/_data/temp.csv\"\n",
    "nav=pd.read_csv(filepathnav,sep=\"\\t\",index_col=\"number\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "metadata": {},
   "outputs": [],
   "source": [
    "filepath=\"/home/maxwell/Desktop/sdfbsd/wlcling.github.io/_data/byword.csv\"\n",
    "df=pd.read_csv(filepath,sep=\"\\t\").fillna(\"\")\n",
    "df[\"extendedStrongNumber\"]=df[\"extendedStrongNumber\"].apply(lambda x: x.replace(\"_\",\"-\"))\n",
    "for i in df.loc[df[\"separ\"]==\"־\"][\"separ\"]: i=\"\"\n",
    "for i in df.loc[df[\"separ\"]==\" \"][\"separ\"]: i=\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "metadata": {},
   "outputs": [],
   "source": [
    "lexicon=df.groupby(\"lexemeID\")[\"gloss\"].unique().apply(lambda x: x[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "lexemeID\n",
       "E70001                 in\n",
       "E70002          beginning\n",
       "E70003             create\n",
       "E70004             god(s)\n",
       "E70005    [object marker]\n",
       "               ...       \n",
       "E79232           division\n",
       "E79233            portion\n",
       "E79234           division\n",
       "E79235            delight\n",
       "E79236               aged\n",
       "Name: gloss, Length: 9236, dtype: object"
      ]
     },
     "execution_count": 187,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lexicon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/maxwell/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:1: FutureWarning: The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`, and argument 'header' will change its default value from False to True: please pass an explicit value to suppress this warning.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "lexicon.to_csv(\"lexicon.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "morphlen=df[\"morphology\"].value_counts().index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0                                    conj\n",
       "1                                    prep\n",
       "2                                     art\n",
       "3                             subs.m.sg.a\n",
       "4                             nmpr.m.sg.a\n",
       "                      ...                \n",
       "1312    verb.hof.impf.p1.u.pl.prs.p3.m.pl\n",
       "1313              verb.pael.ptca.u.f.sg.a\n",
       "1314                          conj.f.sg.c\n",
       "1315              verb.pual.ptcp.u.m.sg.c\n",
       "1316              adjv.pael.ptcp.u.m.sg.a\n",
       "Length: 1317, dtype: object"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series(morphlen)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "mxl=len(str(len(morphlen)))\n",
    "mlex=pd.Series(morphlen.values,index=[\"M\"+'0'*(mxl-len(str(i)))+str(i) for i in range(1,len(morphlen)+1)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/maxwell/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:1: FutureWarning: The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`, and argument 'header' will change its default value from False to True: please pass an explicit value to suppress this warning.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "mlex.to_csv(\"mlexicon.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [],
   "source": [
    "mdic=dict(mlex)def hover(x):\n",
    "    index=x.find(\".\")\n",
    "    if index==-1: return x\n",
    "    else: return x[:index]\n",
    "\n",
    "def morph(x):\n",
    "    index=x.find(\".\")\n",
    "    if index==-1: return \"\"\n",
    "    else: return x[index+1:]\n",
    "\n",
    "\n",
    "def stransform(inputw):\n",
    "    if len(inputw)>0 and inputw[0]==\"[\":\n",
    "        return \" ʔăḏōnāy\"\n",
    "    elif len(inputw)>1 and inputw[0]==inputw[1]:\n",
    "        return \"-\"+inputw[0]+\"-\"+inputw[1:]\n",
    "    else:\n",
    "        return inputw\n",
    "\n",
    "def septransform(inputw):\n",
    "    if inputw==\"\":\n",
    "        return \"\"\n",
    "    if inputw==\"־\":\n",
    "        return \"\"\n",
    "    if inputw==\" \":\n",
    "        return \" \"\n",
    "    if inputw==\"׃ \":\n",
    "        return \"\"\n",
    "    else:\n",
    "        return \"\"\"<span style=\"font-size: 157%;padding:15px;background: blueviolet;\">{}</span>\"\"\".format(inputw)\n",
    "\n",
    "def beautify(phon):\n",
    "\treturn phon.replace(\"ḏ\",\"d\").replace(\"ḡ\",\"g\").replace(\"ṯ\",\"t\").replace(\"ḵ\",\"x\").replace(\"ʔ\",\"ʾ\").replace(\"ʕ\",\"ʿ\").replace(\"ₐ\",\"a\").replace(\"î\",\"ī\").replace(\"ê\",\"ē\").replace(\"ô\",\"ō\").replace(\"û\",\"ū\").replace(\"ᵒ\",\"ŏ\").replace(\"ᵉ\",\"ĕ\").replace(\"ᵃ\",\"ă\").replace(\"ᵊ\",\"ᵉ\").replace(\"ʸ\",\"\").replace(\"ˈ\",'<sub id=\"s\">́</sub>').replace(\"  \",\" \").replace(\" -\",\"-\")\n",
    "\n",
    "\n",
    "def repl(inputw):\n",
    "    text=beautify(inputw)\n",
    "    return text\n",
    "\n",
    "import pandas as pd\n",
    "print('Loading verses...\\r',end=\"\")    \n",
    "df=pd.read_csv(\"../_data/bible.csv\",sep=\"\\t\")\n",
    "ixv=pd.read_csv(\"../_data/indexv.csv\",sep=\"\\t\",header=None)\n",
    "\n",
    "\n",
    "print('Loading words...\\r',end=\"\")    \n",
    "dfw=pd.read_csv(\"../_data/byword.csv\",sep=\"\\t\").fillna(\" \")\n",
    "dfw[\"trans1\"]=dfw[\"trans1\"].apply(beautify)\n",
    "\n",
    "\n",
    "#dfw[\"wordcat\"]=dfwt +dfw[\"separ\"].apply(septransform)\n",
    "#words=dfw.fillna(\"\").groupby(\"WLCverse\")[\"wordcat\"].apply(list).apply(\"\".join).apply(repl)\n",
    "\n",
    "glosstr0=pd.DataFrame()\n",
    "collist=[\"lexemeID\",\"trans1\",\"morphology\"]\n",
    "for col in collist:\n",
    "    glosstr0[col]=dfw.fillna(\"\").groupby(\"WLCverse\")[col].apply(list)\n",
    "\n",
    "\n",
    "#with open(\"sources/words.csv\", \"w\") as text_file:\n",
    "#    text_file.write(\"\\n\".join(words))\n",
    "\n",
    "glosstr0[collist].to_csv(\"sources/glosstr0.csv\",index=False,quotechar=\" \")\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "mdicinv={mdic[x]:x for x in mdic.keys()}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading words....\r"
     ]
    },
    {
     "ename": "FileNotFoundError",
     "evalue": "[Errno 2] No such file or directory: 'sources/glosstr0.csv'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-82-c74a560730a2>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     65\u001b[0m \u001b[0;31m#    text_file.write(\"\\n\".join(words))\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     66\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 67\u001b[0;31m \u001b[0mglosstr0\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcollist\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"sources/glosstr0.csv\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mquotechar\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\" \"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mto_csv\u001b[0;34m(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal)\u001b[0m\n\u001b[1;32m   3227\u001b[0m             \u001b[0mdecimal\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecimal\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3228\u001b[0m         )\n\u001b[0;32m-> 3229\u001b[0;31m         \u001b[0mformatter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msave\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3230\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3231\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mpath_or_buf\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/pandas/io/formats/csvs.py\u001b[0m in \u001b[0;36msave\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    181\u001b[0m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    182\u001b[0m                 \u001b[0mencoding\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mencoding\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 183\u001b[0;31m                 \u001b[0mcompression\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompression\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    184\u001b[0m             )\n\u001b[1;32m    185\u001b[0m             \u001b[0mclose\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/pandas/io/common.py\u001b[0m in \u001b[0;36m_get_handle\u001b[0;34m(path_or_buf, mode, encoding, compression, memory_map, is_text)\u001b[0m\n\u001b[1;32m    395\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mencoding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    396\u001b[0m             \u001b[0;31m# Encoding\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 397\u001b[0;31m             \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath_or_buf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencoding\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencoding\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnewline\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    398\u001b[0m         \u001b[0;32melif\u001b[0m \u001b[0mis_text\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    399\u001b[0m             \u001b[0;31m# No explicit encoding\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'sources/glosstr0.csv'"
     ]
    }
   ],
   "source": [
    "def hover(x):\n",
    "    index=x.find(\".\")\n",
    "    if index==-1: return x\n",
    "    else: return x[:index]\n",
    "\n",
    "def morph(x):\n",
    "    index=x.find(\".\")\n",
    "    if index==-1: return \"\"\n",
    "    else: return x[index+1:]\n",
    "\n",
    "\n",
    "def stransform(inputw):\n",
    "    if len(inputw)>0 and inputw[0]==\"[\":\n",
    "        return \" ʔăḏōnāy\"\n",
    "    elif len(inputw)>1 and inputw[0]==inputw[1]:\n",
    "        return \"-\"+inputw[0]+\"-\"+inputw[1:]\n",
    "    else:\n",
    "        return inputw\n",
    "\n",
    "def septransform(inputw):\n",
    "    if inputw==\"\":\n",
    "        return \"\"\n",
    "    if inputw==\"־\":\n",
    "        return \"\"\n",
    "    if inputw==\" \":\n",
    "        return \" \"\n",
    "    if inputw==\"׃ \":\n",
    "        return \"\"\n",
    "    else:\n",
    "        return \"\"\"<span style=\"font-size: 157%;padding:15px;background: blueviolet;\">{}</span>\"\"\".format(inputw)\n",
    "\n",
    "def beautify(phon):\n",
    "\treturn phon.replace(\"ḏ\",\"d\").replace(\"ḡ\",\"g\").replace(\"ṯ\",\"t\").replace(\"ḵ\",\"x\").replace(\"ʔ\",\"ʾ\").replace(\"ʕ\",\"ʿ\").replace(\"ₐ\",\"a\").replace(\"î\",\"ī\").replace(\"ê\",\"ē\").replace(\"ô\",\"ō\").replace(\"û\",\"ū\").replace(\"ᵒ\",\"ŏ\").replace(\"ᵉ\",\"ĕ\").replace(\"ᵃ\",\"ă\").replace(\"ᵊ\",\"ᵉ\").replace(\"ʸ\",\"\").replace(\"ˈ\",'<sub id=\"s\">́</sub>').replace(\"  \",\" \").replace(\" -\",\"-\")\n",
    "\n",
    "\n",
    "def repl(inputw):\n",
    "    text=beautify(inputw)\n",
    "    return text\n",
    "\n",
    "import pandas as pd\n",
    "print('Loading verses...\\r',end=\"\")    \n",
    "df=pd.read_csv(\"sdfbsd/wlcling.github.io/_data/bible.csv\",sep=\"\\t\")\n",
    "ixv=pd.read_csv(\"sdfbsd/wlcling.github.io/_data/indexv.csv\",sep=\"\\t\",header=None)\n",
    "\n",
    "\n",
    "print('Loading words...\\r',end=\"\")    \n",
    "dfw=pd.read_csv(\"sdfbsd/wlcling.github.io/_data/byword.csv\",sep=\"\\t\").fillna(\" \")\n",
    "dfw[\"trans1\"]=dfw[\"trans1\"].apply(beautify)\n",
    "\n",
    "\n",
    "#dfw[\"wordcat\"]=dfwt +dfw[\"separ\"].apply(septransform)\n",
    "#words=dfw.fillna(\"\").groupby(\"WLCverse\")[\"wordcat\"].apply(list).apply(\"\".join).apply(repl)\n",
    "\n",
    "glosstr0=pd.DataFrame()\n",
    "collist=[\"lexemeID\",\"trans1\",\"morphology\"]\n",
    "for col in [\"lexemeID\",\"trans1\"]:\n",
    "    glosstr0[col]=dfw.fillna(\"\").groupby(\"WLCverse\")[col].apply(list)\n",
    "\n",
    "for col in [\"morphology\"]:\n",
    "    dfw[\"morphology\"]=dfw[\"morphology\"].apply(lambda x: mdicinv[x])\n",
    "    glosstr0[col]=dfw.fillna(\"\").groupby(\"WLCverse\")[col].apply(list)\n",
    "\n",
    "\n",
    "#with open(\"sources/words.csv\", \"w\") as text_file:\n",
    "#    text_file.write(\"\\n\".join(words))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "glosstr0[collist].to_csv(\"glosstr0.csv\",index=False,quotechar=\" \",sep=\"\\t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "metadata": {},
   "outputs": [],
   "source": [
    "morphodic=pd.read_csv(\"/home/maxwell/Desktop/sdfbsd/wlcling.github.io/translatoraid/sources/morphologydictionary.txt\",sep=\"\\t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 220,
   "metadata": {},
   "outputs": [],
   "source": [
    "mlexicon=pd.read_csv(\"/home/maxwell/Desktop/sdfbsd/wlcling.github.io/translatoraid/sources/mlexicon.csv\",sep=\",\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 221,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>key</th>\n",
       "      <th>value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>M0001</td>\n",
       "      <td>conj</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>M0002</td>\n",
       "      <td>prep</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>M0003</td>\n",
       "      <td>art</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>M0004</td>\n",
       "      <td>subs.m.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>M0005</td>\n",
       "      <td>nmpr.m.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>M0006</td>\n",
       "      <td>subs.m.sg.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>M0007</td>\n",
       "      <td>subs.m.pl.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>M0008</td>\n",
       "      <td>nmpr.u.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>M0009</td>\n",
       "      <td>subs.f.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>M0010</td>\n",
       "      <td>subs.m.pl.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>M0011</td>\n",
       "      <td>verb.qal.wayq.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>M0012</td>\n",
       "      <td>subs.u.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>M0013</td>\n",
       "      <td>nega</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>M0014</td>\n",
       "      <td>verb.qal.perf.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>M0015</td>\n",
       "      <td>advb</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>M0016</td>\n",
       "      <td>subs.f.sg.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>M0017</td>\n",
       "      <td>prep.prs.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>M0018</td>\n",
       "      <td>subs.f.pl.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>M0019</td>\n",
       "      <td>subs.m.sg.a.prs.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>M0020</td>\n",
       "      <td>verb.qal.impf.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>M0021</td>\n",
       "      <td>subs.u.sg.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>M0022</td>\n",
       "      <td>verb.qal.perf.p3.u.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>M0023</td>\n",
       "      <td>verb.qal.infc.u.u.u.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>M0024</td>\n",
       "      <td>adjv.m.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>M0025</td>\n",
       "      <td>verb.qal.wayq.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>M0026</td>\n",
       "      <td>prep.prs.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>M0027</td>\n",
       "      <td>subs.m.sg.a.prs.p1.u.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>M0028</td>\n",
       "      <td>subs.m.pl.a.prs.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>M0029</td>\n",
       "      <td>verb.qal.ptca.u.m.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>M0030</td>\n",
       "      <td>verb.qal.impf.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1287</th>\n",
       "      <td>M1288</td>\n",
       "      <td>advb.nif.ptca.u.f.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1288</th>\n",
       "      <td>M1289</td>\n",
       "      <td>verb.hof.wayq.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1289</th>\n",
       "      <td>M1290</td>\n",
       "      <td>subs.qal.ptcp.u.m.sg.a.prs.p2.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1290</th>\n",
       "      <td>M1291</td>\n",
       "      <td>verb.piel.perf.p3.m.sg.prs.p2.f.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1291</th>\n",
       "      <td>M1292</td>\n",
       "      <td>subs.qal.ptcp.u.m.pl.a.prs.p2.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1292</th>\n",
       "      <td>M1293</td>\n",
       "      <td>verb.tif.perf.p1.u.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1293</th>\n",
       "      <td>M1294</td>\n",
       "      <td>verb.piel.impv.p2.m.pl.prs.p1.u.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1294</th>\n",
       "      <td>M1295</td>\n",
       "      <td>verb.hif.perf.p3.f.sg.prs.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1295</th>\n",
       "      <td>M1296</td>\n",
       "      <td>verb.poel.perf.p1.u.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1296</th>\n",
       "      <td>M1297</td>\n",
       "      <td>verb.piel.wayq.p3.m.pl.prs.p1.u.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1297</th>\n",
       "      <td>M1298</td>\n",
       "      <td>verb.hif.ptca.u.m.sg.a.prs.p3.f.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1298</th>\n",
       "      <td>M1299</td>\n",
       "      <td>verb.hif.perf.p2.f.sg.prs.p1.u.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1299</th>\n",
       "      <td>M1300</td>\n",
       "      <td>verb.piel.wayq.p3.f.sg.prs.p3.f.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1300</th>\n",
       "      <td>M1301</td>\n",
       "      <td>subs.hif.infc.u.u.u.a.prs.p3.m.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1301</th>\n",
       "      <td>M1302</td>\n",
       "      <td>verb.htpe.ptca.u.m.pl.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1302</th>\n",
       "      <td>M1303</td>\n",
       "      <td>verb.hof.perf.p1.u.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1303</th>\n",
       "      <td>M1304</td>\n",
       "      <td>subs.nif.ptca.u.m.pl.a.prs.p2.f.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1304</th>\n",
       "      <td>M1305</td>\n",
       "      <td>verb.piel.wayq.p3.m.pl.prs.p1.u.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1305</th>\n",
       "      <td>M1306</td>\n",
       "      <td>verb.hof.infa.u.u.u.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1306</th>\n",
       "      <td>M1307</td>\n",
       "      <td>verb.hif.impf.p3.m.sg.prs.p2.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1307</th>\n",
       "      <td>M1308</td>\n",
       "      <td>verb.piel.impv.p2.f.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1308</th>\n",
       "      <td>M1309</td>\n",
       "      <td>subs.hif.ptca.u.m.pl.a.prs.p3.f.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>M1310</td>\n",
       "      <td>subs.qal.ptca.u.f.sg.a.prs.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1310</th>\n",
       "      <td>M1311</td>\n",
       "      <td>subs.qal.ptca.u.m.pl.a.prs.p1.u.sg</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1311</th>\n",
       "      <td>M1312</td>\n",
       "      <td>verb.peal.ptca.u.m.pl.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1312</th>\n",
       "      <td>M1313</td>\n",
       "      <td>verb.hof.impf.p1.u.pl.prs.p3.m.pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1313</th>\n",
       "      <td>M1314</td>\n",
       "      <td>verb.pael.ptca.u.f.sg.a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>M1315</td>\n",
       "      <td>conj.f.sg.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1315</th>\n",
       "      <td>M1316</td>\n",
       "      <td>verb.pual.ptcp.u.m.sg.c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1316</th>\n",
       "      <td>M1317</td>\n",
       "      <td>adjv.pael.ptcp.u.m.sg.a</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1317 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        key                              value\n",
       "0     M0001                               conj\n",
       "1     M0002                               prep\n",
       "2     M0003                                art\n",
       "3     M0004                        subs.m.sg.a\n",
       "4     M0005                        nmpr.m.sg.a\n",
       "...     ...                                ...\n",
       "1312  M1313  verb.hof.impf.p1.u.pl.prs.p3.m.pl\n",
       "1313  M1314            verb.pael.ptca.u.f.sg.a\n",
       "1314  M1315                        conj.f.sg.c\n",
       "1315  M1316            verb.pual.ptcp.u.m.sg.c\n",
       "1316  M1317            adjv.pael.ptcp.u.m.sg.a\n",
       "\n",
       "[1317 rows x 2 columns]"
      ]
     },
     "execution_count": 221,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mlexicon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 223,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp=mlexicon.merge(morphodic.drop_duplicates(), left_on=\"value\", right_on=\"morphologyCode\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 225,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp.to_csv(\"/home/maxwell/Desktop/sdfbsd/wlcling.github.io/translatoraid/sources/analyzemorphcodes.csv\",index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "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.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
