##========================================================================
## POD DOCUMENTATION, auto-generated by podextract.perl

##========================================================================
## NAME
=pod

=head1 NAME

DiaColloDB::methods::compile - compile-time methods for DiaColloDB

=cut

##========================================================================
## SYNOPSIS
=pod

=head1 SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 
 use DiaColloDB;
 $coldb = DiaColloDB->new(%args);
 
 ##========================================================================
 ## create: utils
 
 $multimap = $coldb->create_multimap($base, \%ts2i, $packfmt, $label="multimap");
 \@attrs = $coldb->attrs();
 $atitle = $CLASS_OR_OBJECT->attrTitle($attr_or_alias);
 $acbexpr = $CLASS_OR_OBJECT->attrCountBy($attr_or_alias,$matchid=0);
 $aquery_or_filter_or_undef = $CLASS_OR_OBJECT->attrQuery($attr_or_alias,$cquery);
 \@attrdata = $coldb->attrData();
 $bool = $coldb->hasAttr($attr);
 
 ##========================================================================
 ## create: from corpus
 
 $bool = $coldb->create($corpus,%opts);
 
 ##========================================================================
 ## create: union (aka merge)
 
 $coldb = $CLASS_OR_OBJECT->union(\@coldbs_or_dbdirs,%opts);
 

=cut

##========================================================================
## DESCRIPTION
=pod

=head1 DESCRIPTION

The C<DiaColloDB::methods::compile> module adds compile-time
methods for the top-level L<DiaColloDB|DiaColloDB> package,
which see for more details.

Prior to v2.12.012, the methods defined by this module
were defined directly in the top-level C<DiaColloDB> package.

=cut

##----------------------------------------------------------------
## DESCRIPTION: DiaColloDB: create: utils
=pod

=head2 create: utils

=over 4

=item Variables: (%ATTR_ALIAS,%ATTR_RALIAS,%ATTR_TITLE,%ATTR_CBEXPR);

Global attribute alias hacks.

 %ATTR_ALIAS  = ($name_or_alias=>$name, ...)
 %ATTR_RALIAS = ($name=>\@aliases, ...)
 %ATTR_CBEXPR = ($name=>$ddcCountByExpr, ...)
 %ATTR_TITLE  = ($name_or_alias=>$title, ...)

=item create_multimap

 $multimap = $coldb->create_multimap($base, \%ts2i, $packfmt, $label="multimap");

Create an expansion multimap, used by L<create()|/create>.

=item attrs

 \@attrs = $coldb->attrs();
 \@attrs = $coldb->attrs($attrs=$coldb-E<gt>{attrs}, $default=[]);

parse attributes in $attrs as array.

=item attrName

 $aname = $CLASS_OR_OBJECT->attrName($attr)

Returns canonical (short) attribute name for $attr.
Supports aliases in %ATTR_ALIAS = ($alias=>$name, ...).

=item attrTitle

 $atitle = $CLASS_OR_OBJECT->attrTitle($attr_or_alias);

Returns an attribute title for $attr_or_alias

=item attrCountBy

 $acbexpr = $CLASS_OR_OBJECT->attrCountBy($attr_or_alias,$matchid=0);

Returns a DDC::XS:CQCountKeyExpr object for $attr_or_alias with match-id $matchid.

=item attrQuery

 $aquery_or_filter_or_undef = $CLASS_OR_OBJECT->attrQuery($attr_or_alias,$cquery);

returns a DDC::XS::CQuery or DDC::XS::CQFilter object for condition $cquery on $attr_or_alias.

=item attrData

 \@attrdata = $coldb->attrData();
 \@attrdata = $coldb->attrData(\@attrs=$coldb->attrs)

get attribute data for \@attrs;
returns @attrdata = ({a=E<gt>$a, i=E<gt>$i, enum=E<gt>$aenum, pack_x=E<gt>$pack_xa, a2x=E<gt>$a2x, ...})

=item hasAttr

 $bool = $coldb->hasAttr($attr);

Returns true iff $coldb natively supports the attribute (or alias) $attr.

=back

=cut

##----------------------------------------------------------------
## DESCRIPTION: DiaColloDB: create: from corpus
=pod

=head2 create: from corpus

=over 4

=item create

 $coldb = $CLASS->create($corpus,%opts);
 $coldb = $coldb->create($corpus,%opts);

Create and return a new L<DiaColloDB|DiaColloDB> database object $coldb from a
L<DiaColloDB::Corpus|DiaColloDB::Corpus> object C<$corpus>.
%opts overrides %$coldb properties.

If C<$corpus> is a pre-compiled and pre-filtered
L<DiaColloDB::Corpus::Compiled|DiaColloDB::Corpus::Compiled> object,
only the L<corpus content filters|DiaColloDB::Corpus::Filters> pre-compiled
into C<$corpus> itself are used.  Otherwise, a temporary
L<DiaColloDB::Corpus::Compiled|DiaColloDB::Corpus::Compiled> object
will be created for C<$corpus>, and the L<DiaColloDB::Corpus::Filters|DiaColloDB::Corpus::Filters>
keys of C<$coldb> itself will be used as content filters.

Honors the $coldb properties C<index_tdf>, C<index_xf>, and C<index_cof>
to determine which underlying C<DiaColloDB::Relation|DiaColloDB::Relation>s are
included in the output database.

Applies frequency-cutoffs C<tfmin>, C<cfmin>, etc. after parsing (filtered)
corpus data.

Honors C<$DiaColloDB::NJOBS|DiaColloDB::Utils::nJobs> for partial parallelization
of selected sub-tasks.

Currently does B<not> support appending new data to an existing
DiaColloDB index.


=back

=cut

##----------------------------------------------------------------
## DESCRIPTION: DiaColloDB: create: union (aka merge)
=pod

=head2 create: union (aka merge)

=over 4

=item union

 $coldb = $CLASS->union(\@coldbs_or_dbdirs,%opts);
 $coldb = $coldb->union(\@coldbs_or_dbdirs,%opts);

Populates $coldb as a union over @coldbs_or_dbdirs.
Clobbers argument DB keys {_union_${a}i2u}, {_union_xi2u}, {_union_argi}
for administrative purposes.

Often faster than using the L<create()|/create> method on the original
source corpora, since corpus document file(s) do not need to be re-parsed
for C<union()> operations.

=back

=cut


##======================================================================
## Footer
##======================================================================
=pod

=head1 AUTHOR

Bryan Jurish E<lt>moocow@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2015-2020 by Bryan Jurish

This package is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.2 or,
at your option, any later version of Perl 5 you may have available.

=head1 SEE ALSO

L<DiaColloDB(3pm)|DiaColloDB>,
...

=cut
