User:BuchmeierBot/code

Hello, you have come here looking for the meaning of the word User:BuchmeierBot/code. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:BuchmeierBot/code, but we will also tell you about its etymology, its characteristics and you will know how to say User:BuchmeierBot/code in singular and plural. Everything you need to know about the word User:BuchmeierBot/code you have here. The definition of the word User:BuchmeierBot/code will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:BuchmeierBot/code, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

I use a combination of bash and gawk scrips to analyze the page and write the wiki-code and mvs to upload the pages:

Bash code

#!/bin/bash
verb=$1
TEMP=$verb-wiki.txt
TEMPCONJ=$verb-conjugation.txt
ERROUT=$verb-ERRORS.txt
BOTINPUT=$verb-botinput.txt
rm -f $TEMP $TEMPCONJ $ERROUT $BOTINPUT

# exports the page to a text file $TEMP with lynx
lynx -width=1000 -nolist -underscore -dump http://en.wiktionary.orghttps://dictious.com/en/$verb >$TEMP
recode latin1..utf8 $TEMP

# analyse text file $TEMP with gawk
export LC_ALL=C
gawk --assign ERROUT=$ERROUT --assign INF=$verb -f es-conj-verb-readconj.awk $TEMP |sort >$TEMPCONJ

# check for the file $ERROUT, written by previous awk script if the conjugation table contains lines with uexpected number of words (in which case forther execution is stopped) 
if 
then
cat $ERROUT
exit
fi

# write inputfile for pagefromfile.py using gawk
gawk --assign INF=$verb -f es-conj-verb-genpages.awk $TEMPCONJ >>$BOTINPUT

Awk code

es-conj-verb-readconj.awk

The awk script es-conj-verb-readconj.awk looks like this:

BEGIN {section="0"; MOOD=none; errfile=ERROUT; inf=INF;
inflength=length(inf); ending=substr(inf,inflength-1,2);
#if(ending=="ír") ending="ir";
if(index(inf,"ír")>0) ending="ir";
if(!((ending == "ar")||(ending == "er")||(ending == "ir"))) 
{print "unknown or unsupported ending: "ending" of infinitive: "inf>errfile; exit;}
}
 
/\ Spanish/ {section = "S"; next;}
/\ Conjugation/ {if (section == "S") section = "C"; next;}
/\/ {if ((section == "C")||(section=="T")) exit;}

/Defective verb/ {if(section == "C") {
print "unsupported defective verb">errfile; exit;
}}

/Rule/ {next;}
/Irregular in the past participle/ {next;}
 
/infinitive/ {if(section == "C") {
inf2=$2;
if(inf==inf2) section="T";
}}
 
/gerund/ {if(section == "T") {
if(NF != 2) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood=gerund|]}}";
}}
 
/present participle/ {if(section == "T") {
if(NF != 3) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $3"\t{{es-verb form of|ending="ending"|mood=gerund|]}}"; next;
}}
 
/past participle/ {if(section == "T") {
if(NF != 3) {print "unexpected number of words on line:\n"$0>errfile; exit;}
partstem = $3; gsub(/o$/,"",partstem); 
print partstem"o\t{{es-verb form of|ending="ending"|mood=past participle|gender=m|number=s|]}}\t"partstem;
print partstem"a\t{{es-verb form of|ending="ending"|mood=past participle|gender=f|number=s|]}}\t"partstem;
print partstem"os\t{{es-verb form of|ending="ending"|mood=past participle|gender=m|number=p|]}}\t"partstem;
print partstem"as\t{{es-verb form of|ending="ending"|mood=past participle|gender=f|number=p|]}}\t"partstem;
}}
 
/indicative/ {if(section == "T") MOOD="indicative";}
/subjunctive/ {if(section == "T") MOOD="subjunctive";}
/imperative/ {if(section == "T") MOOD="imperative";}
#/conditional/ {if(section == "T") MOOD="conditional";}
 
/present\ / {if(section == "T") {
if(NF != 7) {print "unexpected number of words on line present:\n"$0>errfile; exit;}
TENSE="present"; 
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=plural|]}}";
}}
 
/imperfect/ {if(section == "T") {TENSE="imperfect"; 
if(MOOD=="subjunctive") next;
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=plural|]}}";
}}
 
/\(ra\)/ {if(section == "T") {TENSE="imperfect"; 
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=ra|pers=2|formal=yes|number=plural|]}}";
}}
 
/\(se\)/ {if(section == "T") {TENSE="imperfect"; 
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|sera=se|pers=2|formal=yes|number=plural|]}}";
}}
 
/preterite/ {if(section == "T") {TENSE="preterite";
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=plural|]}}";
}}
 
/future/ {if(section == "T") {TENSE="future";
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=plural|]}}";
}}
 
/conditional/ {if(section == "T") {TENSE="conditional";
if(NF != 7) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=singular|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=1|number=plural|]}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=3|number=plural|]}}";
print $7"\t{{es-verb form of|ending="ending"|mood="MOOD"|tense="TENSE"|pers=2|formal=yes|number=plural|]}}";
}}
 
/affirmative/ {if(section == "T") {
TENSE="affirmative";
if(NF != 6) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $2"\t{{es-verb form of|ending="ending"|mood="MOOD"|sense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|pers=2|formal=yes|number=singular|]}}";
print $4"\t{{es-verb form of|ending="ending"|mood="MOOD"|pers=1|number=plural|]}}";
print $5"\t{{es-verb form of|ending="ending"|mood="MOOD"|sense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
print $6"\t{{es-verb form of|ending="ending"|mood="MOOD"|pers=2|formal=yes|number=plural|]}}";
}}
 
/negative/ {if(section == "T") {
TENSE="negative";
if(NF != 11) {print "unexpected number of words on line:\n"$0>errfile; exit;}
print $3"\t{{es-verb form of|ending="ending"|mood="MOOD"|sense="TENSE"|pers=2|formal=no|number=singular|]}}";
print $9"\t{{es-verb form of|ending="ending"|mood="MOOD"|sense="TENSE"|pers=2|formal=no|number=plural|]|region=Spain}}";
exit;
}}

es-conj-verb-genpages.awk

The awk script es-conj-verb-genpages.awk looks like this:

BEGIN {oldpage="0"; inf=INF; FS="\t";}
{ page=$1;
if(page==oldpage) {print "# "$2; oldpage=page; next}
if(FNR>1) print "{{-stop-}}";
print "{{-start-}}"; print "<<<"$1">>>";
if(NF==2)
print "==Spanish==\n\n===Verb===\n{{es-verb-form|"inf"}}\n";
if(NF==3)
print "==Spanish==\n\n===Verb===\n{{es-pp|"$3"|"inf"}}\n";
print "# "$2;
oldpage=page;
}
END {print "{{-stop-}}";}


The file $BOTINPUT is then uploaded using SemperBlotto's pagefromfile.py, modified for Spanish.