NAME
Lingua::EN::GivenNames::Database - An SQLite database of derivations of English given names
Synopsis
See "Synopsis" in Lingua::EN::GivenNames for a long synopsis.
See also "How do the scripts and modules interact to produce the data?" in Lingua::EN::GivenNames.
Description
Documents the methods end-users need to access the SQLite database, lingua.en.givennames.sqlite, which ships with this distro.
See "Description" in Lingua::EN::GivenNames for a long description. See also scripts/*.pl.
Distributions
This module is available as a Unix-style distro (*.tgz).
See http://savage.net.au/Perl-modules.html for details.
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing.
Constructor and initialization
new(...) returns an object of type Lingua::EN::GivenNames::Database
.
This is the class's contructor.
Usage: Lingua::EN::GivenNames::Database -> new()
.
This method takes a hash of options.
Call new()
as new(option_1 => value_1, option_2 => value_2, ...)
.
Available options:
- o attributes => $hash_ref
-
This is the hashref of attributes passed to DBI's connect() method.
Default: {AutoCommit => 1, RaiseError => 1, sqlite_unicode => 1}
- o name => $string
-
Used to specify a given name which scripts/report.name.pl uses as a key into the database.
Default: ''.
See "report_name([$name])" below for sample code.
Methods
This module is a sub-class of Lingua::EN::GivenNames and consequently inherits its methods.
attributes($hashref)
Get or set the hashref of attributes passes to DBI's connect() method.
Also, attributes is an option to "new()".
get_name_count()
Returns the result of: 'select count(*) from names'.
get_table_names()
Returns a hashref where the keys are the English singluar versions of the names of the table, and the values are the actual table names.
get_tables()
Returns a hashref whose keys are the table names as returned by sub get_table_names().
The values for these keys are hashrefs of all the data in the corresponding table, as returned by DBIx::Table2Hash's select_hashref() method.
These nested hashrefs are keys by the primary key (integer) of each table.
Consequently, get_tables() returns all data for all tables.
See the source code for sub read_names_table() for how to access such data.
name($string)
Gets and sets the name attribute, as used by scripts/report.name.pl.
Also, name is an option to "new()".
new()
See "Constructor and initialization".
page_counts()
Returns a hashref of the number of web pages dedicated to female and male names:
{
female => 20,
male => 17,
}
Used by Lingua::EN::GivenNames::Database::Download.
read_names_table()
Returns an arrayref of hashrefs of names, sorted by fc_name.
Each element in @$names contains data for 1 record in the database, and has these keys (in alphabetical order):
{
derivation => The derivation,
fc_name => The case-folded name,
form => The form,
id => The primary key of this record,
kind => The kind,
meaning => The meaning,
name => The name,
original => The original (name),
rating => The rating (relability indicator),
sex => The sex,
source => The source (language or name),
}
This is discussed further in "Basic Usage" in Lingua::EN::GivenNames and "FAQ" in Lingua::EN::GivenNames.
report_name([$name])
Here, [] indicate an optional parameter.
Prints the result of searching the names table for a name specified either with the $name parameter, or via the name parameter to "new()".
Sample usage:
perl scripts/report.name.pl -n Zoe
outputs:
derivation Greek name, meaning "life"
fc_name zoe
form name
id 3962
kind Greek
meaning "life"
name Zoe
original -
rating meaning
sex female
source -
report_statistics()
Currently prints these database statistics:
Table Records
derivations 3062
forms 15
kinds 52
meanings 1356
names 3967
originals 2393
ratings 5
sexes 2
sources 56
report_stop_words()
This uses Lingua::EN::StopWordList to report any stop words which happened to be picked up by the regexps used to parse the web page data.
Currently prints this report:
Table 'sources' contains these stop words: of
Table 'forms' contains these stop words: from, name
FAQ
For the database schema, etc, see "FAQ" in Lingua::EN::GivenNames.
References
See "References" in Lingua::EN::GivenNames.
Support
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=Lingua::EN::GivenNames.
Author
Lingua::EN::GivenNames
was written by Ron Savage <ron@savage.net.au> in 2012.
Home page: http://savage.net.au/index.html.
Copyright
Australian copyright (c) 2012 Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html