Text::Corpus::Inspec::Document - Parse Inspec abstract for research.
Text::Corpus::Inspec::Document
use Text::Corpus::Inspec; use Text::Corpus::Inspec::Document; use Data::Dump qw(dump); my $corpus = Text::Corpus::Inspec->new (corpusDirectory => $corpusDirectory); my $document = $corpus->getDocument (index => 0); dump $document->getBody; dump $document->getCategories; dump $document->getContent; dump $document->getTitle; dump $document->getUri;
Text::Corpus::Inspec::Document provides methods for accessing specific portions of Inspec abstracts for researching and testing of information processing methods.
new
The method new creates an instance of the Text::Corpus::Inspec class with the following parameters:
Text::Corpus::Inspec
filename
uri
filename => '...' or uri => '...'
filename or uri must be the path name to the corpus document to be parsed. If the file does not exist, undef is returned. The path provided is returned by getUri.
undef
getBody
getBody ()
getBody returns an array reference of strings of sentences that are the body of the article.
getCategories
getCategories (type => 'all')
The method getCategories returns an array reference of strings that are the categories assigned to the document. The type must be either 'all', 'controlled', or 'uncontrolled', which specify the set of categories to be returned. 'uncontrolled' categories are those assigned to the document by an editor without machine assistance; whereas 'controlled' categories were assigned with machine assistance. The option 'all' returns the union of the categories under 'controlled' and 'uncontrolled'. The default is 'all'.
type
'all'
'controlled'
'uncontrolled'
getContent
getContent ()
getContent returns an array reference of strings of sentences that form the content of the article, the title and body of the article.
getTitle
getTitle ()
getTitle returns an array reference of strings, usually one, of the title of the article.
getUri
getUri ()
getUri returns the URI of the document.
For installation instructions see Text::Corpus::Inspec.
Jeff Kubina<jeff.kubina@gmail.com>
Copyright (c) 2009 Jeff Kubina. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
inspec, english corpus, information processing
File::Slurp, Lingua::EN::Sentence, Text::Corpus::Inspec
To install Text::Corpus::Inspec, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Corpus::Inspec
CPAN shell
perl -MCPAN -e shell install Text::Corpus::Inspec
For more information on module installation, please visit the detailed CPAN module installation guide.