01_generate_prefixes.pl

This Perl script is used to generate the list of all possible completion strings.

This is the documentation of all downloads.

Move your mouse over the code area and look at its top right corner where a set of icons for downloading, copy-pasting, etc. will appear.


#!/usr/bin/perl
use strict;
use warnings;

use Tree::Prefix;

# =============== parameters ===============

our $limit=10;		# number of suggestions to show

# ======================= initialize =======================

my @species=qw/drome caeel human/;

my $tree=new Tree::Prefix;
$tree->{limit}=$limit;

my $pwd=`pwd`;
chomp $pwd;

print STDERR "$pwd\n";

# ======================= read from file =======================

for my $species (@species) {
	$tree->set_basedir("$pwd/$species");

	print STDERR "loading species: $species\n";
	$tree->load_file_to_hash("$pwd/prefixes_$species.dat");

	$tree->{hash}->cut_tree($limit);
	$tree->hash_tree_2_dir_tree;
}