moin Kare,
I've done something like what I think you're suggesting using PDL, but
it amounted in my case to mapping all the text symbols to integer
identifiers (and back) using perl hashes (and arrays), so I could do
something like:
##-- setup symbol table for strings in @STRINGS
$prev = 'NOT_A_SYMBOL';
@id2sym = map {$prev eq $_ ? qw() : ($prev=$_)} @STRINGS;
%sym2id = map {($id2sym[$_]=>$_)} (0..$#id2sym);
##-- encode @STRINGS as a piddle
$sp = pdl(long, @sym2id{@STRINGS});
##-- do something interesting
$which = which($sp==$id2sym{"some symbol"});
... it would be really nice to have a better way to deal with large
symbol tables than perl hashes, but this strategy works for me most of
the time...
marmosets,
Bryan
On 2012-01-20 14:32, Kåre Edvardsen wrote:
> I've been away from programming a couple of years now, but got to get
> back. Are there any news on indexing text arrays in perl/PDL?
>
> Something like:
> which(@txtarr) == "some text";
>
> Cheers,
> Kare
--
Bryan Jurish "There is *always* one more bug."
[email protected] -Lubarsky's Law of Cybernetic Entomology
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl