Commit 3113fb85 authored by Thomas Huetter's avatar Thomas Huetter
Browse files

bolzano-address-trees: added a script that downloads and prepocessed the bolzano dataset

parent 35527277
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
#!/bin/bash
# file: prepare_data.sh
#
# Program: Downloads and prepares data containing the address trees of Bolzano.
#
# Author: Thomas Huetter

# create target folder and change into it
mkdir bolzano-address-trees
cd bolzano-address-trees

# download the data files
wget https://dbresearch.uni-salzburg.at/projects/pq-gram-ordered-labeled-trees/bolzano-address-trees.zip

# unzip the data into folder bolzano-address-trees
unzip bolzano-address-trees.zip -d original_data

# remove zip file
rm -rf unzip bolzano-address-trees.zip

# change to unzipped folder
cd original_data

# prepare data for file L.trees
#   remove header   |  remove IDs   | sort by number of nodes (equivalent to number of "{")
tail -n +14 L.trees | sed 's/.*://' | awk '{print gsub("{","{"), $0}' | sort -n  | cut -d' ' -f2- > ../L_preprocessed.txt

# prepare data for file R.trees
#     convert file into UTF-8 format   | remove header |  remove IDs   | sort by number of nodes (equivalent to number of "{")
iconv -f ISO-8859-1 -t "UTF-8" R.trees | tail -n +14   | sed 's/.*://' | awk '{print gsub("{","{"), $0}' | sort -n  | cut -d' ' -f2- > ../R_preprocessed.txt

# go back to the folder
cd ..
 No newline at end of file