NAME

Lingua::MAF - Multi-Annotation Framework format writer

VERSION

Version 0.1.1

DESCRIPTION

This module allows to easily produces MAF-format documents. MAF (Morpho-Syntactic Annotation Framework) is a standard proposal developed by ISO TC37SC4 commitee, see http://www.tc37sc4.org for further details.

SYNOPSIS

use Lingua::MAF;

my $maf = Lingua::MAF->new(
    author   => 'me',
    language => 'english',
    format   => {
        reduced  => 1,
        compact  => 1,
    }
);

$maf->add_token(
    id      => 't1',
    content => 'content1',
    pleft   => 0,
    pright  => 6
);
$maf->add_word_form(
    source => 0,
    target => 1,
    tokens => [ 't1' ]
    form   => 'form1',
    entry  => 'entry1',
    tag    => 'tag1'
);
$maf->add_word_form(
    source => 1,
    target => 2,
    tokens => [ 't1' ]
    form   => 'form2',
    entry  => 'entry2',
    tag    => 'tag2'
);
$maf->flush();

Constructor

Lingua::MAF->new(%options)

Creates and returns a new Lingua::MAF object. %options is an hash with the following keys:

author

The author of the document

language

The language of the document

format

The format of this document, as an hashref with the following keys:

tagset

add the full tagset at the beginning of the document

reduced

use reduced fsm format

compact

use compact tag format

standoff

use standoff format

embedded_token

use embedded token format

Other methods

$maf->add_token(%token)

Adds a token to the document. %token is a hash with the following keys:

id
content
pleft
pright

$maf->add_word_form(%word_form)

Adds a word form to the document. %word_form is a hash with the following keys:

source
target
tokens
form
entry
tag
author

$maf->paste_fsm_twig($fsm)

Directly paste an fsm twig extracted from another MAF document.

$maf->start_fsm_twig()

Start a fsm twig directly

$maf->paste_token_twig($token)

Directly paste a token twig extracted from another MAF document.

$maf->paste_transition_twig($token)

Directly paste a transition twig extracted from another MAF document.

$maf->stop_fsm_twig()

Stop current fsm twig.

$maf->flush_fsm()

Merge current word forms and related tokens into a finite state automata, flushed to STDOUT.

$maf->flush_document()

Flush current document to STDOUT.

COPYRIGHT AND LICENSE

Copyright (C) 2005-2006, INRIA.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Guillaume Rousse <grousse@cpan.org>

Eric de la Clergerie, <Eric.De_La_Clergerie@inria.fr>