semantic-systems / NLIWOD

Collection of tools, utilities, datasets and approaches towards realising natural language interfaces for the Web of Data.
GNU Affero General Public License v3.0
94 stars 32 forks source link

Creating surface forms from redirects #37

Closed RicardoUsbeck closed 6 years ago

RicardoUsbeck commented 7 years ago

My old script does not work anymore, so either we fix that script or make this project run https://github.com/dice-group/SFGeneratorTemp

if [ ! -f "redirect_labels.ttl" ];
then
    sort labels_en.ttl > labels_en.ttl.sorted 
    sort transitive_redirects_en.ttl  > transitive_redirects_en.ttl.sorted
    join -1 1 -2 1 labels_en.ttl.sorted transitive_redirects_en.ttl.sorted  > join.tsv
    cat join.tsv | awk '{sub("<http://www.w3.org/2000/01/rdf-schema#label>","",$0);sub("<http://dbpedia.org/ontology/wikiPageRedirects>","",$0); sub(" .  "," ",$0); print $0}'| awk -F">  \"" '{print "\""$2 }'| awk -F"@en <" '{print $2 " <http://www.w3.org/2000/01/rdf-schema#label> " $1}' | awk '{sub(" . "," ",$0);  print "<"$0 " . " }' > redirect_labels.ttl
fi