Alt-CWB-CL-ambs

 view release on metacpan or  search on metacpan

lib/CWB/CL.pm  view on Meta::CPAN

  
  $alg = $french->cpos2alg($cpos);               # returns undef if no alignment was found
  ($src_start, $src_end, $target_start, $target_end) 
      = $french->alg2cpos($alg);                 # returns empty list on error
      # or use convenience function $french->cpos2alg2cpos($cpos);


  # Feature sets (used as values of CWB::CL::Attribute and CWB::CL::AttStruc)
  $np_f = $corpus->attribute("np_feat", 's');    # p- and s-attributes can store feature sets
  $fs_string = $np_f->cpos2str($cpos);           # feature sets are encoded as strings
  $fs = CL::set2hash($fs_string);                # expand feature set into hash (reference)
  if (exists $fs->{"paren"}) { ... {}
  $fs1 = CWB::CL::make_set("|proper|nogen|");    # validate feature set or construct from string
  $fs2 = CWB::CL::make_set("paren nogen proper", 'split');
  $fs  = CWB::CL::set_intersection($fs1, $fs2);  # intersection of feature set values
  $n   = CWB::CL::set_size($fs);                 # size of feature set


=head1 DESCRIPTION

Sorry, there is no full description for this module yet, since the 

t/01_vss.t  view on Meta::CPAN

@flags = $Chapter->cpos2is_boundary("outside", 2000, 1117, 1118, 5000, 7009, 6000);
is_deeply(\@flags, [0, 0, 0, 1, 0, 1], "test whether outside region (cpos2is_boundary)");
@flags = $Chapter->cpos2is_boundary("right", 2000, 1117, 1118, 5000, 7009, 6000);
is_deeply(\@flags, [0, 1, 0, 0, 1, 0], "test for right boundary (cpos2is_boundary)");
@flags = $S->cpos2is_boundary("leftright", 2701, 4000, 4380, 5000, 6250);
is_deeply(\@flags, [0, 0, 1, 0, 1], "test for double boundary (cpos2is_boundary)");

our @align = $Align->cpos2alg(2725, 4242, 7777); # -- sentence alignment (self-alignment of VSS corpus)
is_deeply(\@align, [90, undef, 299], "find alignment beads (cpos2alg)"); # T33
our @beads = $Align->alg2cpos(90, 299);
is_deeply(\@beads, [2723, 2727, 2728, 2732, 7777, 7792, 7760, 7776], "expand alignment beads (alg2cpos)");
@beads = $Align->cpos2alg2cpos(2725, 4242, 7777);
is_deeply(\@beads, [2723, 2727, 2728, 2732, undef, undef, undef, undef, 7777, 7792, 7760, 7776], "expand alignment beads directly (cpos2alg2cpos)");

# total: 35 tests



( run in 0.748 second using v1.01-cache-2.11-cpan-5b529ec07f3 )