This is first multi-value quirk for text file format, based on
"Plants For a Future" data set: species.txt has numeric comma seprated values
so we just unroll them to get nice facets
Alternative format is pipe (|) separated text files with extension .txt
First column is always header with field names
Multi-line values should be wrapped in ^multi-line-text^
+Multiple values for one field are supported for: number, number
Start with:
}
}
my $item;
- $item->{ $header[$_] || "f_$_" } = [ $v[$_] ] foreach ( 0 .. $#v );
+ foreach my $i ( 0 .. $#v ) {
+ my $v = $v[$i];
+ # unpack numeric values separated by commas
+ my $a = $v =~ m/\d+\s*,\s*\d+/ ? [ split(/\,\s*/,$v) ] : [ $v ];
+ $item->{ $header[$i] || "f_$i" } = $a;
+ }
push @{ $data->{items} }, $item;
}
} else {