Using AGLIB (AGAPI) with Tcl AG wrapper


Unix-like systems

The Tcl AG wrapper is installed in a standard tcl package directory unless the --disable-tcl-pkgdir option is used at configuration time. If this option is used, the module is installed in <prefix>/lib/ag/tcl, where <prefix> is the installation prefix, which can be specified with the --prefix option. The default value for <prefix> is /usr/local.

If the Tcl module is not installed in a standard Tcl package directory, or if the Tcl/Tk interpreter (tclsh or wish) has any trouble locating the module, the TCLLIBPATH environment variable can be set to help tclsh or wish find the module. TCLLIBPATH should contain the location of the module.

Here is an example of using AGLIB in an interactive tclsh session:

sh$ export TCLLIBPATH=/home/haepal/pkg/aglib-2.0/lib/ag/tcl
sh$ tclsh8.3
% package require ag
2.0
% set agsetId [AG::CreateAGSet "TIMIT"]
% ...

Here is an example of a Tcl script that uses AGLIB:

#! /usr/local/bin/tclsh8.3

package require ag

set agsetId [AG::CreateAGSet TIMIT]
set timelineId [AG::CreateTimeline $agsetId]
set agId [AG::CreateAG $agsetId $timelineId]
set a1 [AG::CreateAnchor $agId]
AG::SetAnchorOffset $a1 1.0
set a2 [AG::CreateAnchor $agId]
AG::SetAnchorOffset $a2 2.0
set ann [AG::CreateAnnotation $agId $a1 $a2 word]
AG::SetFeature $ann label cat
puts [AG::toXML $agsetId]

NOTE: Please don't forget to set LD_LIBRARY_PATH properly for the required shared libraries (libag and plugins). See Post-installation for details.


Annotation Graph Toolkit