UCS - Core library
use UCS;
$UCS::Version; # UCS version
$UCS::Copyright; # UCS copyright string
$UCS::BaseDir; # base directory of UCS system
$UCS::PerlDir; # base directory of UCS/Perl
UCS::Die("Msg line 1", "Msg line 2", ...); # really die (even in Tk loop)
UCS::Warn("Msg line 1", "Msg line 2", ...); # warning message (may be caught by Tk)
UCS::Status("Message"); # display status message in Tk window
UCS::Splash(); # splash screen (may be shown during start-up)
$UCS::Verbose = 0; # suppress warnings
@unique_values = UCS::Unique(@list); # remove duplicates from list
@vars = (@UCS::CoreVars, @UCS::DerivedVars); # standard variable names (core and derived)
@matches = UCS::Match($pattern, @names); # match variable names
$ok = UCS::ValidKey($key); # valid identifier, e.g as AM key
$ok = UCS::ValidName($name); # whether variable name is valid
$type = UCS::VarType($name); # "BOOL", "INT", "DOUBLE", "STRING"
($spec, $key) = UCS::SplitName($name); # split am.*, r.*, or user-defined variable name
@registered_AMs = UCS::AM_Keys(); # keys for built-in AMs (when loaded)
if (UCS::AM($key)) {
$full_name = UCS::AM_Name($key); # long descriptive name
$description = UCS::AM_Description($key); # optional multi-line text
$exp = UCS::AM_Expression($key); # AM equation as compiled UCS expression
$score = $exp->eval({f=>$f, f1=>$f1, ...}); # use UCS::Expression methods to evaluate AM
}
$score = UCS::Eval_AM($key, $arghash); # convenient but slow
UCS::Load_AM_Package("HTest", ...); # load built-in AM packages
$ok = UCS::Register_AM # register new association measure
"tscore", # AM key (-> variables am.tscore and r.tscore)
"t-score measure (Church et. al. 1991)", # long descriptive name
'(%O11% - %E11%) / sqrt(%O11%)', # UCS expression (will be compiled into UCS::Expression)
$multiline_text; # optional multi-line description of AM
This UCS core library maintains a list of bulit-in AMs and Perl subroutines for computing their scores from a candidate's signatures. Utility functions perform syntax checks for field names, determine field types from the naming conventions, and match patterns containing UCS wildcards against field names.
\n
), the next call to UCS::Status will replace the current message; when it ends in a carriage return (\r
), the next call will overwrite the current message from the start. (This is the usual effect of printing such control characters, and will be simulated in Perl/Tk interfaces).BOOL
(Boolean, 0/1), INT
(signed integer), DOUBLE
(double-precision floating-point), and STRING
(string value).am
, r
, b
, f
, n
, or x
. If $name is invalid or the name of a standard variable, (undef, $name) is returned.A-Z a-z 0-9 .
and the wildcards ?
, *
, and %
. ? ... arbitrary character
* ... arbitrary substring without "."
% ... arbitrary string
%
selects all field names, *
selects the names of core and derived fields, am.%
all AM scores, etc. See ucsexp for more examples.This registry maintains a list of association measures, which are automatically available to all UCS/Perl scripts. Association measures are identified by their key, which must be a valid UCS identifier. Association scores for a measure with the key fisher
, for instance, will be stored in the variable am.fisher
, and the corresponding rankings in the variable r.fisher
. A wide range of predefined association measures can be imported from the UCS::AM module and several add-on packages (see the UCS::AM manpage).
\n
), which may need to be removed for automatic justification (e.g. in a Perl/Tk interface). $exp = UCS::AM_Expression($key);
$score = $exp->eval($arghash);
'HTest'
to load the UCS::AM::HTest package. $name is case-insensitive and may be abbreviated to a unique prefix. The special name 'ALL'
(or 'all'
) loads all available add-on packages, while the empty string ''
loads the basic measures from UCS::AM. UCS::Load_AM_Package returns a list containing the full names of all loaded packages (with duplicates removed). If there is no match for $name, an empty list is returned. $ok = UCS::Register_AM "tscore",
"t-score measure (Church et. al. 1991)",
'(%O11% - %E11%) / sqrt(%O11%)',
"The t-score measure applies Student's t-test to ...";
die "Syntax error in UCS expression for t-score measure"
unless $ok;
Type ucsdoc ucsintro
for an introduction to UCS/Perl and an overview of its components (in the MODULES and PROGRAMS sections).
Copyright 2003 Stefan Evert.
This software is provided AS IS and the author makes no warranty as to its use and performance. You may use the software, redistribute and modify it under the same terms as Perl itself.