lgram

A command-line utility for drilling Latin grammar.
git clone git://git.jtobin.io/lgram.git
Log | Files | Refs | README

commit 7ad2b86e33a7888674b8ce8308ebdd55e2f058c2
parent 64bc43426ebf592174053345d868540db5ae81b5
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun,  7 Jan 2024 13:15:30 +0400

Add WIP pronoun drilling.

Diffstat:
Apron | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 182 insertions(+), 0 deletions(-)

diff --git a/pron b/pron @@ -0,0 +1,182 @@ +#!/usr/bin/env bash + +# nb everything after 9th field are optional tags + +DATA=$(cat << EOF +ego,nōm,persōnālia,*I* am a man +tū,nōm,persōnālia,*you* are a man +nōs,nōm,persōnālia,*we* are men +vōs,nōm,persōnālia,*you* are men +mē,acc,persōnālia,you see *me* +tē,acc,persōnālia,I see *you* +sē,acc,persōnālia,I see *him/her/it* +nōs,acc,persōnālia,they see *us* +vōs,acc,persōnālia,they see *you all* +mihi,dat,persōnālia,she gives it *to me* +tibi,dat,persōnālia,she gives it *to you* +sibi,dat,persōnālia,she gives it *to him/her/it* +nōbis,dat,persōnālia,she gives it *to us* +vōbis,dat,persōnālia,she gives it *to you all* +mē,abl,persōnālia,she stands *by me* +tē,abl,persōnālia,you stand *by me* +sē,abl,persōnālia,she stands *by him/her/it* +nōbis,abl,persōnālia,she stands *by us* +vōbis,abl,persōnālia,she stands *by you all* +meus,possessīva,that boy is *mine* +mea,possessīva,that girl is *mine* +meum,possessīva,that thing is *mine* +tuus,possessīva,that boy is *yours* +tua,possessīva,that girl is *yours* +tuum,possessīva,that thing is *yours* +suus,possessīva,that boy is *his/hers/its* +sua,possessīva,that girl is *his/hers/its* +suum,possessīva,that thing is *his/hers/its* +noster,possessīva,that boy is *ours* +nostra,possessīva,that girl is *ours* +nostrum,possessīva,that thing is *ours* +vester,possessīva,that boy is *ye'res* (irishism) +vestra,possessīva,that girl is *ye'res* (irishism) +vestrum,possessīva,that thing is *ye'res* (irishism) +is,nōm,dēmōnstrātīva,masculīnum,singulāris,*that man* is happy +iī,nōm,dēmōnstrātīva,masculīnum,plūrālis,*those men* are happy +ea,nōm,dēmōnstrātīva,fēminīnum,singulāris,*that woman* is happy +eae,nōm,dēmōnstrātīva,fēminīnum,plūrālis,*those women* are happy +id,nōm,dēmōnstrātīva,neutrum,singulāris,*that thing* is blue +ea,nōm,dēmōnstrātīva,neutrum,plūrālis,*those things* are blue +eum,acc,dēmōnstrātīva,masculīnum,singulāris,behold *that man* +eōs,acc,dēmōnstrātīva,masculīnum,plūrālis,behold *those men* +eam,acc,dēmōnstrātīva,fēminīnum,singulāris,behold *that woman* +eās,acc,dēmōnstrātīva,fēminīnum,plūrālis,behold *those women* +id,acc,dēmōnstrātīva,neutrum,singulāris,behold *that thing* +ea,acc,dēmōnstrātīva,neutrum,plūrālis,behold *those things* +eius,gen,dēmōnstrātīva,masculīnum,singulāris,the book of *that man* +eōrum,gen,dēmōnstrātīva,masculīnum,plūrālis,the book of *those men* +eius,gen,dēmōnstrātīva,fēminīnum,singulāris,the book of *that woman* +eārum,gen,dēmōnstrātīva,fēminīnum,plūrālis,the book of *those women* +eius,gen,dēmōnstrātīva,neutrum,singulāris,the book of *that thing* +eōrum,gen,dēmōnstrātīva,neutrum,plūrālis,the book of *those things* +eī,dat,dēmōnstrātīva,masculīnum,singulāris,give the book to *that man* +iīs,dat,dēmōnstrātīva,masculīnum,plūrālis,give the book to *those men* +eī,dat,dēmōnstrātīva,fēminīnum,singulāris,give the book to *that woman* +iīs,dat,dēmōnstrātīva,fēminīnum,plūrālis,give the book to *those women* +eī,dat,dēmōnstrātīva,neutrum,singulāris,give the book to *that thing* +iīs,dat,dēmōnstrātīva,neutrum,plūrālis,give the book to *those things* +eō,abl,dēmōnstrātīva,masculīnum,singulāris,I don't want to talk about *that man* +iīs,abl,dēmōnstrātīva,masculīnum,plūrālis,I don't want to talk about *those men* +eā,abl,dēmōnstrātīva,fēminīnum,singulāris,I don't want to talk about *that woman* +iīs,abl,dēmōnstrātīva,fēminīnum,plūrālis,I don't want to talk about *those women* +eō,abl,dēmōnstrātīva,neutrum,singulāris,I don't want to talk about *that thing* +iīs,abl,dēmōnstrātīva,neutrum,plūrālis,I don't want to talk about *those things* +hic,nōm,dēmōnstrātīva,masculīnum,singulāris,*this man* is happy +hī,nōm,dēmōnstrātīva,masculīnum,plūrālis,*these men* are happy +haec,nōm,dēmōnstrātīva,fēminīnum,singulāris,*this woman* is happy +hae,nōm,dēmōnstrātīva,fēminīnum,plūrālis,*these women* are happy +hoc,nōm,dēmōnstrātīva,neutrum,singulāris,*this thing* is blue +haec,nōm,dēmōnstrātīva,neutrum,plūrālis,*these things* are blue +hunc,acc,dēmōnstrātīva,masculīnum,singulāris,behold *this man* +hōs,acc,dēmōnstrātīva,masculīnum,plūrālis,behold *these men* +hanc,acc,dēmōnstrātīva,fēminīnum,singulāris,behold *this woman* +hās,acc,dēmōnstrātīva,fēminīnum,plūrālis,behold *these women* +hoc,acc,dēmōnstrātīva,neutrum,singulāris,behold *this thing* +haec,acc,dēmōnstrātīva,neutrum,plūrālis,behold *these things* +huius,gen,dēmōnstrātīva,masculīnum,singulāris,the book of *this man* +hōrum,gen,dēmōnstrātīva,masculīnum,plūrālis,the book of *these men* +huius,gen,dēmōnstrātīva,fēminīnum,singulāris,the book of *this woman* +hārum,gen,dēmōnstrātīva,fēminīnum,plūrālis,the book of *these women* +huius,gen,dēmōnstrātīva,neutrum,singulāris,the book of *this thing* +hōrum,gen,dēmōnstrātīva,neutrum,plūrālis,the book of *these things* +huic,dat,dēmōnstrātīva,masculīnum,singulāris,give the book to *this man* +hīs,dat,dēmōnstrātīva,masculīnum,plūrālis,give the book to *these men* +huic,dat,dēmōnstrātīva,fēminīnum,singulāris,give the book to *this woman* +hīs,dat,dēmōnstrātīva,fēminīnum,plūrālis,give the book to *these women* +huic,dat,dēmōnstrātīva,neutrum,singulāris,give the book to *this thing* +hīs,dat,dēmōnstrātīva,neutrum,plūrālis,give the book to *these things* +hōc,abl,dēmōnstrātīva,masculīnum,singulāris,I don't want to talk about *this man* +hīs,abl,dēmōnstrātīva,masculīnum,plūrālis,I don't want to talk about *these men* +hāc,abl,dēmōnstrātīva,fēminīnum,singulāris,I don't want to talk about *this woman* +hīs,abl,dēmōnstrātīva,fēminīnum,plūrālis,I don't want to talk about *these women* +hōc,abl,dēmōnstrātīva,neutrum,singulāris,I don't want to talk about *this thing* +hīs,abl,dēmōnstrātīva,neutrum,plūrālis,I don't want to talk about *these things* +ille,nōm,dēmōnstrātīva,masculīnum,singulāris,*that man* is happy +illī,nōm,dēmōnstrātīva,masculīnum,plūrālis,*those men* are happy +illa,nōm,dēmōnstrātīva,fēminīnum,singulāris,*that woman* is happy +illae,nōm,dēmōnstrātīva,fēminīnum,plūrālis,*those women* are happy +illud,nōm,dēmōnstrātīva,neutrum,singulāris,*that thing* is blue +illa,nōm,dēmōnstrātīva,neutrum,plūrālis,*those things* are blue +illum,acc,dēmōnstrātīva,masculīnum,singulāris,behold *that man* +illōs,acc,dēmōnstrātīva,masculīnum,plūrālis,behold *those men* +illam,acc,dēmōnstrātīva,fēminīnum,singulāris,behold *that woman* +illās,acc,dēmōnstrātīva,fēminīnum,plūrālis,behold *those women* +illud,acc,dēmōnstrātīva,neutrum,singulāris,behold *that thing* +illa,acc,dēmōnstrātīva,neutrum,plūrālis,behold *those things* +illīus,gen,dēmōnstrātīva,masculīnum,singulāris,the book of *that man* +illōrum,gen,dēmōnstrātīva,masculīnum,plūrālis,the book of *those men* +illīus,gen,dēmōnstrātīva,fēminīnum,singulāris,the book of *that woman* +illārum,gen,dēmōnstrātīva,fēminīnum,plūrālis,the book of *those women* +illīus,gen,dēmōnstrātīva,neutrum,singulāris,the book of *that thing* +illōrum,gen,dēmōnstrātīva,neutrum,plūrālis,the book of *those things* +illī,dat,dēmōnstrātīva,masculīnum,singulāris,give the book to *that man* +illīs,dat,dēmōnstrātīva,masculīnum,plūrālis,give the book to *those men* +illī,dat,dēmōnstrātīva,fēminīnum,singulāris,give the book to *that woman* +illīs,dat,dēmōnstrātīva,fēminīnum,plūrālis,give the book to *those women* +illī,dat,dēmōnstrātīva,neutrum,singulāris,give the book to *that thing* +illīs,dat,dēmōnstrātīva,neutrum,plūrālis,give the book to *those things* +illō,abl,dēmōnstrātīva,masculīnum,singulāris,I don't want to talk about *that man* +illīs,abl,dēmōnstrātīva,masculīnum,plūrālis,I don't want to talk about *those men* +illā,abl,dēmōnstrātīva,fēminīnum,singulāris,I don't want to talk about *that woman* +illīs,abl,dēmōnstrātīva,fēminīnum,plūrālis,I don't want to talk about *those women* +illī,abl,dēmōnstrātīva,neutrum,singulāris,I don't want to talk about *that thing* +illīs,abl,dēmōnstrātīva,neutrum,plūrālis,I don't want to talk about *those things* +EOF +) + +prompt() { + read -p '' -n 1 -r <&1 + if [[ $REPLY =~ ^[Qq]$ ]]; then + exit 0 + fi +} + +IFS="|" + +if [[ ! -z "$@" ]]; then + for arg in "$@"; do + echo $arg + DATA=$(grep -E "$arg" <<< "$DATA") + done + + if [[ -z "$DATA" ]]; then + echo "no results" + exit 1 + fi +fi + +LOOP=true + +while $LOOP; do + + clear + + cont=$(shuf -n 1 <<< "$DATA") + + wd=$(cut -f 1 -d, <(echo -n "$cont")) + ty=$(cut -f 2 -d, <(echo -n "$cont")) + ge=$(cut -f 3 -d, <(echo -n "$cont")) + mu=$(cut -f 4 -d, <(echo -n "$cont")) + en=$(cut -f 10 -d, <(echo -n "$cont")) + + echo "$wd ($mu, $ge): $en" + + prompt + + echo "$ty" + echo + echo "nōm: $(cut -f 5 -d, <<< "$cont")" + echo "acc: $(cut -f 6 -d, <<< "$cont")" + echo "gen: $(cut -f 7 -d, <<< "$cont")" + echo "dat: $(cut -f 8 -d, <<< "$cont")" + echo "abl: $(cut -f 9 -d, <<< "$cont")" + + prompt + +done