In v0.5, we introduced the HALG file format for executing Hypercane recipes.
To start, Hypercane needs two bash functions to make HALG more compact: cache_hc and move_output.
Consider the following script, simplified to illustrate a point:
#!/bin/bash
input_type=$1
input_argument=$2
working_directory=$3
output_file=$4
cd ${working_directory}
if [ ! -e identified-mementos.tsv ]; then
hc identify mementos -i $input_type -a $input_argument -o identified-mementos.tsv
fi
if [ ! -e sample-mementos.tsv ]; then
hc sample true-random -k 2000 -i mementos -a identified-mementos.tsv -o sample-mementos.tsv
fi
if [ ! -e image-report.json ]; then
hc report imagedata -i mementos -a identified-mementos.tsv -o image-report.json
fi
if [ ! -e terms.tsv ]; then
hc report terms -i mementos -a identified-mementos.tsv -o terms.tsv
fi
if [ ! -e story.json ]; then
hc synthesize raintale-story -i mementos -a identified-mementos --imagedata image-report.json --term-report terms.tsv -o story.json
fi
cp ${working_directory}/story.json ${output_file}
which could be simplified to something like this:
#!/bin/bash
input_type=$1
input_argument=$2
working_directory=$3
output_file=$4
function cache_hc() { ... }
function move_output() { ... }
cache_hc "identify mementos" "${input_type}=${input_argument}" "694-mementos.tsv"
cache_hc "sample true-random -k 2000" "694-mementos.tsv" "sample-mementos.tsv"
cache_hc "report imagedata" "sample-mementos.tsv" "image-report.json"
cache_hc "report terms --use-sumgrams" "sample-mementos.tsv" "terms.tsv"
cache_hc "synthesize raintale-story --imagedata image-report.json --term-report terms.tsv" "sample-mementos.tsv" "story.json"
move_output "story.json" "${output_file}
and we can even make the cache_hc and move_output functions available as part of the Hypercane installation itself.
This issue is the start of a conversation/documentation of thinking about this idea with the goal of making HALG more applicable as v0.6 development unfolds.
We also need to document HALG. So far, it differs from a regular shell script by offering comments in the following format:
#!/bin/bash
# algorithm name: DSA1
# algorithm description: An implementation of the algorithm from AlNoamany's dissertation.
These comments are used by Hypercane when displaying the possible algorithms. Getting HALG straight is an important step toward the Recipe Builder.
In v0.5, we introduced the HALG file format for executing Hypercane recipes.
To start, Hypercane needs two bash functions to make HALG more compact:
cache_hcandmove_output.Consider the following script, simplified to illustrate a point:
which could be simplified to something like this:
and we can even make the
cache_hcandmove_outputfunctions available as part of the Hypercane installation itself.This issue is the start of a conversation/documentation of thinking about this idea with the goal of making HALG more applicable as v0.6 development unfolds.
We also need to document HALG. So far, it differs from a regular shell script by offering comments in the following format:
These comments are used by Hypercane when displaying the possible algorithms. Getting HALG straight is an important step toward the Recipe Builder.