| Summary | Package variables | Synopsis | Description | General documentation | Methods |
| Summary | Top |
| Clair::Polisci::Record - An object representing a hansard record |
| Package variables | Top |
| No package variables defined. |
| Included modules | Top |
| Clair::Cluster |
| Clair::Document |
| Synopsis | Top |
use Clair::Cluster; |
| Description | Top |
| This is a Record object used to represent a generic handard Record. A record is an ordered collection of grafs. This module contains methods to convert a record to cluster of grafs or a document and allows for filtering/projections of grafs based on their properties. |
| Methods | Top |
| add_graf | Description | Code |
| get_grafs | No description | Code |
| new | Description | Code |
| size | Description | Code |
| to_document | Description | Code |
| to_graf_cluster | Description | Code |
| to_string | Description | Code |
| add_graf | code | next | Top |
my $graf = Clair::Polisci::Graf->new( ... ); |
| new | code | prev | next | Top |
my $record = Clair::Polisci::Record->new( |
| size | code | prev | next | Top |
|
| to_document | code | prev | next | Top |
my $doc = $record->to_document(%filter);Returns the content of all grafs satisfying %filter concatenated together and |
| to_graf_cluster | code | prev | next | Top |
my $cluster = $record->to_graf_cluster(%filter);Returns a cluster whose documents are the content of the grafs of this |
| to_string | code | prev | next | Top |
my $string = $record->to_string(%filter);Returns the content of all grafs satisfying %filter concatenated together. See |
| add_graf | description | prev | next | Top |
sub add_graf
{
my $self = shift;
my $graf = shift;
my $grafs_ref = $self->{grafs};
push @$grafs_ref, $graf;
$self->{grafs} = $grafs_ref;} |
| get_grafs | description | prev | next | Top |
sub get_grafs
{
my $self = shift;
my %args = @_;
# Need to check for speaker equality as a special case since it is an} |
| new | description | prev | next | Top |
sub new
{ my $self = shift;
my %args = @_;
die "Record source must be defined" unless defined $args{source};
$args{grafs} = [] unless defined $args{grafs};
$self =\% args;
return bless($self);} |
| size | description | prev | next | Top |
sub size
{ my $self = shift;
return scalar @{$self->{grafs}};} |
| to_document | description | prev | next | Top |
sub to_document
{
my $self = shift;
my %args = @_;
my $doc = Clair::Document->new(
string => $self->to_string(%args),
type => "text"
);
return $doc;} |
| to_graf_cluster | description | prev | next | Top |
sub to_graf_cluster
{
my $self = shift;
my %args = @_;
my @grafs = $self->get_grafs(%args);
my $cluster = Clair::Cluster->new();
foreach my $graf (@grafs) {
$cluster->insert($graf->{index}, $graf->to_document());
}
return $cluster;} |
| to_string | description | prev | next | Top |
sub to_string
{
my $self = shift;
my %args = @_;
my @grafs = $self->get_grafs(%args);
my $string = "";
foreach my $graf (@grafs) {
$string .= $graf->{content};
}
return $string;} |
| get_graf | Top |
my %filter = ( |
| AUTHOR | Top |
| Tony Fader afader@umich.edu |