Clair::Polisci

Graf


SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods

SummaryTop
Clair::Polisci::Graf - An object representing a hansard graf

Package variablesTop
No package variables defined.

Included modulesTop
Clair::Document

SynopsisTop
    my $speaker = Clair::Polisci::Speaker->new( ... );
my $graf = Clair::Polisci::Graf->new(
source => "polisci_us",
index => 2,
content => "Four score and seven million years ago...",
speaker => $speaker
);

DescriptionTop
This is a Graf object used to represent a generic graf from a hansard. A
graf is the smallest unit of speech in a hansard. An ordered list of
grafs makes up a record. Each graf must have a source, an index, some
content, and a speaker.

MethodsTop
newDescriptionCode
to_documentDescriptionCode

Methods description


newcode    nextTop
     my $graf = Clair::Polisci::Graf->new(
source => "polisci_us",
index => 2,
content => "Four score and seven million years ago...",
speaker => $speaker
);
Constructs a new graf from the given parameters. source, index, content,
and speaker are all required. Additional information can be associated with
this graf by passing it to the constructor as a parameter.

to_documentcodeprevnextTop
    use Clair::Document;
my $doc = $graf->to_document();
Returns the graf as a Clair::Document object. The body of the document is
from the graf's content.

Methods code


newdescriptionprevnextTop
sub new {
    my $self = shift;
    my %args = @_;

    die "Graf source must be defined" unless defined $args{source};
    die "Graf index must be defined" unless defined $args{index};
    die "Graf content must be defined" unless defined $args{content};
    die "Graf speaker must be defined" unless defined $args{speaker};

    $self =\% args;
    return bless($self);
}

to_documentdescriptionprevnextTop
sub to_document {
    
    my $self = shift;

    my $doc = Clair::Document->new(
        string => $self->{content},
        type => "text"
    );

    return $doc;
}

General documentation


AUTHORTop
Tony Fader afader@umich.edu