Lingua-FR-Ladl
view release on metacpan or search on metacpan
lib/Lingua/FR/Ladl/Table.pm view on Meta::CPAN
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >La pluie va tomber</TD>
</TR>
<TR>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >ne</TD>
<TD valign="bottom" align="left" >aller Nég</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >sans</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >+</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >-</TD>
<TD valign="bottom" align="left" >Cette mesure n'ira pas sans créer des troubles</TD>
</TR>
</TABLE>
=end HTML
The tables are available as a set of excel spreadsheets from L<http://ladl.univ-mlv.fr/>
This module represents a table as a Ladl::Table object and allows to investigate and query:
=over
=item what verbs belong to the table.
=item what are the headers of the table?
=item which column corresponds to which header.
=item which verb corresponds to which row(s).
=item what is the value of a column in a given row.
=item what is the value in a given row for a given header.
=back
It is also possible to formulate more complex queries using the SQL dialect implemented in SQL::Statement (see L<SQL::Statement>).
=head1 INTERFACE
=head2 Methods
For all following methods, column and row numbering starts at 0.
=over
=item new - build a new Table object
my $table = Lingua::FR::Ladl::Table->new({ name => 'test_table' });
There's one optional initial argument: I<name>, the table's name
=item set/get_name
=item load
$table->load( {format => 'xls', file=>'file_name'} )
$table->load( {format => 'xml', file=>'file_name'} )
Load table data from a file in the given format.
Format may be one of:
=over
=item xls - file is an excel file
in this case Spreadsheet::Parser is used to parse the file.
=item xml - an xml file in gnumeric xml format
the file is parsed using XML::LibXML
=back
The file name is also set to a value inferred from the file name by removing the suffix.
The file name is important because the B<get_verb_column> method relies on the correct file name.
=item get/set_maxCol, get/set_maxRow
get/set maximum row or column value
=item get_headers
Return a hash with the column headers as keys and the corresponding column numbers as values. When there's no header, I<col_>column number is used as key.
=item get_value_at($row, $col)
=item get_col_for_header( $header )
return column number for a given column header, undef if $header doesn't match.
For the table in the example:
$table->get_col_for_header('aux =: avoir')
returns 4
( run in 2.461 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )