User:Jimregan: Difference between revisions

From Mediawiki1
Jump to navigationJump to search
m (stick the recipe here so I don't have to rely on shell history)
m (make it a script)
Line 1: Line 1:
<pre>
<pre>
wget http://downloads.dbpedia.org/3.6/ca/infobox_properties_ca.nq.bz2
#!/bin/bash
bzgrep 'http://dbpedia.org/property/wikiPageUsesTemplate' infobox_properties_ca.nq.bz2 |awk '{print $3}'|sort -n| uniq -c|sort -nr > ca-templates
for lang in $@
cat ca-templates |awk '$1>49{print " " $0}'|sed -e 's/<http:\/\/dbpedia.org\/resource\/Template:/[[Mapping_ca:/'|sed -e 's/>/]]/' > ca-mappings
do
    wget http://downloads.dbpedia.org/3.6/${lang}/infobox_properties_${lang}.nq.bz2
    bzgrep 'http://dbpedia.org/property/wikiPageUsesTemplate' infobox_properties_${lang}.nq.bz2 |awk '{print $3}'|sort -n| uniq -c|sort -nr > ${lang}-templates
    cat ${lang}-templates |awk '$1>49{print " " $0}'|sed -e "s/<http:\/\/dbpedia.org\/resource\/Template:/[[Mapping_${lang}:/"|sed -e 's/>/]]/' > ${lang}-mappings
done
</pre>
</pre>


[[User:Jimregan/pl.wikipedia]]
;[[User:Jimregan/pl.wikipedia]]
[[User:Jimregan/ca.wikipedia]]
;[[User:Jimregan/ca.wikipedia]]
;[[User:Jimregan/es.wikipedia]]

Revision as of 14:56, 22 April 2011

#!/bin/bash
for lang in $@
do
    wget http://downloads.dbpedia.org/3.6/${lang}/infobox_properties_${lang}.nq.bz2
    bzgrep 'http://dbpedia.org/property/wikiPageUsesTemplate' infobox_properties_${lang}.nq.bz2 |awk '{print $3}'|sort -n| uniq -c|sort -nr > ${lang}-templates
    cat ${lang}-templates |awk '$1>49{print " " $0}'|sed -e "s/<http:\/\/dbpedia.org\/resource\/Template:/[[Mapping_${lang}:/"|sed -e 's/>/]]/' > ${lang}-mappings
done
User:Jimregan/pl.wikipedia
User:Jimregan/ca.wikipedia
User:Jimregan/es.wikipedia