B
    9+][                 @   s^   d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
 d dlZdd Zdd ZedkrZe  dS )	    )db)SpaVerbEngVerbTranslationTensePersonPronounEnding	ExceptionNc              C   s   t jjdd } | rdS dS )Nterminar)
infinitiveTF)r   query	filter_byfirst)v r   "/var/www/html/conj/appl/db_init.pyinitialized	   s    r   c        %   e   C   s:  t  r
d S td} td}d}d}|t|d|t|di}tj||  tj||  tj  || }|| }d}d}d}	d	}
d
}|dg|dg|	dddg|
ddg|dddgi}i }|||	|
|g}d}xf|D ]^}|drd}t	||d||< tj||  x*|| D ]}tjt
||| d qW qW tj  || }|| }||	 }||
 }|| }tjtdd|j|jd tjtdd|j|jd tjtdd|j|jd tjtdd|j|jd tjtdd |j|jd tjtdd |j|jd tjtdd!|j|jd tjtdd"|j|jd tjtdd"|j|jd tjtdd#|j|jd tjtdd$|j|jd tjtdd%|j|jd tjtdd&|j|jd tjtdd'|j|jd tjtdd'|j|jd tj  tjtdd(|j|jd tjtdd)|j|jd tjtdd)|j|jd tjtdd*|j|jd tjtdd+|j|jd tjtdd+|j|jd tjtdd,|j|jd tjtdd-|j|jd tjtdd-|j|jd tjtdd#|j|jd tjtdd%|j|jd tjtdd%|j|jd tjtdd.|j|jd tjtdd/|j|jd tjtdd/|j|jd tj  d0d1|d |d ifd2d3|d |d ifd4d5d6g|d |d ifd7d8|d |d ifd9d:|d |d ifd;d<d=g|d |d ifd>d?|d |d@d d d d gifdAdBdCg|d |d ifdDdE|d |d ifdFdG|d |d ifdHdI|d |d ifdJdK|d |d ifdLdM|d |d ifdNdO|d |d ifdPdQ|d |d ifdRdS|d |d dTdUdVdWgifdXdY|d |d ifdZd[|d |d ifd\d]|d |d ifd^d_|d |d ifd`da|d |d ifdbdcddg|d |d ifdedf|d |d ifdgdh|d |d ifdidjdkg|d |d ifdldmdng|d |d ifdodp|d |d ifdqdr|d |d ifdsdt|d |d ifdudv|d |d ifdwdx|d |d dydzd{d|gifd}d~|d |dd d d d gifdd|d |d ifdddg|d |d ifdd|d |d ifdddg|d |d ifdddg|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |dd d d d gifddddg|d |d ifdd|d |dd d d d gifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdddg|d |dd d d d gifdddg|d |d ifdddg|d |d ifdddg|d |dd d d d gifdd|d |d ifdd|d |d ifdddg|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|d |d ifdd|dddddg|dddddgifdd|dddddg|dddddgifdd|dddddg|dddddgifdd|ddd ddg|dddddgifdd|dddd dg|dddddgifdd|dddd d g|dddddgifdddg|d	d d d d g|d
ddddgifdddg|dd d d d g|dddddgifdd|dd d d d g|dddddgifd d!|d"d d d d g|d ifd#d$|d%d d d d g|d&d'd(d)d*gifd+d,|d-d d d d g|d.d d/d d gifd0d1|d2d3d4d d5g|d d d6d d7gifd8d9d:g|d;d<d=d d>g|d?d@dAdBdCgifdDdE|dFdGdHd dIg|d ifdJdK|dLdMdNd dOg|dPd d d d gifdQdR|dSdTdUd dVg|d ifdWdX|dYdZd[d d\g|d ifd]d^|d_d`dad dbg|d ifdcdd|dedfdgd dhg|didjdkdldmgifdndo|dpdqdrd dsg|d d dtd dugifdvdwdxg|dydzd{d d|g|d ifd}d~|dddd dg|d ifdd|dddd dg|dddddgifdddg|dddd dg|d ifdd|dddd dg|d ifdddg|dddd dg|dd d d d gifdddg|dd d d d g|d ifdddg|dddd dg|d d dd dgifdd|dddddg|d ddddgifdd|dddd dg|d d dd dgifg\}xn|D ]d\}}}tjtj|k }|sBd  }}| |}|r&|d¡|dá }}t|||dč}tj| t|trT|g}xX|D ]P}tjtj|k } | st|dō} tj|  tjt|| dƍ qZW tj  xl| D ]`\}!}"|"d krؐqxFt|"D ]:\}#}$|$rtjt|$||||#  j||! jdǍ qW qW tj  qW d S (  Nz(\w+)((?:a|e|i)r)$z([\w\s]+) \(.*ZPresentZ	Preterite)nameZ1sZ2sZ3sZ1pZ3pZyou   túu   élZellaZustedZnosotrosZnosotrasZellosZellasZustedesFpT)r   plural)ZpronounZpersonaro)endingZ	newending	person_idtense_idZerZirasesaeZamosZemosZimosZanen   é   íZasteZiste   óu   ióZaronZieronZabrirzto openZaprenderzto learnZarreglarzto fixz
to arrangeZayudarzto helpZbailarzto danceZbajarzto lowerzto get out (of a vehicle)Zbuscarzto look foru   busquéZcambiarz	to changezto exchangeZcaminarzto walkZcantarzto singZcocinarzto cookZcomerzto eatZcomprarzto buyZ	contestarz	to answerZcorrerzto runZcreerz
to believeu   creísteu   creyóu   creímosZcreyeronZdecidirz	to decideZdejarzto leave behindZ	descansarzto restZescribirzto writeZescucharzto listen toZesperarzto wait (for)zto hopeZestudiarzto studyZfirmarzto signZganarzto earnzto winZgastarzto spendzto wasteZgustarzto likeZhablarzto speakZinvitarz	to inviteZlavarzto washZleerzto readu   leísteu   leyóu   leímosZleyeronZllegarz	to arriveu   lleguéZllenarzto fillZllevarzto carryzto wearZlimpiarzto cleanZmandarzto mailzto sendZmanejarzto drivez	to manageZ	necesitarzto needZordenarzto orderZolvidarz	to forgetZpagarzto payu   paguéZpasarzto pass (by)z	to happenzto spend (time)Zplaticarzto chatu	   platiquéZ	preguntarzto askZprepararz
to prepareZ	presentarzto introduceZquitarzto remove (from a surface)Zrecibirz
to receiveZ
recomendarzto recommendZregresarz	to returnZsacarzto take outzto take (a photo)u   saquéZsubirzto go upzto get into (a vehicle)r   z	to finishzto terminateZtocarzto touchzto play (musical instrument)u   toquéZtrabajarzto workZtratarzto tryZusarzto useZvenderzto sellZviajarz	to travelZvisitarzto visitZvivirzto liveZdarzto givedoyZdasdaZdamosZdanZdiZdisteZdioZdimosZdieronZestarzto be (feelings, location)Zestoyu   estásu   estáZestamosu   estánZestuveZ	estuvisteZestuvoZ	estuvimosZ
estuvieronzto goZvoyZvasvaZvamosZvanZfuiZfuisteZfueZfuimosZfueronZserzto be (permanent)ZsoyZeresZsomosZsonZtenerzto haveZtengoZtienesZtieneZtienenZtuveZtuvisteZtuvoZtuvimosZtuvieronZvenirzto comeZvengoZvienesZvieneZvienenZvineZvinisteZvinoZvinimosZvinieronZhacerzto dozto makeZhagoZhiceZhicisteZhizoZhicimosZhicieronZponerzto putzto placeZpongoZpuseZpusisteZpusoZpusimosZpusieronZsaberzto know (something)u   sésupeZsupisteZsupoZsupimosZsupieronZsalirzto leaveZsalgoZtraerzto bringZtraigoZtrajeZtrajisteZtrajoZtrajimosZtrajeronverzto seeZveoviZvioZpedirz
to ask forZpidoZpidesZpideZpidenu   pidióZpidieronZdecirzto sayzto tellZdigoZdicesZdiceZdicenZdijeZdijisteZdijoZdijimosZdijeronZcerrarzto closeZcierroZcierrasZcierraZcierranZempezarzto startZempiezoZempiezasZempiezaZempiezanu   empecéZentenderzto understandZentiendoZ	entiendesZentiendeZ	entiendenZpensarzto think (about)ZpiensoZpiensasZpiensaZpiensanZperderzto loseZpierdoZpierdesZpierdeZpierdenZquererzto wantZquieroZquieresZquiereZquierenZquiseZquisisteZquisoZquisimosZ	quisieronZdormirzto sleepZduermoZduermesZduermeZduermenu   durmióZ	durmieronZ	encontrarzto findzto encounterZ	encuentroZ
encuentrasZ	encuentraZ
encuentranZmoverzto move (something)ZmuevoZmuevesZmueveZmuevenZpoderzto be able toZpuedoZpuedesZpuedeZpuedenZpudeZpudisteZpudoZpudimosZpudieronZprobarzto testzto tasteZprueboZpruebasZpruebaZpruebanZrecordarzto rememberZrecuerdoZ	recuerdanZrecuerdaZjugarzto play (sport or game)zto betZjuegoZjuegasZjuegaZjueganu   juguéZconocerzto knowzto meet (for the first time)ZconozcoZ	conseguirzto getz	to obtainZconsigoZ	consiguesZconsigueZ	consiguenu
   consiguióZconsiguieronZoirzto hearZoigoZoyesZoyeZoimosZoyenu   oísteu   oyóu   oímosZoyeronZseguirz	to followZsigoZsiguesZsigueZsiguenu   siguióZ	siguieron      )r   stemr   )r   )spa_verbZeng_verb)Zconjugationr-   r   r   )r   recompiler   r   sessionaddcommitendswithr   r   r	   idr   r   filterr   r   matchgroup
isinstancestrr   r   items	enumerater
   )%ZVerbREZTransREZPRESENTZ	PRETERITEZTensesZPresentTenseZPreteriteTenseZ	FIRSTSINGZ
SECONDSINGZ	THIRDSINGZ	FIRSTPLURZ	THIRDPLURZPersonPronounsZPersonsZPersonOrderr   r   ZpnZPerson1SZPerson2SZPerson3SZPerson1PZPerson3PZverbsinfZtrnsZtensesr   r,   r   mtr   Ztensewordsidxwr   r   r   db_init   s6   






"










rB   __main__)applr   appl.modelsr   r   r   r   r   r   r	   r
   r.   r   rB   __name__r   r   r   r   <module>   s   (     s