Biblio...andard(3pm)

πŸ“¦
version 1.10 Β· 2 versions
  • 1.10 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.10 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Biblio::Citation::Parser::Standard πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation β€” it's Biblio...andard(3pm) in the manual, and it's literally all about parsing citations. yes, the academic kind. no cap. let's get into it πŸ¦‹


✨ NAME ✨

Biblio::Citation::Parser::Standard β€” citation parsing functionality πŸ’…


🌸 SYNOPSIS 🌸

use Biblio::Citation::Parser::Standard;
# Parse a simple reference
$parser = new Biblio::Citation::Parser::Standard;
$metadata = $parser->parse("M. Jewell (2004) Citation Parsing for Beginners. Journal of Madeup References 4(3).");
print "The title of this article is ".$metadata->{atitle}."\n";

like, that's it. that's the whole vibe. you feed it a citation and it hands you back the metadata πŸŽ€


πŸ’œ DESCRIPTION πŸ’œ

So Biblio::Citation::Parser::Standard uses a relatively simple template matching technique to pull metadata out of citations. lowkey elegant, highkey useful.

The Templates.pm module currently provides almost 400 templates, with more being added regularly (they're always cooking πŸ‘‘), and the parser returns the metadata in a form that's easily massaged into OpenURLs β€” see the Biblio::OpenURL module if you want an even easier way, bestie 🫢


🧚 METHODS 🧚

πŸ“ $parser = Biblio::Citation::Parser::Standard->new()

The new() method creates a new parser. brand new, fresh out the box ✨

πŸ“ $reliability = Biblio::Citation::Parser::Standard::get_reliability($template)

The get_reliability method returns a value that acts as an indicator of the likelihood of a template matching correctly. Fields like page ranges, URLs, etc, have high likelihoods (because they follow rigorous patterns, periodt), whereas titles, publications, etc have lower likelihoods 😭

It takes a template as a parameter, but fr fr you shouldn't really need to use this method much. it's giving internal machinery.

πŸ“ $concreteness = Biblio::Citation::Parser::Standard::get_concreteness($template)

Same energy as get_reliability() β€” get_concreteness() takes a template as a parameter and returns a numeric indicator. In this case it's the number of non-field characters in the template. The more 'concrete' a template, the higher the probability it'll match well. For example, _PUBLICATION_ Vol. _VOLUME_ is a better match than _PUBLICATION_ _VOLUME_, because _PUBLICATION_ is likely to subsume Vol. in the second case. see? concrete = iconic πŸ’…

πŸ“ $string = Biblio::Citation::Parser::Standard::strip_spaces(@strings)

This is a helper function to remove spaces from all elements of an array. tiny lil guy, does exactly what it says 🌸

πŸ“ $templates = Biblio::Citation::Parser::Standard::get_templates()

Returns the current template list from the Biblio::Citation::Parser::Templates module. Useful for giving status lists πŸ‘‘

πŸ“ @authors = Biblio::Citation::Parser::Standard::handle_authors($string)

This (rather large) function handles the author fields of a reference. It is not all-inclusive yet, but it is usably accurate β€” honest queen πŸ™ˆ

It can handle author lists separated by:

  • semicolons
  • commas
  • a few other delimiters
  • &
  • and
  • 'et al'

The method takes an author string as a parameter and returns an array of extracted information in the format:

'{family => $family, given => $given}'

πŸ“ %metadata = $parser->xtract_metadata($reference)

This is the key method in the Standard module, although it is not actually called directly by users β€” the parse method provides a wrapper, so don't come for it directly bestie 😭

It takes a reference and returns a hashtable representing extracted metadata.

A regular expression map is present in this method to transform _AUFIRST_, _ISSN_, etc, into expressions that should match them. The method then finds the template which best matches the reference, picking the result that has the highest concreteness and reliability (see above), and returns the fields in the hashtable. It also creates the marked-up version, which is useful for further formatting ✨

πŸ“ $metadata = $parser->parse($reference);

This method provides a wrapper to the extract_metadata function. Simply pass a reference string and a metadata hash is returned. easy peasy, no cap πŸŽ€


🌈 NOTES 🌈

The parser provided should not be seen as exhaustive. As new techniques are implemented, further modules will be released. so like, watch this space, more is coming πŸ‘€


πŸ’– AUTHOR πŸ’–

Mike Jewell <moj@ecs.soton.ac.uk>


ok that's the whole page bestie, you're officially a citation parsing girlie now 🫢 go forth and extract metadata

mwah πŸ’‹ this was Biblio...andard(3pm) from perl v5.36.0, dated 2022-11-19 β€” slay, periodt, thanks for reading, ily πŸ’œ