| 1 | package Biblio::Citation::Parser::Citebase; | ||
| 2 | |||
| 3 | ###################################################################### | ||
| 4 | # | ||
| 5 | # Biblio::Citation::Parser::CiteBase; | ||
| 6 | # | ||
| 7 | ###################################################################### | ||
| 8 | # | ||
| 9 | # This file is part of ParaCite Tools (http://paracite.eprints.org/developers/) | ||
| 10 | # | ||
| 11 | # Copyright (c) 2004 University of Southampton, UK. SO17 1BJ. | ||
| 12 | # | ||
| 13 | # ParaTools is free software; you can redistribute it and/or modify | ||
| 14 | # it under the terms of the GNU General Public License as published by | ||
| 15 | # the Free Software Foundation; either version 2 of the License, or | ||
| 16 | # (at your option) any later version. | ||
| 17 | # | ||
| 18 | # ParaTools is distributed in the hope that it will be useful, | ||
| 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 21 | # GNU General Public License for more details. | ||
| 22 | # | ||
| 23 | # You should have received a copy of the GNU General Public License | ||
| 24 | # along with ParaTools; if not, write to the Free Software | ||
| 25 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 26 | # | ||
| 27 | ###################################################################### | ||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Biblio::Citation::Parser::Citebase - Citebase's citation parsing module | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | This module is an updated (and hopefully improved) version of Zhuoan Jiao's citation-parsing modules. | ||
| 38 | |||
| 39 | =head1 SYNOPSIS | ||
| 40 | |||
| 41 | use Biblio::Citation::Parser::Citebase; | ||
| 42 | $parser = new Biblio::Citation::Parser::Citebase([$source_identifier]); | ||
| 43 | $metadata = $parser->parse($citation); | ||
| 44 | print "Author: ", $metadata->{aufirst}, " ", $metadata->{aulast}, "\n"; | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | use strict; | ||
| 49 | use utf8; | ||
| 50 | use Time::localtime; # optional, used by OpCit project. | ||
| 51 | use vars qw(@ISA @EXPORT @EXPORT_OK); | ||
| 52 | use Biblio::Citation::Parser::Jiao::Utility qw(normalisation normalise_html); | ||
| 53 | use Text::Unidecode; # Used so we can just use a-z to match lowercase letters | ||
| 54 | |||
| 55 | use Exporter; | ||
| 56 | @ISA = qw(Exporter); | ||
| 57 | |||
| 58 | @EXPORT = qw(); | ||
| 59 | @EXPORT_OK = qw(&normalise_name &normalise_date | ||
| 60 | &num_of_figures &print_out); | ||
| 61 | #@EXPORT_OK = qw(&normalise_name &normalisation &normalise_date | ||
| 62 | # &normalise_html &num_of_figures &print_out); | ||
| 63 | |||
| 64 | =pod | ||
| 65 | |||
| 66 | =item $p = new Biblio::Citation::Parser::Citebase([$citation],[$source_identifier]); | ||
| 67 | |||
| 68 | Create a new citation parser, optionally parsing $citation with $source_identifier. If a citation is given the return blessed hash will contain the structured data. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | sub new { | ||
| 73 | my ($class,$citation,$sidentifier) = @_; | ||
| 74 | $class = ref $class ? $class->{'_class'} : $class; # I'm sure there's a better way of doing this | ||
| 75 | my $self; | ||
| 76 | if( $citation ) { | ||
| 77 | my %args = ( | ||
| 78 | _class=>$class, | ||
| 79 | sourceID=>$sidentifier, | ||
| 80 | text=>$citation, | ||
| 81 | rest_text=>$citation, | ||
| 82 | ); | ||
| 83 | @args{qw( | ||
| 84 | aufull aulast aufirst auinit authors atitle | ||
| 85 | title volume issue supl spage year targetURL | ||
| 86 | rest_text date targetID featureID | ||
| 87 | jnl_spos jnl_epos num_of_fig | ||
| 88 | )} = (); | ||
| 89 | $self = bless \%args, $class; | ||
| 90 | $self->find_metadata(); | ||
| 91 | $self->find_featureID(); | ||
| 92 | |||
| 93 | # OpenURL mapping | ||
| 94 | $self->{'id'} = $self->{'targetID'}; | ||
| 95 | $self->{'pages'} = $self->{'spage'}; | ||
| 96 | } else { | ||
| 97 | $self = bless {_class=>$class}, $class; | ||
| 98 | } | ||
| 99 | return $self; | ||
| 100 | } | ||
| 101 | |||
| 102 | =pod | ||
| 103 | |||
| 104 | =item $md = $p->parse($citation, [$source_identifier]); | ||
| 105 | |||
| 106 | Parses a string, $citation, and returns a blessed hash of the structured data. | ||
| 107 | |||
| 108 | =cut | ||
| 109 | |||
| 110 | # This is a very nasty hack to allow this method | ||
| 111 | sub parse { new(@_) } | ||
| 112 | |||
| 113 | sub initialize { | ||
| 114 | my $cite = shift; | ||
| 115 | my $text = shift || die "Requires citation text to parse"; | ||
| 116 | my $sidentifier = shift; | ||
| 117 | |||
| 118 | $cite->{'text'} = $text; | ||
| 119 | $cite->{'aufull'} = undef; | ||
| 120 | $cite->{'aulast'} = undef; | ||
| 121 | $cite->{'aufirst'}= undef; | ||
| 122 | $cite->{'auinit'} = undef; | ||
| 123 | $cite->{'authors'}= undef; | ||
| 124 | $cite->{'atitle'} = undef; | ||
| 125 | $cite->{'title'} = undef; | ||
| 126 | $cite->{'volume'} = undef; | ||
| 127 | $cite->{'issue'} = undef; | ||
| 128 | $cite->{'supl'} = undef; | ||
| 129 | $cite->{'spage'} = undef; | ||
| 130 | $cite->{'year'} = undef; | ||
| 131 | $cite->{'targetURL'} = undef; | ||
| 132 | |||
| 133 | $cite->{'rest_text'} = $text; | ||
| 134 | $cite->{'date'} = undef; | ||
| 135 | $cite->{'sourceID'} = $sidentifier; | ||
| 136 | $cite->{'targetID'} = undef; | ||
| 137 | $cite->{'featureID'} = undef; | ||
| 138 | $cite->{'jnl_spos'} = undef; | ||
| 139 | $cite->{'jnl_epos'} = undef; | ||
| 140 | $cite->{'num_of_fig'}= undef; | ||
| 141 | |||
| 142 | $cite->find_metadata(); | ||
| 143 | $cite->find_featureID(); | ||
| 144 | |||
| 145 | # OpenURL mapping | ||
| 146 | $cite->{'id'} = $cite->{'targetID'}; | ||
| 147 | $cite->{'pages'} = $cite->{'spage'}; | ||
| 148 | } | ||
| 149 | |||
| 150 | # | ||
| 151 | # Actions | ||
| 152 | # | ||
| 153 | sub pre_process { | ||
| 154 | my $cite = shift; | ||
| 155 | my $Text = shift || $cite->{'text'}; | ||
| 156 | |||
| 157 | $Text = normalisation($Text); | ||
| 158 | $Text = normalise_date($Text); | ||
| 159 | $Text = normalise_html($Text); | ||
| 160 | # remove front label to get accurate $nFig | ||
| 161 | # (Note: do not perform this for arXiv ref. like: "46(4), 90 (1993)") | ||
| 162 | # [Smith, 1998], [1], (1), (1a) ... | ||
| 163 | $Text =~ s/^\s*[\[(]\s* # bracket | ||
| 164 | ([^\])]+?)\s* # content | ||
| 165 | [\])]\s*//x; # bracket | ||
| 166 | |||
| 167 | # "1. Gary Smith, ...." | ||
| 168 | $Text =~ s/^\d+\s*\.\s+//; | ||
| 169 | # "1 Gary Smith, ...." | ||
| 170 | $Text =~ s/^\s*\d+ ([A-Z])/$1/; | ||
| 171 | # "2) Brand, P. ..." | ||
| 172 | $Text =~ s/^[\[\(]?\s*\w+\s*[\])]\s*//; | ||
| 173 | |||
| 174 | $cite->{'rest_text'} = $Text; | ||
| 175 | |||
| 176 | my $nFig = num_of_figures($Text); | ||
| 177 | $cite->{'num_of_fig'} = $nFig; | ||
| 178 | |||
| 179 | return $Text; | ||
| 180 | } | ||
| 181 | |||
| 182 | sub find_metadata { | ||
| 183 | my $cite = shift; | ||
| 184 | |||
| 185 | return 0 if (!defined($cite->{'text'})); | ||
| 186 | |||
| 187 | my $Text = $cite->pre_process($cite->{'text'}); | ||
| 188 | |||
| 189 | $cite->{'targetID'} = $cite->complete_targetID($cite->find_targetID($cite->{'text'})); | ||
| 190 | |||
| 191 | # find URL | ||
| 192 | $cite->find_url(); | ||
| 193 | |||
| 194 | my $nFig = $cite->{'num_of_fig'}; | ||
| 195 | |||
| 196 | # find the authors | ||
| 197 | if ($cite->find_authors()) { | ||
| 198 | $cite->find_first_author() | ||
| 199 | }; | ||
| 200 | |||
| 201 | # find article titile | ||
| 202 | $cite->find_atitle(); | ||
| 203 | |||
| 204 | # only process references to 'journal' articles. | ||
| 205 | return 0 if ($nFig == 0) ; # no number, ignore. | ||
| 206 | return 0 if ($nFig >= 8); # too many numbers, maybe an error, ignore. | ||
| 207 | # return 0 if ($cite->{'rest_text'} =~ /\W(proc.|proceedings) of /i); | ||
| 208 | |||
| 209 | # extract 'supplement' first before find_vol_no_pg_year() | ||
| 210 | $cite->find_supplement(); | ||
| 211 | |||
| 212 | if ($cite->find_vol_no_pg_year() or | ||
| 213 | $cite->find_vol_pg_year()) { | ||
| 214 | |||
| 215 | $cite->find_jnl_name(); | ||
| 216 | return 1 | ||
| 217 | }; | ||
| 218 | |||
| 219 | if ($cite->guess_vol_no_pg()) { | ||
| 220 | $cite->find_jnl_name(); | ||
| 221 | return 1; | ||
| 222 | }; | ||
| 223 | |||
| 224 | if ($cite->find_vol_no() or | ||
| 225 | $cite->find_vol_supl()) { | ||
| 226 | |||
| 227 | $cite->find_jnl_name(); | ||
| 228 | $cite->find_page(); | ||
| 229 | $cite->find_year(); | ||
| 230 | |||
| 231 | return 1; | ||
| 232 | }; | ||
| 233 | |||
| 234 | if ($cite->guess_vol_pg()) { | ||
| 235 | $cite->find_year(); | ||
| 236 | $cite->find_jnl_name(); | ||
| 237 | |||
| 238 | return 1; | ||
| 239 | }; | ||
| 240 | |||
| 241 | if ($cite->guess_vol_year()) { | ||
| 242 | |||
| 243 | $cite->find_page(); | ||
| 244 | $cite->find_jnl_name(); | ||
| 245 | |||
| 246 | return 1; | ||
| 247 | }; | ||
| 248 | |||
| 249 | |||
| 250 | my $Count = 0; | ||
| 251 | $Count++ if ($cite->find_year()); | ||
| 252 | $Count++ if ($cite->find_vol()); | ||
| 253 | $Count++ if ($cite->find_issue()); | ||
| 254 | $Count++ if ($cite->find_supplement()); | ||
| 255 | $Count++ if ($cite->find_jnl_name()); | ||
| 256 | $Count++ if ($cite->find_page()); | ||
| 257 | |||
| 258 | return 1 if ($Count >=2 ); | ||
| 259 | |||
| 260 | # Last-ditch get any three numbers | ||
| 261 | $cite->three_figs if $nFig <= 4; | ||
| 262 | |||
| 263 | # too few metadata | ||
| 264 | return 0 | ||
| 265 | } | ||
| 266 | |||
| 267 | sub three_figs { | ||
| 268 | my $self = shift; | ||
| 269 | my $Text = $self->{'text'}; | ||
| 270 | |||
| 271 | # Remove the year | ||
| 272 | return unless $Text =~ s/\(((?:19|20)\d{2})\)//; | ||
| 273 | $self->{year} = $1; | ||
| 274 | |||
| 275 | return unless $self->{year} or $Text =~ s/((?:19|20)\d{2})//; | ||
| 276 | $self->{year} = $1; | ||
| 277 | |||
| 278 | return unless $Text =~ s/(\d+)\s*-\s*[a-z]{0,2}(\d+)//i; | ||
| 279 | $self->{spage} = $1; | ||
| 280 | $self->{epage} = $2; | ||
| 281 | |||
| 282 | return unless $` =~ /(\d+)\D+/; | ||
| 283 | $self->{volume} = $1; | ||
| 284 | |||
| 285 | return 1; | ||
| 286 | } | ||
| 287 | |||
| 288 | my @arXiv = qw(astro-ph cond-mat gr-qc hep-ex hep-lat hep-ph hep-th | ||
| 289 | math-ph nucl-ex nucl-th physics quant-ph | ||
| 290 | adap-org alg-geom chao-dyn chem-ph cmp-lg | ||
| 291 | comp-gas cs dg-ga funct-an math mtrl-th | ||
| 292 | neuro-cel neuro-dev neuro-sys nlin nlin-sys | ||
| 293 | patt-sol plasm-ph q-alg solv-int supr-con | ||
| 294 | math.AG math.AT math.AP math.CT math.CA math.CO math.CV | ||
| 295 | math.DG math.DS math.FA math.GM math.GN math.GT | ||
| 296 | math.GR math.HO math.KT math.LA math.LO math.MP | ||
| 297 | math.MG math.NT math.NA math.OA math.OC math.PR math.QA | ||
| 298 | math.RT math.RA math.SC math.SP math.SG); | ||
| 299 | my %subarXiv; | ||
| 300 | my $subarXivre = ''; | ||
| 301 | foreach my $sa (@arXiv) { | ||
| 302 | my $re = $sa; | ||
| 303 | $re =~ s/(\W)/$1?/g; | ||
| 304 | $subarXivre .= "(?:$re)|"; | ||
| 305 | $re =~ s/\W//g; | ||
| 306 | $sa =~ s/^math(\.\w\w)/math/i; # Fix to make maths identifiers match | ||
| 307 | $subarXiv{$re} = $sa; | ||
| 308 | } | ||
| 309 | chop($subarXivre); | ||
| 310 | $subarXivre = "($subarXivre)\\s*.\\s*(\\d{7})"; | ||
| 311 | |||
| 312 | sub complete_targetID { | ||
| 313 | my $self = shift; | ||
| 314 | my $tid = shift || return; | ||
| 315 | |||
| 316 | return $tid if $tid =~ /^oai:/; | ||
| 317 | |||
| 318 | my $sid = $self->{'sourceID'}; | ||
| 319 | if( !defined($sid) && $tid =~ /^$subarXivre.*$/oi ) { | ||
| 320 | my ($sa,$no) = ($1,$2); | ||
| 321 | $sa =~ s/\W//g; | ||
| 322 | return "oai:arXiv.org:".$subarXiv{$sa}."/".$no; | ||
| 323 | } | ||
| 324 | if( !$sid ) { | ||
| 325 | warn "Warning: Unable to expand \"$tid\" as no sourceID given"; | ||
| 326 | return; | ||
| 327 | } | ||
| 328 | return unless ($sid =~ /oai\:([^\:]+)\:([^\:\/]+)/); | ||
| 329 | my ($axv, $subaxv) = ($1,$2); | ||
| 330 | |||
| 331 | $tid =~ s/.(\d{7})/\/$1/; | ||
| 332 | if( $tid =~ /^[a-zA-Z]{2}/ && $tid =~ /^$subarXivre.*$/oi ) { | ||
| 333 | my ($sa,$no) = ($1,$2); | ||
| 334 | $sa =~ s/\W//g; | ||
| 335 | return "oai:$axv:".$subarXiv{$sa}."/".$no; # normalise subarXiv component | ||
| 336 | } | ||
| 337 | if( $tid =~ /^\d/ ) { | ||
| 338 | return "oai:$axv:$subaxv\/$tid"; | ||
| 339 | } | ||
| 340 | return; | ||
| 341 | } | ||
| 342 | |||
| 343 | # Copied (mostly) from Parser::arXivCite | ||
| 344 | sub find_targetID { | ||
| 345 | my ($self,$cite) = @_; | ||
| 346 | |||
| 347 | # remove multiple spacing/tabs etc. | ||
| 348 | $cite =~ s/\s+/ /sg; | ||
| 349 | # remove space around '.' (math. DG => math.DB) | ||
| 350 | $cite =~ s/\s*\.\s*/\./sg; | ||
| 351 | |||
| 352 | # e.g. cond-mat/9910162 | ||
| 353 | if( $cite =~ /\b((?:\w+-\w+).\d{7})(?:v\d+)?\b/ && $1 =~ /($subarXivre)/oi ) { | ||
| 354 | return $1; | ||
| 355 | } | ||
| 356 | |||
| 357 | # e.g. math.GB/9912001 | ||
| 358 | if( $cite =~ /\b((?:\w+\.\w+).\d{7})(?:v\d+)?\b/ && $1 =~ /($subarXivre)/oi ) { | ||
| 359 | return $1; | ||
| 360 | } | ||
| 361 | |||
| 362 | # e.g. math/AG0206084, see oai:arXiv.org:math/0301128 | ||
| 363 | if( $cite =~ /\b((?:\w+\/\w\w)\d{7})(?:v\d+)?\b/ ) { | ||
| 364 | my $id = $1; | ||
| 365 | $id =~ s/(\w+)\/(\D+)/$1.$2\//; | ||
| 366 | if( $id =~ /($subarXivre)/oi ) { | ||
| 367 | return $1; | ||
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | # e.g. physics/9912001 | ||
| 372 | if( $cite =~ /\b((?:\w+).\d{7})(?:v\d+)?\b/ && $1 =~ /($subarXivre)/oi ) { | ||
| 373 | return $1; | ||
| 374 | } | ||
| 375 | |||
| 376 | # e.g. 9912001 | ||
| 377 | if( $cite =~ /\b(\d{2})([01][0-9])(\d{3})\b/ ) { | ||
| 378 | my ($year, $month, $i) = ($1,$2,$3); | ||
| 379 | if( $year < 91 ) { | ||
| 380 | $year += 2000; | ||
| 381 | } else { | ||
| 382 | $year += 1900; | ||
| 383 | } | ||
| 384 | my $cyear = localtime->year() + 1900; | ||
| 385 | if( $month >= 1 && $month <= 12 && $year <= $cyear ) { | ||
| 386 | return $1.$2.$3; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | |||
| 390 | return; | ||
| 391 | } | ||
| 392 | |||
| 393 | sub find_atitle { | ||
| 394 | my $cite = shift; | ||
| 395 | my $Text = $cite->{'rest_text'}; | ||
| 396 | |||
| 397 | # title is quoted. | ||
| 398 | # return 0 if ($Text !~ /(['"])/); # | ||
| 399 | # my $Qt = $1; | ||
| 400 | # ignore ' case, because author nams may contain ', e.g. | ||
| 401 | # A. I. L'vov, V. A. Petrun'kin, and M. Schumacher, | ||
| 402 | # Phys. Rev. C 55, 359 (1997) | ||
| 403 | return 0 if ($Text !~ /"/); | ||
| 404 | |||
| 405 | if ($Text =~ /"(.+?)"\s*\.?/ and | ||
| 406 | word_count($1) >= 2) { | ||
| 407 | my $Guess_title = $1; | ||
| 408 | return 0 if ($Guess_title =~ /^http:/i); | ||
| 409 | |||
| 410 | $cite->{'atitle'} = $Guess_title; | ||
| 411 | # use ';' ! | ||
| 412 | # $Text =~ s/$Qt(.+?)$Qt\s*\.?/;/o; | ||
| 413 | # $Text =~ s/"[^"]+"\s*\.?/;/; | ||
| 414 | $Text =~ s/"[^"]+"/" "/; | ||
| 415 | # $Text =~ s/[,;.]\s*[,;.]/,/g; # doesn't work | ||
| 416 | while ($Text =~ /[,;.]\s*[,;.]/g) { | ||
| 417 | $Text =~ s/[,;.]\s*[,;.]/,/ | ||
| 418 | }; | ||
| 419 | $Text =~ s/^[;" ]+//; | ||
| 420 | $cite->{'rest_text'} = $Text; | ||
| 421 | return 1 | ||
| 422 | }; | ||
| 423 | |||
| 424 | return 0 | ||
| 425 | } | ||
| 426 | |||
| 427 | # for the OpCit Project . | ||
| 428 | sub find_featureID { | ||
| 429 | my $cite = shift; | ||
| 430 | |||
| 431 | my $featureID = ''; | ||
| 432 | $featureID .= "v$cite->{'volume'}" if ($cite->{'volume'}); | ||
| 433 | $featureID .= ":n$cite->{'issue'}" if ($cite->{'issue'}); | ||
| 434 | $featureID .= ":s$cite->{'supl'}" if ($cite->{'supl'}); | ||
| 435 | $featureID .= ":p$cite->{'spage'}" if ($cite->{'spage'}); | ||
| 436 | $featureID .= ":y$cite->{'year'}" if ($cite->{'year'}); | ||
| 437 | |||
| 438 | # tidy up | ||
| 439 | # $featureID =~ s/:[nsp]\s*:/:/g; # doesn't work. | ||
| 440 | while ($featureID =~ /:[nsp]\s*:/g) { | ||
| 441 | $featureID =~ s/:[nsp]\s*:/:/ | ||
| 442 | }; | ||
| 443 | $featureID =~ s/^://; | ||
| 444 | $featureID =~ s/\s+//g; | ||
| 445 | |||
| 446 | my @Features = split(':', $featureID); | ||
| 447 | |||
| 448 | # ignore those having too few metadata | ||
| 449 | if (scalar(@Features) >= 2) { | ||
| 450 | # standardize | ||
| 451 | $featureID = lc($featureID); | ||
| 452 | $cite->{'featureID'} = $featureID; | ||
| 453 | }; | ||
| 454 | } | ||
| 455 | |||
| 456 | sub create_refID { | ||
| 457 | my $cite = shift; | ||
| 458 | my $refID; | ||
| 459 | if ($cite->{'targetID'}) { | ||
| 460 | $cite->{refID} = $cite->{'sourceID'}.':'.$cite->{'targetID'}; | ||
| 461 | } | ||
| 462 | elsif ($cite->{'featureID'}) { | ||
| 463 | $cite->{refID} = $cite->{'sourceID'}.':'.$cite->{'featureID'}; | ||
| 464 | }; | ||
| 465 | } | ||
| 466 | |||
| 467 | sub find_authors { | ||
| 468 | my $cite = shift; | ||
| 469 | my $Text = $cite->{'rest_text'}; | ||
| 470 | |||
| 471 | my $aText = locate_authors($Text); | ||
| 472 | return 0 if ($aText eq '' or $aText =~ /^\W+$/); | ||
| 473 | |||
| 474 | my @Chunks = (); | ||
| 475 | @Chunks = split(/\s*[,;:\&]\s*/, $aText); | ||
| 476 | |||
| 477 | # ignore text longer than 4 words (don't count initials) | ||
| 478 | return 0 if (word_count($Chunks[0])>4 and no_initials($Chunks[0])); | ||
| 479 | |||
| 480 | my($author, $Authors) = ('',''); | ||
| 481 | while (@Chunks) { | ||
| 482 | if (scalar(@Chunks)==1) { | ||
| 483 | last if !full_name($Chunks[0]); | ||
| 484 | $author = normalise_name($Chunks[0]); | ||
| 485 | $Authors = "$Authors:$author"; | ||
| 486 | last | ||
| 487 | }; | ||
| 488 | |||
| 489 | |||
| 490 | # (1) forename and surname are not separated by [,;]. | ||
| 491 | if (full_name($Chunks[0])){ | ||
| 492 | if ($Chunks[1] =~ /^\s*Jr\.?\s*$/i) { | ||
| 493 | $author = "$Chunks[0], $Chunks[1]"; | ||
| 494 | $author = normalise_name($author); | ||
| 495 | $Authors = "$Authors:$author"; | ||
| 496 | splice(@Chunks, 0, 2); # remove the first two | ||
| 497 | next | ||
| 498 | } | ||
| 499 | elsif (!only_initials($Chunks[1])) { | ||
| 500 | $author = normalise_name($Chunks[0]); | ||
| 501 | $Authors = "$Authors:$author"; | ||
| 502 | shift(@Chunks); | ||
| 503 | next | ||
| 504 | } | ||
| 505 | } | ||
| 506 | elsif (full_name($Chunks[1])) { | ||
| 507 | # $Chunks[0] is not a name, skip. | ||
| 508 | shift @Chunks; | ||
| 509 | next | ||
| 510 | }; | ||
| 511 | |||
| 512 | # (2) forename and surname are separated by [,;]. | ||
| 513 | # Ignore text containing too many words. | ||
| 514 | my $aFull = "$Chunks[0] $Chunks[1]"; | ||
| 515 | my @abbr = (); | ||
| 516 | last if (word_count($aFull) > 4); | ||
| 517 | last if ($aFull =~ /[\d\/]+/); | ||
| 518 | |||
| 519 | # journal title maybe mixed up with the name | ||
| 520 | last if (@abbr = ($aFull =~ /\w\w\./g) and (@abbr >= 2)); | ||
| 521 | |||
| 522 | # surname first. | ||
| 523 | # "Oemler, A., Jr. and Lynds, C. R. 1975, ApJ, 199, 558" | ||
| 524 | if (scalar(@Chunks) > 2) { | ||
| 525 | if (is_surname($Chunks[0]) and | ||
| 526 | has_initials($Chunks[1]) and | ||
| 527 | $Chunks[2] =~ /^\s*Jr\.?\s*$/i) { | ||
| 528 | $author = "$Chunks[1] $Chunks[0], Jr"; | ||
| 529 | $author = normalise_name($author); | ||
| 530 | $Authors = "$Authors:$author"; | ||
| 531 | splice(@Chunks, 0, 3); # remove the first three | ||
| 532 | next | ||
| 533 | }; | ||
| 534 | }; | ||
| 535 | |||
| 536 | # surname first | ||
| 537 | # "Reisenegger, A. and Miralda-Escude, J. 1995, ApJ, 449, 476 | ||
| 538 | if (is_surname($Chunks[0]) and | ||
| 539 | has_initials($Chunks[1])) { | ||
| 540 | if ($Chunks[1] =~ /(.+?\.?)\s*Jr\.?\s*$/i){ | ||
| 541 | $author = "$1 $Chunks[0], Jr"; | ||
| 542 | } | ||
| 543 | else | ||
| 544 | { | ||
| 545 | $author = "$Chunks[1] $Chunks[0]"; | ||
| 546 | }; | ||
| 547 | $author = normalise_name($author); | ||
| 548 | $Authors = "$Authors:$author"; | ||
| 549 | splice(@Chunks, 0, 2); # remove the first two | ||
| 550 | next | ||
| 551 | }; | ||
| 552 | |||
| 553 | # forename first | ||
| 554 | if (only_initials($Chunks[0]) and | ||
| 555 | is_surname($Chunks[1])) { | ||
| 556 | if ($Chunks[0] =~ /(.+?[. ])\s*Jr\.?\s*$/i){ | ||
| 557 | $author = "$1 $Chunks[1], Jr"; | ||
| 558 | } | ||
| 559 | else | ||
| 560 | { | ||
| 561 | $author = $aFull | ||
| 562 | }; | ||
| 563 | $author = normalise_name($author); | ||
| 564 | $Authors = "$Authors:$author"; | ||
| 565 | splice(@Chunks, 0, 2); # remove the first two | ||
| 566 | next | ||
| 567 | }; | ||
| 568 | |||
| 569 | # 'Liu, Gong', hard to tell which is the surname; | ||
| 570 | if (no_initials($Chunks[0]) and | ||
| 571 | no_initials($Chunks[1])) { | ||
| 572 | if (word_count($aFull) <= 4 ) { | ||
| 573 | $author = normalise_name($aFull); | ||
| 574 | $Authors = "$Authors:$author"; | ||
| 575 | splice(@Chunks, 0, 2); # remove the first two | ||
| 576 | next | ||
| 577 | } | ||
| 578 | }; | ||
| 579 | |||
| 580 | # cannot determin the author name | ||
| 581 | last | ||
| 582 | |||
| 583 | }; # end of while | ||
| 584 | |||
| 585 | return 0 if ($Authors eq ''); | ||
| 586 | $Authors =~ s/^://; | ||
| 587 | $cite->{'authors'} = $Authors; | ||
| 588 | } | ||
| 589 | |||
| 590 | sub find_first_author { | ||
| 591 | my $cite = shift; | ||
| 592 | |||
| 593 | return 0 if (!defined($cite->{'authors'})); | ||
| 594 | |||
| 595 | my ($author) = split(':', $cite->{'authors'}, 2); | ||
| 596 | $cite->{'aufull'} = $author; | ||
| 597 | if( $author =~ /(.*)[\s\._]([^\s\.]+)/ ) { | ||
| 598 | $cite->{'aulast'} = $2; | ||
| 599 | $cite->{'aufirst'} = $1; | ||
| 600 | } | ||
| 601 | } | ||
| 602 | |||
| 603 | # locate_authors | ||
| 604 | sub locate_authors { | ||
| 605 | my $Text = shift; | ||
| 606 | |||
| 607 | $Text =~ s/^\s*For .*?review(s)?\W+//i; | ||
| 608 | $Text =~ s/^\s*(see )?also //i; | ||
| 609 | $Text =~ s/^\s*see[, ]\s*for example\W+//i; | ||
| 610 | $Text =~ s/^\s*see e\.g\.\W+//i; | ||
| 611 | my $aText = $Text; | ||
| 612 | |||
| 613 | # author name(s) is assumed to be in front of a consecutive | ||
| 614 | # 4 words, e.g. J. A. Harvey. String Duality and Non-supersymmetric | ||
| 615 | # Strings. | ||
| 616 | # if ($Text =~ /\b([\w\-'`"]+\s+){3,}[\w\-'"]+\b/){ | ||
| 617 | if ($Text =~ /\.\s+([\w\-'`"]+\s+){3,}[\w\-'"]{2,}\b/){ | ||
| 618 | $aText = $`; | ||
| 619 | }; | ||
| 620 | |||
| 621 | if ($Text =~ /[,;]\s*([\w\-'`"]{2,}\s+){3,}[\w\-'"]{2,}\b/) { | ||
| 622 | $aText = $`; | ||
| 623 | }; | ||
| 624 | # the above has truncated too much. | ||
| 625 | # "S. Popescu and Sudbery G. A. Multi-particle entanglement ..." | ||
| 626 | if (only_initials($aText)) { | ||
| 627 | $aText = $Text | ||
| 628 | }; | ||
| 629 | |||
| 630 | if ($aText =~ /[,:; ]\s*[a-z][\w\-'"]*\s+([a-z0-9\-'"]+\s+)*?[a-z0-9\-'"]{4,}(\b|$)/) { # "[6] M.Gotay, Constraints, reduction and quantization, | ||
| 631 | # J. Math. Phys. (1986) 2051. | ||
| 632 | $aText = $`; | ||
| 633 | }; | ||
| 634 | |||
| 635 | # Or before the following sybmols. | ||
| 636 | # if ($aText =~ /["\[\(]/) { | ||
| 637 | if ($aText =~ /[:"\[\(]/) { | ||
| 638 | $aText = $` | ||
| 639 | }; | ||
| 640 | |||
| 641 | |||
| 642 | # before '/', e.g. "Halzen F. astro-ph/0001001" | ||
| 643 | if ($aText =~ /\S+\//) { | ||
| 644 | $aText = $` | ||
| 645 | }; | ||
| 646 | |||
| 647 | # before any number | ||
| 648 | if ($aText =~ /\d+/i) { | ||
| 649 | $aText = $` | ||
| 650 | }; | ||
| 651 | |||
| 652 | # "14. A. J. Leggett, in Percolation, Localization and ..." | ||
| 653 | # or "M. Göckeler, et al., hep-lat/9608033." | ||
| 654 | if ($aText =~ /[,;: ]\s*(?:in )|(?:et\.?\s+al\.?\b)/i) { | ||
| 655 | $aText = $` | ||
| 656 | }; | ||
| 657 | |||
| 658 | # last author name after 'and'. | ||
| 659 | if ($aText =~ /[,; ]\s*and ([^,;:]+)[,:;]([^,;:]+)/i) { | ||
| 660 | my $Aft1 = $1; | ||
| 661 | my $Aft2 = $2; | ||
| 662 | if (full_name($Aft1)) { | ||
| 663 | $aText = $` .", $Aft1"; | ||
| 664 | } else { | ||
| 665 | $aText = $` .", $Aft1, $Aft2" | ||
| 666 | } | ||
| 667 | }; | ||
| 668 | |||
| 669 | # | ||
| 670 | # tidy up | ||
| 671 | # | ||
| 672 | # remove non-alphabets | ||
| 673 | $aText =~ s/^[^a-z]+//i; | ||
| 674 | $aText =~ s/^by //i; | ||
| 675 | $aText =~ s/[,; ]+and /,/i; | ||
| 676 | $aText =~ s/[,; ]+et\.?\s+al\.?([,; ]+|$)/, et al,/i; | ||
| 677 | $aText =~ s/[,;:.]+\s*$//; | ||
| 678 | return $aText | ||
| 679 | }; | ||
| 680 | |||
| 681 | # This subroutine needs re-written; not in use now. | ||
| 682 | sub locate_book { | ||
| 683 | my $cite = shift; | ||
| 684 | my $Text = $cite->{'rest_text'}; | ||
| 685 | |||
| 686 | if ($Text =~ /\W+in\s+(.+?)\W+(ed|eds|edited)\.?(\W|$)/) { | ||
| 687 | $$cite{book} = $1; | ||
| 688 | return 1 | ||
| 689 | }; | ||
| 690 | return 0 | ||
| 691 | |||
| 692 | } | ||
| 693 | |||
| 694 | sub find_vol_no { | ||
| 695 | my $cite = shift; | ||
| 696 | my $Text = $cite->{'rest_text'}; | ||
| 697 | |||
| 698 | if ($Text =~ s/[,;. ]\s*(?:volume|vol|v)?\.?\s*(\d+)\s*[ ,;]\s*(?:n|no|issue|\#)\.?\s*(\d+)\b/$1/is) { | ||
| 699 | |||
| 700 | $cite->{'volume'} = $2; | ||
| 701 | $cite->{'issue'} = $3; | ||
| 702 | $cite->{'jnl_epos'} = length($`); | ||
| 703 | $cite->{'rest_text'} = $Text; | ||
| 704 | return 1 | ||
| 705 | } | ||
| 706 | else { return 0} | ||
| 707 | } | ||
| 708 | |||
| 709 | sub find_vol_supl { | ||
| 710 | my $cite = shift; | ||
| 711 | my $Text = $cite->{'rest_text'}; | ||
| 712 | |||
| 713 | if ($Text =~ s/(\s|,|;|\.)\s*(?:volume|vol|v)?\.?\s*(\d+)\s*[\s,;]\s*(?:supl|supplement)\.?\s*(\d+)\b/$1/is) { | ||
| 714 | |||
| 715 | $cite->{'volume'} = $2; | ||
| 716 | $cite->{'supl'} = $3; | ||
| 717 | $cite->{'jnl_epos'} = length($`); | ||
| 718 | $cite->{'rest_text'} = $Text; | ||
| 719 | } | ||
| 720 | } | ||
| 721 | |||
| 722 | |||
| 723 | sub find_vol { | ||
| 724 | my $cite = shift; | ||
| 725 | my $Text = $cite->{'rest_text'}; | ||
| 726 | |||
| 727 | if ($Text =~ s/[,;:\. ]\s*(?:volume|vol)[\. ]\s*([a-z]*\d+[a-z]*)\b//i) { | ||
| 728 | $cite->{'volume'} = $1; | ||
| 729 | $cite->{'rest_text'} = $Text; | ||
| 730 | return | ||
| 731 | }; | ||
| 732 | |||
| 733 | # "..., Vol9 ..." | ||
| 734 | if ($Text =~ s/[,;:\. ]\s*(?:volume|vol)(\d+[a-z]*)\b//i) { | ||
| 735 | $cite->{'volume'} = $1; | ||
| 736 | $cite->{'rest_text'} = $Text; | ||
| 737 | return | ||
| 738 | }; | ||
| 739 | |||
| 740 | if ($Text =~ s/[,;:\. ]\s*(?:volume|vol)(\d+[a-z]*)\b//i) { | ||
| 741 | $cite->{'volume'} = $1; | ||
| 742 | $cite->{'rest_text'} = $Text; | ||
| 743 | return | ||
| 744 | }; | ||
| 745 | |||
| 746 | # beware: "Smith, V. 1990, Phys. Rev. A. v. 10 ..." | ||
| 747 | while ($Text =~ /[,;\. ]\s*V\s*[\. ]\s*([a-z]*\d+[a-z]*)\b/ig){ | ||
| 748 | my $Guess_vol = $1; | ||
| 749 | next if ($Guess_vol =~ /(19|20)\d\d/); | ||
| 750 | |||
| 751 | $cite->{'volume'} = $Guess_vol; | ||
| 752 | $Text =~ s/[,;\. ]\s*V\s*[\. ]\s*[a-z]*\d+[a-z]\b//i; | ||
| 753 | $cite->{'rest_text'} = $Text; | ||
| 754 | return | ||
| 755 | }; | ||
| 756 | |||
| 757 | # "... v10, ..." | ||
| 758 | if ($Text =~ s/[,;:\. ]\s*V(\d+[a-z]*)\b//i) { | ||
| 759 | $cite->{'volume'} = $1; | ||
| 760 | $cite->{'rest_text'} = $Text; | ||
| 761 | return | ||
| 762 | }; | ||
| 763 | } | ||
| 764 | |||
| 765 | sub find_issue { | ||
| 766 | my $cite = shift; | ||
| 767 | my $Text = $cite->{'rest_text'}; | ||
| 768 | |||
| 769 | if ($Text =~ s/[,;:. ]\s*(?:number|issue|num|no|Nr|\#)[. ]\s*([a-z]*\d+[a-z]*)\b//i) { | ||
| 770 | $cite->{'issue'} = $1; | ||
| 771 | $cite->{'rest_text'} = $Text; | ||
| 772 | return | ||
| 773 | }; | ||
| 774 | |||
| 775 | # e.g. " ...No10, ..." | ||
| 776 | if ($Text =~ s/[,;:. ]\s*(?:number|issue|num|no|Nr)(\d+[a-z]*)\b//i) { | ||
| 777 | $cite->{'issue'} = $1; | ||
| 778 | $cite->{'rest_text'} = $Text; | ||
| 779 | return | ||
| 780 | }; | ||
| 781 | |||
| 782 | while ($Text =~ /[,;:. ]\s*N\s*[. ]\s*([a-z]*\d+[a-z]*)\b/ig){ | ||
| 783 | my $Guess_issue = $1; | ||
| 784 | next if ($Guess_issue =~ /(19|20)\d\d/); | ||
| 785 | |||
| 786 | $cite->{'issue'} = $Guess_issue; | ||
| 787 | $Text =~ s/[,;. ]\s*N\s*[. ]\s*[a-z]*\d+[a-z]*\b//i; | ||
| 788 | return | ||
| 789 | }; | ||
| 790 | |||
| 791 | if ($Text =~ s/[,;:. ]\s*(?:n|\#|\#\s+)(\d+[a-z]*)\b//i) { | ||
| 792 | $cite->{'issue'} = $1; | ||
| 793 | $cite->{'rest_text'} = $Text; | ||
| 794 | return | ||
| 795 | }; | ||
| 796 | |||
| 797 | |||
| 798 | } | ||
| 799 | |||
| 800 | sub find_supplement { | ||
| 801 | my $cite = shift; | ||
| 802 | my $Text = $cite->{'rest_text'}; | ||
| 803 | |||
| 804 | if ($Text =~ s/[,;:. ]\s*(?:suppl|supplement)\.?\s*(\d+)\b//i) { | ||
| 805 | $cite->{'supl'} = $1; | ||
| 806 | $cite->{'num_of_fig'} = $cite->{'num_of_fig'} - 1; | ||
| 807 | $cite->{'rest_text'} = $Text | ||
| 808 | } | ||
| 809 | } | ||
| 810 | |||
| 811 | |||
| 812 | sub find_url { | ||
| 813 | my $cite = shift; | ||
| 814 | my $Text = $cite->{'rest_text'}; | ||
| 815 | |||
| 816 | if ($Text =~ s/\b(http:\/\/[^\s]+)['"]>/ /i){ | ||
| 817 | $cite->{'targetURL'} = $1; | ||
| 818 | $cite->{'rest_text'} = $Text; | ||
| 819 | return 1 | ||
| 820 | }; | ||
| 821 | |||
| 822 | if ($Text =~ s/\b(http:\/\/[^\s>]+)(?:\s|$)/ /i){ | ||
| 823 | $cite->{'targetURL'} = $1; | ||
| 824 | $cite->{'targetURL'} =~ s/[.,;]$//; | ||
| 825 | $cite->{'rest_text'} = $Text; | ||
| 826 | return 1 | ||
| 827 | }; | ||
| 828 | |||
| 829 | return 0 | ||
| 830 | } | ||
| 831 | |||
| 832 | sub find_page { | ||
| 833 | my $cite = shift; | ||
| 834 | my $Text = $cite->{'rest_text'}; | ||
| 835 | |||
| 836 | # keep the order of the pattern matching. | ||
| 837 | |||
| 838 | # '... p.20, p 20, ...' | ||
| 839 | if ($Text =~ s/[,;:. ]\s*(?:pages|page|pp)\s*[.# ]\s*([a-z]*\d+[a-z]*)\b//i) { | ||
| 840 | $cite->{'spage'} = $1; | ||
| 841 | $cite->{'rest_text'} = $Text; | ||
| 842 | return | ||
| 843 | }; | ||
| 844 | |||
| 845 | # " ... pp20, ..." | ||
| 846 | if ($Text =~ s/[,;:. ]\s*(?:pages|page|pp)(\d+[a-z]*)\b//i) { | ||
| 847 | $cite->{'spage'} = $1; | ||
| 848 | $cite->{'rest_text'} = $Text; | ||
| 849 | return | ||
| 850 | }; | ||
| 851 | |||
| 852 | # ... p. 1990-1993 | ||
| 853 | if ($Text =~ s/[,;. ]\s*(?:p)\s*[. ]\s* | ||
| 854 | ([a-z]*\d+[a-z]*)\s*\-\s*[a-z]*d+[a-z]*\b//xi) { | ||
| 855 | |||
| 856 | $cite->{'spage'} = $1; | ||
| 857 | $cite->{'rest_text'} = $Text; | ||
| 858 | return | ||
| 859 | }; | ||
| 860 | |||
| 861 | # Beaware "Smith P. 1990, ..., p. 100" | ||
| 862 | while ($Text =~ /[,;. ]\s*p\s*[. ]\s*([a-z]*\d+[a-z]*)\s*(?!\-)/ig){ | ||
| 863 | my $Guess_page = $1; | ||
| 864 | next if ($Guess_page =~ /(19|20)\d\d/); | ||
| 865 | |||
| 866 | $cite->{'spage'} = $Guess_page; | ||
| 867 | $Text =~ s/[,;. ]\s*p\s*[. ]\s*[a-z]*\d+[a-z]*\s*(?!\-)//i; | ||
| 868 | $cite->{'rest_text'} = $Text; | ||
| 869 | return | ||
| 870 | }; | ||
| 871 | |||
| 872 | # " ... p20, ..." | ||
| 873 | if ($Text =~ s/[,;:. ]\s*p(\d+[a-z]*)\b//i) { | ||
| 874 | $cite->{'spage'} = $1; | ||
| 875 | $cite->{'rest_text'} = $Text; | ||
| 876 | return | ||
| 877 | }; | ||
| 878 | } | ||
| 879 | |||
| 880 | |||
| 881 | sub find_year { | ||
| 882 | my $cite = shift; | ||
| 883 | |||
| 884 | return 1 if ($cite->{'year'}); | ||
| 885 | |||
| 886 | my $Text = $cite->{'rest_text'}; | ||
| 887 | |||
| 888 | # priority is given to (1989) type. | ||
| 889 | if ($Text =~ s/\(((19|20)\d\d)\w?\)//) { | ||
| 890 | $cite->{'year'} = $1; | ||
| 891 | $cite->{'rest_text'} = $Text; | ||
| 892 | return 1 | ||
| 893 | }; | ||
| 894 | |||
| 895 | # year like numbers not before/after a '-' | ||
| 896 | # e.g. 1966-1988 may indicate a page range. | ||
| 897 | if ($Text =~ /[^\w\-"]((19|20)\d\d)\w?([^\w\-"]|$)/i) { | ||
| 898 | |||
| 899 | $cite->{'year'} = $1; | ||
| 900 | $Text =~ "\Q$` $'\E"; | ||
| 901 | $cite->{'rest_text'} = $Text; | ||
| 902 | return 1 | ||
| 903 | }; | ||
| 904 | |||
| 905 | return 0; | ||
| 906 | } | ||
| 907 | |||
| 908 | # Apt'e, C., et al. ACM Transactions on Information Systems 12, 3, 233-251 | ||
| 909 | sub guess_vol_no_pg { | ||
| 910 | my $cite = shift; | ||
| 911 | return 1 if ($cite->{'volume'} and $cite->{'issue'} and | ||
| 912 | $cite->{'spage'}); | ||
| 913 | return 0 if ($cite->{'num_of_fig'} < 3); | ||
| 914 | |||
| 915 | my $Text = $cite->{'rest_text'}; | ||
| 916 | |||
| 917 | # change (1,1) alike to (). | ||
| 918 | $Text =~ s/\(\d+\s*,\s*\d+\s*\)/\(\)/g; | ||
| 919 | $Text =~ s/\(\d+\s*;\s*\d+\s*\)/\(\)/g; | ||
| 920 | |||
| 921 | if ($Text =~ | ||
| 922 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 923 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 924 | [^\w\/.-]+(?:pages|page|pp|p)?\.? | ||
| 925 | \s*([a-z]*?\d+[a-z]*?)(?:\s*-\s*[a-z]*?\d+[a-z]*?)? | ||
| 926 | (\W*|$)/xi) { | ||
| 927 | |||
| 928 | $cite->{'volume'} = $1; | ||
| 929 | $cite->{'issue'} = $2; | ||
| 930 | $cite->{'spage'} = $3; | ||
| 931 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 932 | |||
| 933 | return 1 | ||
| 934 | }; | ||
| 935 | |||
| 936 | return 0 | ||
| 937 | |||
| 938 | } | ||
| 939 | |||
| 940 | |||
| 941 | # '15:190' (15A:190-195, 14-15:190-180, or "Astrophys. J. 8, 103"); | ||
| 942 | # Called this after '{find_vol_{no}_pg_year}' failed. | ||
| 943 | sub guess_vol_pg { | ||
| 944 | my $cite = shift; | ||
| 945 | return 1 if ($cite->{'volume'} and $cite->{'spage'}); | ||
| 946 | return 0 if ($cite->{'num_of_fig'} < 2); | ||
| 947 | |||
| 948 | my $Text = $cite->{'rest_text'}; | ||
| 949 | |||
| 950 | # change (1,1) alike to (). | ||
| 951 | $Text =~ s/\(\d+\s*,\s*\d+\s*\)/\(\)/g; | ||
| 952 | $Text =~ s/\(\d+\s*;\s*\d+\s*\)/\(\)/g; | ||
| 953 | |||
| 954 | # 15A:190-195 type | ||
| 955 | if ($Text =~ s/[^\w\/.-]([a-z]*?\d+[a-z]*?)\s*:\s*([a-z]*?\d+[a-z]*?)\s* | ||
| 956 | (-\s*[a-z]*?\d+[a-z]*?)?(\W|$)/$4/xi) { | ||
| 957 | $cite->{'volume'} = $1; | ||
| 958 | $cite->{'spage'} = $2; | ||
| 959 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 960 | |||
| 961 | $cite->{'rest_text'} = $Text; | ||
| 962 | return 1 | ||
| 963 | }; | ||
| 964 | |||
| 965 | # Astrophys. J. Lett., 452, p.L91-L93 | ||
| 966 | # AIP, vol 307, p.117, New York (1994). | ||
| 967 | # Pub. Astron. Soc. Japan, 2000, p.52 | ||
| 968 | if ($Text =~ | ||
| 969 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 970 | [^\w\/.-]*,\s*(?:p|pp|page|pages)[. ]\s*([a-z]*?\d+[a-z]*?)\s* | ||
| 971 | (-\s*[a-z]*?\d+[a-z]*?)?(?:\W|$)/xi) { | ||
| 972 | |||
| 973 | my $Guess_vol = $1; | ||
| 974 | $cite->{'spage'} = $2; | ||
| 975 | my $Guess_jnl_epos = length($`) + 1; # prematch | ||
| 976 | |||
| 977 | if ($Guess_vol =~ /^(19|20)\d\d[a-z]?$/i) { | ||
| 978 | $cite->{'year'} = $Guess_vol; | ||
| 979 | $cite->{'rest_text'} =~ | ||
| 980 | s/([^\w\/.-])(?:volume|vol\.?|v\.?)?\s*[a-z]*?\d+[a-z]*?\s*,\s*(?:p|pp|page|pages)\s*\.?[a-z]*?\d+[a-z]*?\s*(-\s*[a-z]*?\d+[a-z]*?)?(\W|$)/$1/i; | ||
| 981 | return 0 | ||
| 982 | }; | ||
| 983 | $cite->{'volume'} = $Guess_vol; | ||
| 984 | $cite->{'jnl_epos'} = $Guess_jnl_epos; | ||
| 985 | $cite->{'rest_text'} =~ | ||
| 986 | s/([^\w\/.-])[a-z]*?\d+[a-z]*?\s*,\s*(?:p|pp|page|pages)\s*\.?[a-z]*?\d+[a-z]*?\s*(-\s*[a-z]*?\d+[a-z]*?)?(\W|$)/$1/i; | ||
| 987 | return 1 | ||
| 988 | }; | ||
| 989 | |||
| 990 | # Elias, J. 1994, NOAO Newsletter, No. 37, 1 | ||
| 991 | if ($Text =~ | ||
| 992 | /[^\w\/.-](?:n|no|num|issue)[. ]\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 993 | [^\w\/.-]*,\s*(?:p|pp|page|pages)?\.?\s*([a-z]*?\d+[a-z]*?)\s* | ||
| 994 | (-\s*[a-z]*?\d+[a-z]*?)?(?:\W|$)/xi) { | ||
| 995 | |||
| 996 | $cite->{'issue'} = $1; | ||
| 997 | $cite->{'spage'} = $2; | ||
| 998 | $cite->{'jnl_epos'} = length($`) + 1; # prematch | ||
| 999 | $cite->{'rest_text'} =~ | ||
| 1000 | s/([^\w\/.-])(?:n|no|num|issue)[. ]\s*[a-z]*?\d+[a-z]*?[^\w\/.-]*,\s*(?:p|pp|page|pages)?\.?\s*([a-z]*?\d+[a-z]*?)\s*(-\s*[a-z]*?\d+[a-z]*?)?(?:\W|$)/$1/i; | ||
| 1001 | return 1 | ||
| 1002 | }; | ||
| 1003 | |||
| 1004 | # match page range. | ||
| 1005 | # Phys. Rev. A 4, 52-60 | ||
| 1006 | # Pub. Astron. Soc. Japan, 1998, 52-60 | ||
| 1007 | if ($Text =~ /[^\w\/.-]([a-z]*?\d+[a-z]*?) # volume or year | ||
| 1008 | [^\w\/.-]*[, ]\s*([a-z]*?\d+[a-z]*?)\s* # pages | ||
| 1009 | -\s*[a-z]*?\d+[a-z]*?(?:[^\w-]|$)/xi) { | ||
| 1010 | |||
| 1011 | my $Guess_vol = $1; | ||
| 1012 | $cite->{'spage'} = $2; | ||
| 1013 | my $Guess_jnl_epos = length($`) + 1; # prematch | ||
| 1014 | |||
| 1015 | if ($Guess_vol =~ /^(19|20)\d\d[a-z]?$/i) { | ||
| 1016 | $cite->{'year'} = $Guess_vol; | ||
| 1017 | $cite->{'rest_text'} =~ | ||
| 1018 | s/([^\w\/.-])[a-z]*?\d+[a-z]*?\s*[, ]\s*([a-z]*?\d+[a-z]*?)\s*-\s*[a-z]*?\d+[a-z]*?(?:[^\w\/.-]|$)/$1/i; | ||
| 1019 | return 0 | ||
| 1020 | }; | ||
| 1021 | $cite->{'volume'} = $Guess_vol; | ||
| 1022 | $cite->{'jnl_epos'} = $Guess_jnl_epos; | ||
| 1023 | $cite->{'rest_text'} =~ s/([^\w\/.-])[a-z]*?\d+[a-z]*?\s*,\s*([a-z]*?\d+[a-z]*?)\s*-\s*[a-z]*?\d+[a-z]*?(?:[^\w\/.-]|$)/$1/i; | ||
| 1024 | |||
| 1025 | return 1 | ||
| 1026 | }; | ||
| 1027 | |||
| 1028 | # Phys. Rev. B 38, 2297. (Phys. Rev. B 38 2297) | ||
| 1029 | # Pub. Astron. Soc. Japan, 2000, 52. | ||
| 1030 | if ($Text =~ /[^\w\/.-]([a-uw-z]*?\d+[a-z]*?) | ||
| 1031 | [^\w\/.-]*[, ]\s*([a-z]?\d+[a-z]?)(?:[^\w\/.-]|$)/xi) { | ||
| 1032 | |||
| 1033 | my $Guess_vol = $1; | ||
| 1034 | my $Guess_page = $2; | ||
| 1035 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1036 | |||
| 1037 | if ($Guess_vol =~ /^(19|20)\d\d[a-z]?$/i) { | ||
| 1038 | $cite->{'year'} = $Guess_vol; | ||
| 1039 | } else { | ||
| 1040 | $cite->{'volume'} = $Guess_vol; | ||
| 1041 | }; | ||
| 1042 | |||
| 1043 | if ($Guess_page =~ /^(19|20)\d\d[a-z]?$/i) { | ||
| 1044 | $cite->{'year'} = $Guess_page; | ||
| 1045 | } else { | ||
| 1046 | $cite->{'spage'} = $Guess_page; | ||
| 1047 | }; | ||
| 1048 | |||
| 1049 | $cite->{'rest_text'} =~ | ||
| 1050 | s/([^\w\/.-])[a-z]*?\d+[a-z]*?[^\w\/.-]*[, ]\s*[a-z]*?\d+[a-z]*?(?:[^\w\/.-]|$)/$1/i; | ||
| 1051 | return 1 if ($cite->{'volume'} and $cite->{'spage'}); | ||
| 1052 | return 0 | ||
| 1053 | }; | ||
| 1054 | |||
| 1055 | return 0 | ||
| 1056 | }; | ||
| 1057 | |||
| 1058 | # | ||
| 1059 | # G. Smith and H. Gray; Pub. Astron. Soc. Japan, 2000, vol. 52 | ||
| 1060 | # To find $cite->{'jnl_epos'} currectly. Note that '2000' may be | ||
| 1061 | # regarded as the journal name (by subroutine find_vol). | ||
| 1062 | sub guess_vol_year { | ||
| 1063 | my $cite = shift; | ||
| 1064 | return 0 if ($cite->{'num_of_fig'} < 2); | ||
| 1065 | |||
| 1066 | my $Text = $cite->{'rest_text'}; | ||
| 1067 | |||
| 1068 | # change (1,1) alike to (). | ||
| 1069 | $Text =~ s/\(\d+\s*,\s*\d+\s*\)/\(\)/g; | ||
| 1070 | $Text =~ s/\(\d+\s*;\s*\d+\s*\)/\(\)/g; | ||
| 1071 | |||
| 1072 | if ($Text =~ | ||
| 1073 | /[^\w\/.-]\(?((19|20)\d\d)\w?\)?[^\w\/.-]* | ||
| 1074 | (?:volume|vol|v)\W*([a-oq-z]*?\d+[a-z]*?)(\W|$)/xis) { | ||
| 1075 | |||
| 1076 | $cite->{'year'} = $1; | ||
| 1077 | $cite->{'volume'} = $3; | ||
| 1078 | $cite->{'jnl_epos'} = length($`); | ||
| 1079 | |||
| 1080 | return 1 | ||
| 1081 | }; | ||
| 1082 | |||
| 1083 | # be aware: "Workshop on ..., p30 (1999)." | ||
| 1084 | if ($Text =~ | ||
| 1085 | /[^\w\/.-](?:volume|vol|v)?\W*([a-oq-z]?\d+[a-z]?) | ||
| 1086 | [^\w\/.-]+\(?((19|20)\d\d)\w?\)?(\W|$)/xis) { | ||
| 1087 | $cite->{'volume'} = $1; | ||
| 1088 | $cite->{'year'} = $2; | ||
| 1089 | $cite->{'jnl_epos'} = length($`); | ||
| 1090 | |||
| 1091 | return 1 | ||
| 1092 | }; | ||
| 1093 | |||
| 1094 | return 0 | ||
| 1095 | }; | ||
| 1096 | |||
| 1097 | sub find_vol_no_pg_year { | ||
| 1098 | my $cite = shift; | ||
| 1099 | return 1 if ($cite->{'volume'} and $cite->{'issue'} and | ||
| 1100 | $cite->{'spage'} and $cite->{'year'}); | ||
| 1101 | return 0 if ($cite->{'num_of_fig'} < 4); | ||
| 1102 | |||
| 1103 | my $Text = $cite->{'rest_text'}; | ||
| 1104 | |||
| 1105 | # change (1,1) alike to (). | ||
| 1106 | $Text =~ s/\(\d+\s*,\s*\d+\s*\)/\(\)/g; | ||
| 1107 | $Text =~ s/\(\d+\s*;\s*\d+\s*\)/\(\)/g; | ||
| 1108 | |||
| 1109 | # Keep the following order of texting $Text; | ||
| 1110 | # Important: check 'year' at the end first. | ||
| 1111 | |||
| 1112 | # (A.1): | ||
| 1113 | # 'year' is at the end, within bracket. | ||
| 1114 | # ..., v.517, no. 1, p.190-200, (1999) | ||
| 1115 | # ..., 11(2), 100-105, (1999) | ||
| 1116 | if ($Text =~ | ||
| 1117 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1118 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1119 | [^\w\/.-]+(?:pages|page|pp|p)?\.? | ||
| 1120 | \s*([a-z]*?\d+[a-z]*?)(?:\s*-\s*[a-z]*?\d+[a-z]*?)? | ||
| 1121 | \W*\(((19|20)\d\d)[a-z]*?\)(\W|$)/xi) { | ||
| 1122 | |||
| 1123 | $cite->{'volume'} = $1; | ||
| 1124 | $cite->{'issue'} = $2; | ||
| 1125 | $cite->{'spage'} = $3; | ||
| 1126 | $cite->{'year'} = $4; | ||
| 1127 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1128 | |||
| 1129 | return 1 | ||
| 1130 | }; | ||
| 1131 | |||
| 1132 | # (A.2) 'year' is in the middle, within bracket. | ||
| 1133 | # ..., 4(2), (1999), 100-105 | ||
| 1134 | if ($Text =~ | ||
| 1135 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1136 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1137 | \W*\(((19|20)\d\d)[a-z]*?\) # year | ||
| 1138 | \W*(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/xi) { | ||
| 1139 | |||
| 1140 | $cite->{'volume'} = $1; | ||
| 1141 | $cite->{'issue'} = $2; | ||
| 1142 | $cite->{'year'} = $3; | ||
| 1143 | $cite->{'spage'} = $5; | ||
| 1144 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1145 | |||
| 1146 | return 1 | ||
| 1147 | }; | ||
| 1148 | |||
| 1149 | # (A.3.1) 'year' is at the beginning, within bracket, after | ||
| 1150 | # journal title; | ||
| 1151 | # ...., (1999), 517, no. 1, p.190-200 | ||
| 1152 | if ($Text =~ | ||
| 1153 | /\(((19|20)\d\d)[a-z]*?\)[,.;\s:]* # year | ||
| 1154 | (?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1155 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1156 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/ix) | ||
| 1157 | { | ||
| 1158 | $cite->{'year'} = $1; | ||
| 1159 | $cite->{'volume'} = $3; | ||
| 1160 | $cite->{'issue'} = $4; | ||
| 1161 | $cite->{'spage'} = $5; | ||
| 1162 | $cite->{'jnl_epos'} = length($`); | ||
| 1163 | |||
| 1164 | return 1; | ||
| 1165 | }; | ||
| 1166 | |||
| 1167 | # (A.3.2) 'year' is at the beginning, within bracket, before | ||
| 1168 | # journal title; | ||
| 1169 | # ..., (1999),..., 517, no. 1, p.190-200 | ||
| 1170 | if ($Text =~ | ||
| 1171 | /\(((19|20)\d\d)[a-z]*?\) # year | ||
| 1172 | ([^(]+?) | ||
| 1173 | [^\w\/.-](?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1174 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1175 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/ix){ | ||
| 1176 | $cite->{'year'} = $1; | ||
| 1177 | $cite->{'volume'} = $4; | ||
| 1178 | $cite->{'issue'} = $5; | ||
| 1179 | $cite->{'spage'} = $6; | ||
| 1180 | |||
| 1181 | # $cite->{'jnl_spos'} = length($`); | ||
| 1182 | # $cite->locate_jnl_epos(); | ||
| 1183 | $cite->{'jnl_epos'} = length($`) + length($1) + | ||
| 1184 | length($3); | ||
| 1185 | return 1; | ||
| 1186 | }; | ||
| 1187 | |||
| 1188 | |||
| 1189 | # (B.1): | ||
| 1190 | # 'year' is at the end, but not in bracket; | ||
| 1191 | # ..., v.517, no. 1, p.190-200, 1999 | ||
| 1192 | # ..., 517, no. 1, p.190-200, 1999 | ||
| 1193 | if ($Text =~ | ||
| 1194 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1195 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1196 | [^\w\/.-]+(?:pages|page|pp|p)?\.? | ||
| 1197 | \s*([a-z]*?\d+[a-z]*?)(?:\s*-\s*[a-z]*?\d+[a-z]*?)? | ||
| 1198 | [^\w(:\/.-]+?((19|20)\d\d)[a-z]?\s*(?![)-])/xi) { | ||
| 1199 | |||
| 1200 | $cite->{'volume'} = $1; | ||
| 1201 | $cite->{'issue'} = $2; | ||
| 1202 | $cite->{'spage'} = $3; | ||
| 1203 | $cite->{'year'} = $4; | ||
| 1204 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1205 | |||
| 1206 | return 1 | ||
| 1207 | }; | ||
| 1208 | |||
| 1209 | |||
| 1210 | # (B.2): 'year' is in the middle, but not in bracket. | ||
| 1211 | # 4(2), 1999, 100-105 | ||
| 1212 | if ($Text =~ | ||
| 1213 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1214 | [^\w\/.-]+(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) # issue | ||
| 1215 | [^\w(:\/.-]+?\s*((19|20)\d\d)[a-z]? # year | ||
| 1216 | \s*[^\w\/.)-]+?\s*(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/xi) { | ||
| 1217 | |||
| 1218 | $cite->{'volume'} = $1; | ||
| 1219 | $cite->{'issue'} = $2; | ||
| 1220 | $cite->{'year'} = $3; | ||
| 1221 | $cite->{'spage'} = $5; | ||
| 1222 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1223 | |||
| 1224 | return 1 | ||
| 1225 | }; | ||
| 1226 | |||
| 1227 | # (B.3.1): 'year' is at beginning, not in bracket, after title; | ||
| 1228 | # ..., 1999, v.517, no. 1, p.190-200 | ||
| 1229 | # " ... 1890-1999", MNRAS, 2000, 4:1, p 1990 | ||
| 1230 | if ($Text =~ | ||
| 1231 | /[^"(\/.-]\s*((19|20)\d\d)[a-z]?[,;\.\s]+ # year | ||
| 1232 | (?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1233 | [^\w\/.-]+?(?:n|no|number|issue|\#)?\.?\s*([a-z]*?\d+[a-z]*?) | ||
| 1234 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/ix) | ||
| 1235 | { | ||
| 1236 | $cite->{'year'} = $1; | ||
| 1237 | $cite->{'volume'} = $3; | ||
| 1238 | $cite->{'issue'} = $4; | ||
| 1239 | $cite->{'spage'} = $5; | ||
| 1240 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1241 | return 1 | ||
| 1242 | }; | ||
| 1243 | |||
| 1244 | # (B.3.2): 'year' is at beginning, not in bracket, before title; | ||
| 1245 | # 1999, ..., v.517, no. 1, p.190-200 | ||
| 1246 | # 1999, ..., 517, no. 1, p.190-200 | ||
| 1247 | # 1999, ..., 517(1), 190-200 | ||
| 1248 | # NB: 1999, "... 1.5 factor ....", 517(1), 190-200 | ||
| 1249 | # NB: B. Greene, editors, "Fields, Strings and Duality, TASI 1996", | ||
| 1250 | # pages 421-540, World Scientific, 1997. | ||
| 1251 | # " ... 1890-1999", MNRAS, 2000, 4:1, p 1990 | ||
| 1252 | if ($Text =~ | ||
| 1253 | /(?:^|[^"(\/.-])\s*((19|20)\d\d)[a-z]? # year | ||
| 1254 | [^\w:")(\/-][^(]*? | ||
| 1255 | [^\w\/.-](?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1256 | [^\w\/.-]+?(?:n|no|number|issue|\#)?\.?\s*([a-z]?\d+[a-z]?) | ||
| 1257 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]*?\d+[a-z]*?)(\W|$)/ix) | ||
| 1258 | { | ||
| 1259 | $cite->{'year'} = $1; | ||
| 1260 | $cite->{'volume'} = $3; | ||
| 1261 | $cite->{'issue'} = $4; | ||
| 1262 | $cite->{'spage'} = $5; | ||
| 1263 | |||
| 1264 | $cite->{'jnl_spos'} = length($`); | ||
| 1265 | $cite->locate_jnl_epos(); | ||
| 1266 | return 1 | ||
| 1267 | }; | ||
| 1268 | return 0 | ||
| 1269 | }; | ||
| 1270 | |||
| 1271 | |||
| 1272 | # For cases where 'vol, page, year' can be identified correctly. | ||
| 1273 | sub find_vol_pg_year { | ||
| 1274 | my $cite = shift; | ||
| 1275 | return 1 if ($cite->{'volume'} and $cite->{'spage'} and | ||
| 1276 | $cite->{'year'}); | ||
| 1277 | return 0 if ($cite->{'num_of_fig'} < 3); | ||
| 1278 | |||
| 1279 | my $Text = $cite->{'rest_text'}; | ||
| 1280 | |||
| 1281 | # change (1,1) alike to (). | ||
| 1282 | $Text =~ s/\(\d+\s*,\s*\d+\s*\)/\(\)/g; | ||
| 1283 | $Text =~ s/\(\d+\s*;\s*\d+\s*\)/\(\)/g; | ||
| 1284 | |||
| 1285 | # (A.1) 'year' is at the end, within bracket. | ||
| 1286 | # ......, vol.8:100, (1999) | ||
| 1287 | # ......, 8:100, (1999) | ||
| 1288 | # ~~~~ | ||
| 1289 | if ($Text =~ | ||
| 1290 | /(?:^|[^\w\/.-])(?:volume|vol\.?|v\.?)?\s*([a-z]*\d+[a-z]*) # volume | ||
| 1291 | [^\w\/.-]+(?:pages|page|pp|p)?\.? | ||
| 1292 | \s*([a-z]?\d+[a-z]?)(?:\s*-\s*[a-z]?\d+[a-z]?)? | ||
| 1293 | \W*\(((19|20)\d\d)[a-z]?\)(\W|$)/xi) { | ||
| 1294 | |||
| 1295 | $cite->{'volume'} = $1; | ||
| 1296 | $cite->{'spage'} = $2; | ||
| 1297 | $cite->{'year'} = $3; | ||
| 1298 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1299 | |||
| 1300 | return 1 | ||
| 1301 | }; | ||
| 1302 | |||
| 1303 | # (A.2) 'year' is in the middle, within bracket. | ||
| 1304 | # ......, 8, (1999), 100-105 | ||
| 1305 | if ($Text =~ | ||
| 1306 | /(?:^|[^\w\/.-])(?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1307 | \W*\(((19|20)\d\d)[a-z]?\) # year | ||
| 1308 | \W*(?:pages|page|pp|p)?\.? | ||
| 1309 | \s*([a-z]?\d+[a-z]?)(?:\s*-\s*[a-z]?\d+[a-z]?)?(\W|$)/xi) { | ||
| 1310 | |||
| 1311 | $cite->{'volume'} = $1; | ||
| 1312 | $cite->{'year'} = $2; | ||
| 1313 | $cite->{'spage'} = $4; | ||
| 1314 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1315 | |||
| 1316 | return 1 | ||
| 1317 | }; | ||
| 1318 | |||
| 1319 | # (A.3.1.) 'year' is at beginning, within bracket, after title; | ||
| 1320 | # ......, (1999) 517, 190-200 | ||
| 1321 | if ($Text =~ | ||
| 1322 | /\(((19|20)\d\d)[a-z]?\)[,;\.\s]* # year | ||
| 1323 | (?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1324 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1325 | $cite->{'year'} = $1; | ||
| 1326 | $cite->{'volume'} = $3; | ||
| 1327 | $cite->{'spage'}= $4; | ||
| 1328 | $cite->{'jnl_epos'} = length($`); | ||
| 1329 | |||
| 1330 | return 1; | ||
| 1331 | }; | ||
| 1332 | |||
| 1333 | # (A.3.1.1) 'year' is at beginning, within bracket, after title; | ||
| 1334 | # not 'vol', buy 'No.@, e.g."..., (1999) No. 517, 190-200 | ||
| 1335 | if ($Text =~ | ||
| 1336 | /\(((19|20)\d\d)[a-z]?\)[,;\.\s]* # year | ||
| 1337 | (?:number|no|n)\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1338 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1339 | $cite->{'year'} = $1; | ||
| 1340 | $cite->{'volume'} = $3; | ||
| 1341 | $cite->{'spage'}= $4; | ||
| 1342 | $cite->{'jnl_epos'} = length($`); | ||
| 1343 | |||
| 1344 | return 1; | ||
| 1345 | }; | ||
| 1346 | |||
| 1347 | |||
| 1348 | # (A.3.2.) 'year' is at beginning, within bracket, before title; | ||
| 1349 | # ..., (1999),..., 517, p.190-200 | ||
| 1350 | if ($Text =~ | ||
| 1351 | /\(((19|20)\d\d)[a-z]?\) # year | ||
| 1352 | [^(]+? | ||
| 1353 | [^\w\/.-](?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1354 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1355 | $cite->{'year'} = $1; | ||
| 1356 | $cite->{'volume'} = $3; | ||
| 1357 | $cite->{'spage'} = $4; | ||
| 1358 | |||
| 1359 | $cite->{'jnl_spos'} = length($`); | ||
| 1360 | $cite->locate_jnl_epos(); | ||
| 1361 | return 1; | ||
| 1362 | }; | ||
| 1363 | |||
| 1364 | # (B.1) 'year' is at the end, but not in bracket. | ||
| 1365 | # ......, vol.8:100, 1999 | ||
| 1366 | # ......, 8:100, 1999 | ||
| 1367 | # NB: ..., 1999, 8(1900) | ||
| 1368 | # ~~~~ | ||
| 1369 | if ($Text =~ | ||
| 1370 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1371 | [^\w\/.-]+(?:pages|page|pp|p)?\.? | ||
| 1372 | \s*([a-z]?\d+[a-z]?)(?:\s*-\s*[a-z]?\d+[a-z]?)? # page | ||
| 1373 | [^\w:(\/.-]+\s*((19|20)\d\d)[a-z]?\s*(?![)-])/xi) { | ||
| 1374 | |||
| 1375 | $cite->{'volume'} = $1; | ||
| 1376 | $cite->{'spage'} = $2; | ||
| 1377 | $cite->{'year'} = $3; | ||
| 1378 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1379 | |||
| 1380 | return 1 | ||
| 1381 | }; | ||
| 1382 | |||
| 1383 | # (B.2) 'year' is in the middle, but not in brackets; | ||
| 1384 | # ... 8, 1999, p.100 | ||
| 1385 | # ... 8, 1999, 100-105 | ||
| 1386 | if ($Text =~ | ||
| 1387 | /[^\w\/.-](?:volume|vol\.?|v\.?)?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1388 | [^\w:(\/.-]+?\s*((19|20)\d\d)[a-z]? # year | ||
| 1389 | [^\w\/.)-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/xi) | ||
| 1390 | { | ||
| 1391 | $cite->{'volume'} = $1; | ||
| 1392 | $cite->{'year'} = $2; | ||
| 1393 | $cite->{'spage'} = $4; | ||
| 1394 | $cite->{'jnl_epos'} = length($`) + 1; | ||
| 1395 | |||
| 1396 | return 1 | ||
| 1397 | }; | ||
| 1398 | |||
| 1399 | # (B.3.1) 'year' is at the beginning,not in bracket, after title; | ||
| 1400 | # ..., 1999, 8, p1990 | ||
| 1401 | if ($Text =~ | ||
| 1402 | /[^\w\/.(-]\s*((19|20)\d\d)[a-z]?[,;\.\s]+ | ||
| 1403 | (?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1404 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1405 | $cite->{'year'} = $1; | ||
| 1406 | $cite->{'volume'} = $3; | ||
| 1407 | $cite->{'spage'} = $4; | ||
| 1408 | $cite->{'jnl_epos'} = length($`)+1; | ||
| 1409 | return 1 | ||
| 1410 | }; | ||
| 1411 | |||
| 1412 | # (B.3.1.1) 'year' is at the beginning,not in bracket, after title; | ||
| 1413 | # no 'vol', but 'no.' e.g. ..., 1999, No. 8, p1990 | ||
| 1414 | if ($Text =~ | ||
| 1415 | /[^\w\/.(-]\s*((19|20)\d\d)[a-z]?[,;\.\s]+ | ||
| 1416 | (?:number|no|n)\.?\s*([a-z]*?\d+[a-z]*?) # no volume, but issues | ||
| 1417 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1418 | $cite->{'year'} = $1; | ||
| 1419 | $cite->{'issue'} = $3; | ||
| 1420 | $cite->{'spage'} = $4; | ||
| 1421 | $cite->{'jnl_epos'} = length($`)+1; | ||
| 1422 | return 1 | ||
| 1423 | }; | ||
| 1424 | |||
| 1425 | |||
| 1426 | # (B.3.2) 'year' is at beginning, not in bracket, before title; | ||
| 1427 | # 1999, ..., 8(100) | ||
| 1428 | if ($Text =~ | ||
| 1429 | /((^|[^"\/.(-])\s*)(((19|20)\d\d)[a-z]?) # year | ||
| 1430 | ([^\w:")(\/][^(]*?) | ||
| 1431 | [^\w\/.-](?:volume|vol|v)?\.?\s*([a-z]*?\d+[a-z]*?) # volume | ||
| 1432 | [^\w\/.-]+(?:pages|page|pp|p)?\.?\s*([a-z]?\d+[a-z]?)(\W|$)/ix){ | ||
| 1433 | $cite->{'year'} = $4; | ||
| 1434 | $cite->{'volume'} = $7; | ||
| 1435 | $cite->{'spage'} = $8; | ||
| 1436 | |||
| 1437 | # $cite->{'jnl_spos'} = length($`); | ||
| 1438 | # $cite->locate_jnl_epos(); | ||
| 1439 | $cite->{'jnl_epos'} = length($`) + length($1) + | ||
| 1440 | length($3) + length($6); | ||
| 1441 | return 1 | ||
| 1442 | }; | ||
| 1443 | |||
| 1444 | return 0 | ||
| 1445 | } | ||
| 1446 | |||
| 1447 | |||
| 1448 | # This subroutine is only called when the journal title is between | ||
| 1449 | # 'year' and 'vol/page', e.g. (a lot in astro-ph/) | ||
| 1450 | # Barnes, J., Efstathiou, G., 1987, ApJ, 319, 575 | ||
| 1451 | # For other cases, the cite{'jnl_epos'} is determined while trying to | ||
| 1452 | # find out the vol, page, year, i.e. in 'find_vol_no_pg_year' kind | ||
| 1453 | # of subroutines. | ||
| 1454 | # | ||
| 1455 | sub locate_jnl_epos { | ||
| 1456 | |||
| 1457 | my $cite = shift; | ||
| 1458 | my $sPos = $cite->{'jnl_spos'}; | ||
| 1459 | my $Text = substr($cite->{'rest_text'}, $sPos); | ||
| 1460 | |||
| 1461 | # $Text =~ s/(\W+)(?:pages|page|pp|p)\W*(\d+)/$1$2/; | ||
| 1462 | # $Text =~ s/-\d+[a-z]*?//; # pp100-105 | ||
| 1463 | |||
| 1464 | # Before 'volume' | ||
| 1465 | if ($Text =~ /\b(?:volume|vol\.?|v\.?)\s*[a-z]*?\d+[a-z]*?(?![.0-9])/i) { | ||
| 1466 | $cite->{'jnl_epos'} = length($`) + $sPos; | ||
| 1467 | return 1 | ||
| 1468 | }; | ||
| 1469 | |||
| 1470 | # (1997) Phys. Rev. E56, No.3, 2875 | ||
| 1471 | # (1997) Phys. Rev. A50, p.160 | ||
| 1472 | if ($Text =~ / | ||
| 1473 | [^\w\/.-](?:volume|vol\.?|v\.?)?\s*[a-z]*?\d+[a-z]*? # volume | ||
| 1474 | [^\w\/.-]+(?:n |n.|no |no.|number |issue |\#|p |p.|pp.|page )\s*[a-z]*?\d+[a-z]*? | ||
| 1475 | (?:\W|$)/xi) { | ||
| 1476 | $cite->{'jnl_epos'} = length($`) + $sPos + 1 ; | ||
| 1477 | return 1 | ||
| 1478 | }; | ||
| 1479 | |||
| 1480 | # Before any two consecutive numbers, but not '123-127' style page. | ||
| 1481 | # Bertelli, G., 1999, ApJ, 517(1), .... | ||
| 1482 | # ApJ, 517:1, ... | ||
| 1483 | # ApJ, 517:367-380. | ||
| 1484 | #Beaware: J.K. Lanyi. 1999. Structure of bacteriorhodopsin at 1.55 | ||
| 1485 | # angstrom resolution J. Mol. Bio. 291:899-911 ~~~~! | ||
| 1486 | if ($Text =~ /[^\w\/.-][a-z]*?\d+[a-z]*?\s*[,:(\s]\s* | ||
| 1487 | [a-z]?\d+[a-z]?(\W|$)/xi) { | ||
| 1488 | $cite->{'jnl_epos'} = length($`) + $sPos + 1; | ||
| 1489 | return 1 | ||
| 1490 | }; | ||
| 1491 | |||
| 1492 | return 0 | ||
| 1493 | }; | ||
| 1494 | |||
| 1495 | |||
| 1496 | sub find_jnl_name { | ||
| 1497 | my $cite = shift; | ||
| 1498 | |||
| 1499 | return 1 if ($cite->{'title'}); | ||
| 1500 | return 0 if (! $cite->{'jnl_epos'}); | ||
| 1501 | |||
| 1502 | # Assumption: journal name usually starts after a ',;' | ||
| 1503 | # or " which is used to enclose the article title, | ||
| 1504 | # and does not contain those symbols (i.e. ,;") | ||
| 1505 | # | ||
| 1506 | my $Text = substr($cite->{'rest_text'}, 0, $cite->{'jnl_epos'}); | ||
| 1507 | my $Guess_jnl; | ||
| 1508 | |||
| 1509 | # Linden, N., et al. quantph/9711016 and Fortsch. Phys. 46, 567 (1998) | ||
| 1510 | #if ($Text =~ m{[^/]+/\w+\s*(.+)$}) { | ||
| 1511 | # $Text = $1 | ||
| 1512 | # }; | ||
| 1513 | |||
| 1514 | LOOP: | ||
| 1515 | # remove trailing symbols | ||
| 1516 | $Text =~ s/\s*[,;":\/\[\(]*\s*$//s; | ||
| 1517 | |||
| 1518 | # ignore anything in brackets (head/tail position) | ||
| 1519 | $Text =~ s/\W*\([^\)]+\)?\W*$//; | ||
| 1520 | $Text =~ s/^\s*\([^\)]+\)\W+//; | ||
| 1521 | |||
| 1522 | return 0 if ($Text eq ''); | ||
| 1523 | |||
| 1524 | # quite many citations are like this: | ||
| 1525 | # "P. Reiter, et al:Phys. Rev. Lett. 82 (1999) 509" | ||
| 1526 | # hard to separate name from journal title. Other cases | ||
| 1527 | # are: '..., J.PHY.G:NUCL.PART.PHY.'. Have to compramise. | ||
| 1528 | if ($Text =~ /([^,;":?\/\[]+)$/) { | ||
| 1529 | $Guess_jnl = $1; | ||
| 1530 | $Guess_jnl =~ s/^['`]?\s*//; | ||
| 1531 | $Guess_jnl =~ s/\s+$//; | ||
| 1532 | |||
| 1533 | # ignore things in brackets | ||
| 1534 | $Guess_jnl =~ s/\W*\([^\)]+\)?\W*$//; | ||
| 1535 | $Guess_jnl =~ s/^\([^\)]+\)\W*//; | ||
| 1536 | |||
| 1537 | # journal name should begin and contain alphabet, | ||
| 1538 | # not only numbers; and should be longer than one | ||
| 1539 | # character. First remove 'year' | ||
| 1540 | $Guess_jnl =~ s/^.*?\(?(19|20)\d\d\w*\)?\W*//; | ||
| 1541 | if ($Guess_jnl =~ /^[a-z]\W*$/i) { | ||
| 1542 | $Text =~ s/[^,;":?\/\[]+$//; | ||
| 1543 | goto LOOP | ||
| 1544 | }; | ||
| 1545 | |||
| 1546 | # No captital letters | ||
| 1547 | if ($Guess_jnl !~ /[A-Z]/) { | ||
| 1548 | $Text =~ s/[^,;":?\/\[]+$//; | ||
| 1549 | goto LOOP | ||
| 1550 | }; | ||
| 1551 | |||
| 1552 | # "Report of ... Conf.:1. Introduction. Canadian Medical Association Journal" | ||
| 1553 | if ($Guess_jnl !~ /^[a-z]+/i) { | ||
| 1554 | my @gWords = split(/\s+/, $Guess_jnl); | ||
| 1555 | |||
| 1556 | if (scalar(@gWords) <= 3) { | ||
| 1557 | $Text =~ s/[^,;":?\/]+$//; | ||
| 1558 | goto LOOP | ||
| 1559 | } | ||
| 1560 | }; | ||
| 1561 | |||
| 1562 | $Text = $Guess_jnl; | ||
| 1563 | } | ||
| 1564 | else { | ||
| 1565 | $Text =~ s/^[`']?\s*//; | ||
| 1566 | $Text =~ s/\s*$//; | ||
| 1567 | |||
| 1568 | # 'title' is after 'year' (other cases are dealt by | ||
| 1569 | # $cite->{'jnl_epos'} in 'find_vol_{no}_pg_year()'.. | ||
| 1570 | if ($Text =~ /[,\s\(]+(19|20)\d\d[,\s\)]+\s*/) { | ||
| 1571 | $Text = $' | ||
| 1572 | }; | ||
| 1573 | }; | ||
| 1574 | |||
| 1575 | my $end_dot = 0; | ||
| 1576 | $end_dot = 1 if ($Text =~ /\.$/); | ||
| 1577 | my @Title_words = (); | ||
| 1578 | my @Words = (); | ||
| 1579 | my $i = 0; | ||
| 1580 | |||
| 1581 | # process from the end of the $Text to see if | ||
| 1582 | # a $Parts[$i] is (still) a part of a journal name. | ||
| 1583 | my @Parts = split(/\s*\.\s*/, $Text); | ||
| 1584 | for ($i = $#Parts; $i>=0; $i--) { | ||
| 1585 | next if ($Parts[$i] !~ /[a-z]/i); | ||
| 1586 | |||
| 1587 | # author name may be mixed into the journal title | ||
| 1588 | # e.g. "Popescu S. and G. A. Sudbery. J. of Phy ..." | ||
| 1589 | if ($i > 0 and $Parts[$i-1] =~ /^([A-Z][a-z]* )*and\s+[A-Z]$/) { | ||
| 1590 | last | ||
| 1591 | }; | ||
| 1592 | if ($i > 1 and $Parts[$i-2] =~ /^([A-Z][a-z]* )*and\s+[A-Z]$/) { | ||
| 1593 | last if ($Parts[$i-1] =~ /^[A-Z]$/); | ||
| 1594 | }; | ||
| 1595 | |||
| 1596 | # author name may be mixed into the journal title | ||
| 1597 | # e.g. "and Sudbery A. Multi-particle ..." | ||
| 1598 | if ($i > 0 and $Parts[$i] =~ /^[A-Z]$/) { | ||
| 1599 | # less than 4 words. | ||
| 1600 | if ($Parts[$i-1] =~ /^\S+\s+\S+(\s+\S+){0,2}$/ and | ||
| 1601 | $Parts[$i-1] =~ /^(and )?[A-Z].+?[A-Z]$/){ | ||
| 1602 | last | ||
| 1603 | } | ||
| 1604 | }; | ||
| 1605 | |||
| 1606 | push(@Title_words, $Parts[$i]); | ||
| 1607 | last if $i == 0; # necessary test | ||
| 1608 | |||
| 1609 | last if ($Parts[$i-1] =~ /et\s+al$/i); | ||
| 1610 | last if ($Parts[$i-1] =~ /^\s*\d+$/); | ||
| 1611 | |||
| 1612 | @Words = split(/\s+/, $Parts[$i-1]); | ||
| 1613 | # stop if more than 4 words in $Parts[$i-1], | ||
| 1614 | # i.e. $Parts[$i-1] seems to contain article title, | ||
| 1615 | # not the journal name. However, be aware of: | ||
| 1616 | # "... method for propagating interfaces J. Comput. Phys." | ||
| 1617 | # next if (scalar(@Words) <= 2 and | ||
| 1618 | next if (scalar(@Words) <= 2 and $Parts[$i-1] !~ /^\d/); | ||
| 1619 | |||
| 1620 | if (scalar(@Words) <= 4 and | ||
| 1621 | $Parts[$i-1] =~ /^([A-Z][a-z]*\s+){0,3}[A-Z][a-z]*$/){ | ||
| 1622 | next | ||
| 1623 | }; | ||
| 1624 | |||
| 1625 | my $w = pop(@Words); | ||
| 1626 | # if ($w =~ /^[A-Z]$/ or $w =~ /^[A-Z][a-z]+$/) { | ||
| 1627 | if ($w =~ /^J$/ or $w =~ /^[A-Z][a-z]+$/) { | ||
| 1628 | push(@Title_words, $w) | ||
| 1629 | }; | ||
| 1630 | |||
| 1631 | last | ||
| 1632 | }; | ||
| 1633 | if (scalar(@Title_words) == 1) { | ||
| 1634 | $cite->{'title'} = $Title_words[0] | ||
| 1635 | } | ||
| 1636 | else { | ||
| 1637 | my @Title_words_real = reverse(@Title_words); | ||
| 1638 | $cite->{'title'} = join('.', @Title_words_real); | ||
| 1639 | }; | ||
| 1640 | |||
| 1641 | $cite->{'title'} = "$cite->{'title'}\." if ($end_dot == 1); | ||
| 1642 | |||
| 1643 | # normalise it | ||
| 1644 | $cite->{'title'} = normalise_journal($cite->{'title'}); | ||
| 1645 | return 1 | ||
| 1646 | }; | ||
| 1647 | |||
| 1648 | |||
| 1649 | |||
| 1650 | sub full_name { | ||
| 1651 | my $Text = shift; | ||
| 1652 | |||
| 1653 | $Text =~ s/(^|s*)Jr[. ]//i; | ||
| 1654 | |||
| 1655 | return 1 if ($Text =~ /^\s*et al\s*$/i); | ||
| 1656 | |||
| 1657 | return 0 if ($Text =~/^in /i); | ||
| 1658 | return 0 if ($Text !~ /[A-Z]/); # no upper case letter | ||
| 1659 | return 0 if ($Text =~ /\d+/); # $Text contains title. | ||
| 1660 | return 0 if ($Text =~ / (e-print|archive)s? /i); | ||
| 1661 | return 0 if ($Text =~ /\b(Collaboration|Review)\b/i); | ||
| 1662 | |||
| 1663 | my $wCount = word_count($Text); | ||
| 1664 | return 0 if $wCount > 4; | ||
| 1665 | |||
| 1666 | # "van Albada" or "van den Bergh" (surname only) | ||
| 1667 | return 0 if ($Text =~ /^((von|van|de|den|der)\s+)+\S\S+\s*$/i); | ||
| 1668 | # "van Buren D" | ||
| 1669 | return 1 if ($Text =~ /^(von|van|de|den|der)\s+\S\S+\s+([a-z]+\s*)+$/i); | ||
| 1670 | # (journal name) | ||
| 1671 | return 0 if ($Text =~ /\b(Phy\.|Physics|Journal|The)\b/i); | ||
| 1672 | # "J. Mod. Phys. D"; "Prog.Theor.Phys." | ||
| 1673 | return 0 if ($Text =~ /^([a-z]+\.\s*)+[a-z]?\s*$/i); | ||
| 1674 | # "Phys Rev A" | ||
| 1675 | # return 0 if ($Text =~ /^([a-z][a-z]+(\.| )){2,}[a-z]\.?\s*$/i); | ||
| 1676 | my @Abbr = (); | ||
| 1677 | # "Class. Quantum Grav." | ||
| 1678 | return 0 if (@Abbr = ($Text =~ /\S\S+?\./g) and | ||
| 1679 | scalar(@Abbr) >1); | ||
| 1680 | # "Nuovo Cim. B 44, 1 (1966)." | ||
| 1681 | return 0 if ($Text =~ /\w\w\w+\./); | ||
| 1682 | |||
| 1683 | # 'W. B. Burton', 'Burton W. B.', 'W B Burton', etc. | ||
| 1684 | if (has_surname($Text) and | ||
| 1685 | has_initials($Text) and | ||
| 1686 | $wCount >= 1 and | ||
| 1687 | $wCount < 5 ) { | ||
| 1688 | return 1 | ||
| 1689 | }; | ||
| 1690 | |||
| 1691 | # 'Vivek Agrawal', 'Liu Xin' types; hard to distinguish | ||
| 1692 | # surname/firstname. | ||
| 1693 | if ($wCount >= 2 and | ||
| 1694 | $wCount <= 3 and | ||
| 1695 | no_initials($Text)) { | ||
| 1696 | return 1 | ||
| 1697 | }; | ||
| 1698 | |||
| 1699 | return 0 | ||
| 1700 | }; | ||
| 1701 | |||
| 1702 | sub no_initials { | ||
| 1703 | my $Text = shift; | ||
| 1704 | |||
| 1705 | # do not count 'Jr.' | ||
| 1706 | $Text =~ s/(\W)Jr\.?\s*$/$1/i; | ||
| 1707 | return 0 if ($Text =~ /(^| )[a-z]\./i); | ||
| 1708 | return 0 if ($Text =~ /(^| )[a-z]( |$)/i); | ||
| 1709 | |||
| 1710 | return 1; | ||
| 1711 | }; | ||
| 1712 | |||
| 1713 | sub only_initials { | ||
| 1714 | my $Text = shift; | ||
| 1715 | |||
| 1716 | return 0 if ($Text =~ /^[a-z]{2,} /i); | ||
| 1717 | return 0 if ($Text =~ /\.?\s*[a-z][a-z]+$/i); | ||
| 1718 | |||
| 1719 | my @Words = split(/[\.\s]/, $Text); | ||
| 1720 | my $Word; | ||
| 1721 | foreach $Word (@Words) { return 0 if (length($Word) >= 2)}; | ||
| 1722 | |||
| 1723 | return 1 | ||
| 1724 | }; | ||
| 1725 | |||
| 1726 | sub is_surname { | ||
| 1727 | my ($Text) = @_; | ||
| 1728 | $Text =~ s/ Jr\W+$//i; | ||
| 1729 | |||
| 1730 | return 0 if ($Text =~ / (e-print|archive)s? /i); | ||
| 1731 | return 0 if ($Text =~ /\bCollaboration\b/i); | ||
| 1732 | |||
| 1733 | return 1 if ($Text =~ /^(\s*[a-z][\-'a-z]+){1,3}$/i); | ||
| 1734 | # return 1 if ($Text =~ /^\s*[a-z]+[\-'a-z]+\s*$/i); | ||
| 1735 | |||
| 1736 | return 0 | ||
| 1737 | } | ||
| 1738 | |||
| 1739 | sub has_surname { | ||
| 1740 | my $Text = unidecode(shift); | ||
| 1741 | |||
| 1742 | return 0 if ($Text =~ /\d+/); | ||
| 1743 | return 1 if ($Text =~ /^[a-z]{2,}[\s\-\']/i); | ||
| 1744 | # return 1 if ($Text =~ /[a-z]{2,}$/i); | ||
| 1745 | return 1 if ($Text =~ /[\-\'\s.][a-z][a-z]+(\s+Jr\.?)?\s*$/i); | ||
| 1746 | return 0 | ||
| 1747 | } | ||
| 1748 | |||
| 1749 | sub has_initials { | ||
| 1750 | my $Text = unidecode(shift); | ||
| 1751 | |||
| 1752 | return 0 if ($Text =~ /\d+/); | ||
| 1753 | return 1 if ($Text =~ /^\s*[']?\s*[A-Z](\s|\.|$)/); | ||
| 1754 | return 1 if ($Text =~ /(^|\s|\.)[a-z](\s|\.|$)/i); | ||
| 1755 | |||
| 1756 | return 0 | ||
| 1757 | } | ||
| 1758 | |||
| 1759 | # mainly used to count 'words' in author names | ||
| 1760 | sub word_count { | ||
| 1761 | my ($Text) = @_; | ||
| 1762 | |||
| 1763 | #$Text =~ s/^[\s.]+//; | ||
| 1764 | #my @Words = split(/[\s.]+/, $Text); | ||
| 1765 | # return scalar(@Words); | ||
| 1766 | |||
| 1767 | $Text =~ s/ (von|van|de|den|der) //g; | ||
| 1768 | $Text =~ s/^\s+//; | ||
| 1769 | $Text =~ s/\s+$//; | ||
| 1770 | my @Words_all = split(/\s+/, $Text); | ||
| 1771 | # ignore initials in names. | ||
| 1772 | # e.g. "C.A.R. Sa de Melo" is a name | ||
| 1773 | my @Words; | ||
| 1774 | my $W; | ||
| 1775 | while (@Words_all) { | ||
| 1776 | $W = shift @Words_all; | ||
| 1777 | push(@Words, $W) if ($W !~ /^[a-z]\.?$/i); | ||
| 1778 | }; | ||
| 1779 | return scalar(@Words); | ||
| 1780 | }; | ||
| 1781 | # | ||
| 1782 | # Normalisation utilities | ||
| 1783 | # | ||
| 1784 | sub normalisation_old { | ||
| 1785 | die; | ||
| 1786 | my($Text) = @_; | ||
| 1787 | # replace embedded '\n' with ' ' | ||
| 1788 | $Text =~ s/^\s+//s; | ||
| 1789 | $Text =~ s/\s+$//s; | ||
| 1790 | while ($Text =~ /.+?\n.+?/sg) { | ||
| 1791 | $Text =~ s/(.+?)\n(.+?)/$1 $2/s | ||
| 1792 | }; | ||
| 1793 | $Text =~ s/\s*-\s*/-/g; # remove space around '-' | ||
| 1794 | $Text =~ s/\s*'\s*/'/g; # remove space around ' | ||
| 1795 | $Text =~ s/\s*:\s*/:/g; # remove space around : | ||
| 1796 | $Text =~ s/\(\s+/\(/g; # ( 1998) ==> (1998) | ||
| 1797 | $Text =~ s/\s+\)/\)/g; # (1998 ) ==> (1998) | ||
| 1798 | while ($Text =~/--/g) {$Text =~ s/--/-/}; # use single '-'. | ||
| 1799 | $Text =~ s/~//g; # remove '~' (e.g. C.~B.~Hanna) | ||
| 1800 | $Text =~ s/\s+/ /g; # use single space; | ||
| 1801 | $Text =~ s/[,;\s]+$//; # remove last ',;\s' on a line | ||
| 1802 | # 'Nr.' caused error in 'find_jnl_name', i.e. it became as | ||
| 1803 | # 'journal name' if not removed. (see: arXiv:quant-ph/9905016) | ||
| 1804 | $Text =~ s/([,;])\s*Nr\.\s*(\d+[,;])/$1$2/i; | ||
| 1805 | # "[12] For example, R. Machleidt, ...Phys. Rep. 149, 1 (1987) | ||
| 1806 | $Text =~ s/^([^a-z]+)for example\W+/$1/i; | ||
| 1807 | # '[18] *** G. Do Dang, ... (arXiv:nucl-th/9911081) | ||
| 1808 | $Text =~ s/\*+//g; | ||
| 1809 | # Phys. Rev. D56 => Phys. Rev. D. 56 | ||
| 1810 | $Text =~ s/phys.{1,6}rev.{1,6}([a-z])(\d+)/Phys. Rev. $1 $2/ig; | ||
| 1811 | return $Text; | ||
| 1812 | }; | ||
| 1813 | |||
| 1814 | sub normalise_html_old { | ||
| 1815 | die; | ||
| 1816 | my($Text) = @_; | ||
| 1817 | |||
| 1818 | # remove <BR> tag | ||
| 1819 | $Text =~ s/<BR>//ig; | ||
| 1820 | $Text =~ s/&(\w)acute[;,]/$1/g; # a ' on top of (\w) | ||
| 1821 | $Text =~ s/&(\w)cedil[;,]/$1/g; # a 'tail' under (\w), e.g Francios | ||
| 1822 | $Text =~ s/&(\w)grave[;,]/$1/g; # a ` on top of (\w) | ||
| 1823 | $Text =~ s/&(\w)tilde[;,]/$1/g; | ||
| 1824 | $Text =~ s/&(\w)uml[;,]/$1e/g; # a '..' on top of (\w) | ||
| 1825 | $Text =~ s/&(\w)slash[;,]/$1/g; | ||
| 1826 | #$Text =~ s/&#-88;(\w)/$1/g; # as &(\w)uml (see astro-ph/9811179) | ||
| 1827 | $Text =~ s/&#-\d+;\s*(\w)/$1/g; | ||
| 1828 | $Text =~ s/ß[;,]/ss/g; | ||
| 1829 | $Text =~ s/&[;,]/ and /g; | ||
| 1830 | $Text =~ s/\s*(\w)/$1/g; # a ~ on top of (\w) | ||
| 1831 | $Text =~ s/\/?i>//g; # cogprints | ||
| 1832 | $Text =~ s/&[a-z]+;//g; # otherwise ';' cause ref line break. | ||
| 1833 | $Text =~ s/&#\d+;//g; # e.g. '' in 'hep-th/0001001 [99]'. | ||
| 1834 | $Text =~ s/\\"(\w)/$1e/g; # G\"unter => Gueter | ||
| 1835 | |||
| 1836 | $Text =~ s/\^//g; # remove ^ | ||
| 1837 | $Text =~ s/([A-Z])\s*&\s*([A-Z])/$1 and $2/g; # replace '&' with 'and' | ||
| 1838 | # remove HTML markups (<b></b><i></i> etc.) | ||
| 1839 | $Text =~ s/<[a-z\/]{1,3}>//ig; | ||
| 1840 | return $Text | ||
| 1841 | }; | ||
| 1842 | |||
| 1843 | |||
| 1844 | sub normalise_name { | ||
| 1845 | my($Text) = @_; | ||
| 1846 | my $Suffix = ''; | ||
| 1847 | $Text =~ s/~//; # remove typo | ||
| 1848 | # Jr. | ||
| 1849 | if ($Text =~ s/[, \.]+(Jr|Sr|Snr)\.?\s*$//i){ | ||
| 1850 | $Suffix = $1 | ||
| 1851 | } | ||
| 1852 | elsif ($Text =~ s/([, \.]+)(Jr|Sr|Snr)[. ]/$1/i){ | ||
| 1853 | $Suffix = $2 | ||
| 1854 | }; | ||
| 1855 | |||
| 1856 | # van der Buren D => D van der Buren" | ||
| 1857 | if ($Text =~ /^\s*(((van|von|de|den|der)\s+)+)(\S\S+)\s+(.+)/i) { | ||
| 1858 | $Text = "$5 $1 $4" | ||
| 1859 | }; | ||
| 1860 | $Text =~ s/\s+/ /g; # single space | ||
| 1861 | $Text =~ s/^\W+//; | ||
| 1862 | $Text =~ s/\s+$//; | ||
| 1863 | # "A. Smith" => "A.Smith" | ||
| 1864 | $Text =~ s/(\w)\.\s+/\U$1\./ig; | ||
| 1865 | # Ghisellini G. A. ==> G.A. Ghisellini | ||
| 1866 | # Konenkov D. Yu. => D.Yu. Konenkov | ||
| 1867 | if ($Text =~ /^([^\s.]{2,})\s+(([A-Z][\w]?\W+)*)([A-Z][\w]?)\W*$/) { | ||
| 1868 | $Text = "$2$4 $1" | ||
| 1869 | }; | ||
| 1870 | |||
| 1871 | $Text = "$Text $Suffix" if ($Suffix); | ||
| 1872 | $Text = tdb_normalise_name($Text); | ||
| 1873 | return $Text; | ||
| 1874 | }; | ||
| 1875 | |||
| 1876 | |||
| 1877 | # Based on Tim's Authors::splitauthors and Authors::_cmonauthor(); | ||
| 1878 | # This subroutine is called simply because we want the author names | ||
| 1879 | # to be transformed to a same style used by Tim's programs. Otherwise | ||
| 1880 | # a join on author names in Publication and Reference tables will | ||
| 1881 | # miss a lot of targets. | ||
| 1882 | sub tdb_normalise_name{ | ||
| 1883 | my $author = shift; | ||
| 1884 | |||
| 1885 | # Strip any brackets | ||
| 1886 | $author =~ s/\s*\([^\)]*\)\s*//g; | ||
| 1887 | # Get rid of any dashes (except for dashes like Hu-Su) | ||
| 1888 | $author =~ s/(\W)-/$1/g; | ||
| 1889 | # Remove any "the"s, e.g. The OPAL Collaboration | ||
| 1890 | $author =~ s/\bthe\s+//ig; | ||
| 1891 | # Sort out Jr/Jr. | ||
| 1892 | $author =~ s/,?\sJr\.?/_Jr/ig; | ||
| 1893 | |||
| 1894 | $author =~ s/[\{\}]//g; # Remove any specialisations | ||
| 1895 | $author =~ s/\\.//g; # Remove any escapes | ||
| 1896 | # Convert Convert Hawking S. to S.Hawking (already done - zj) | ||
| 1897 | # ($author =~ /(\w\w+)\s+([\.\w\s]+\.)$/) && ($author = $2.$1); | ||
| 1898 | $author =~ s/\.\s/\./g; # Convert S.W. Hawking to S.W.Hawking | ||
| 1899 | $author =~ s/([A-Z])\s/$1\./g; # Convert S W Hawking to S.W.Hawking | ||
| 1900 | # Can't handle case reliably in international character sets | ||
| 1901 | # $author = lc($author); | ||
| 1902 | # $author =~ s/\b(\w)/\U$1/g; | ||
| 1903 | # Convert STEPHEN_HAWKING to Stephen_Hawking | ||
| 1904 | $author =~ s/\s/_/g; # Convert Stephen W.Hawking to Stephen_W.Hawking | ||
| 1905 | $author =~ s/\.\.+/\./g; # Remove double dots | ||
| 1906 | return $author; | ||
| 1907 | } | ||
| 1908 | |||
| 1909 | sub normalise_date { | ||
| 1910 | my($Text) = @_; | ||
| 1911 | |||
| 1912 | # 12-14 Dec. | ||
| 1913 | $Text =~ s/[^\w\/][0-3][0-9]?[a-z]*?(\s*\-\s*[0-3][0-9]?[a-z]*?)?\s+ | ||
| 1914 | (Jan[\.\s]|January\b|Feb[\.\s]|February\b| | ||
| 1915 | Mar[\.\s]|March\b|Apr[\.\s]|April\b|May| | ||
| 1916 | Jun[\.\s]|June\b|Jul[\.\s]|July\b|Aug[\.\s]|August\b| | ||
| 1917 | Sep[\.\s]|September\b|Oct[\.\s]|October\b| | ||
| 1918 | Nov[\.\s]|November\b|Dec[\.\s]|December\b)//xig; | ||
| 1919 | |||
| 1920 | # Dec 12-14 | ||
| 1921 | $Text =~ s/(Jan[\.\s]|January\b|Feb[\.\s]|February\b| | ||
| 1922 | Mar[\.\s]|March\b|Apr[\.\s]|April\b|May| | ||
| 1923 | Jun[\.\s]|June\b|Jul[\.\s]|July\b|Aug[\.\s]|August\b| | ||
| 1924 | Sep[\.\s]|September\b|Oct[\.\s]|October\b| | ||
| 1925 | Nov[\.\s]|November\b|Dec[\.\s]|December\b) | ||
| 1926 | [^\w\/]*[0-3][0-9]?[a-z]*?(\s*\-\s*[0-3][0-9]?[a-z]*?)?\b//xig; | ||
| 1927 | |||
| 1928 | return $Text; | ||
| 1929 | }; | ||
| 1930 | |||
| 1931 | |||
| 1932 | sub normalise_journal { | ||
| 1933 | my($Text) = @_; | ||
| 1934 | $Text =~ s/^in\s+//i; # "in ..." | ||
| 1935 | $Text =~ s/^(see )?also\s+//i; # "also ..."; | ||
| 1936 | $Text =~ s/\s*:\s*/:/g; | ||
| 1937 | $Text =~ s/\s\s/ /g; # single space; | ||
| 1938 | $Text =~ s/\.\s/\./g; # "J. Physics" => "J.Physics" | ||
| 1939 | $Text =~ s/\.\(/\. \(/g; | ||
| 1940 | |||
| 1941 | $Text =~ s/^\W+//; | ||
| 1942 | $Text =~ s/[^\w.]+$//; | ||
| 1943 | |||
| 1944 | # remove anything in brackets at the end. | ||
| 1945 | $Text =~ s/\s*\([^)]+$//; # e.g. R. Ram, J. Phys. (Paris | ||
| 1946 | $Text =~ s/^[^(]+\)\s*//; # e.g. a) R. Ram, J. Phys. 10, 120, 1998 | ||
| 1947 | |||
| 1948 | # unify cases | ||
| 1949 | #($Text = lc($Text)) && ($Text =~ s/\b(\w)/\U$1/g); | ||
| 1950 | $Text = uc($Text); | ||
| 1951 | return $Text; | ||
| 1952 | }; | ||
| 1953 | |||
| 1954 | |||
| 1955 | sub num_of_figures { | ||
| 1956 | my($Text) = @_; | ||
| 1957 | my($N, @Nlist); | ||
| 1958 | $N = 0; | ||
| 1959 | @Nlist =(); | ||
| 1960 | |||
| 1961 | $Text = normalisation($Text); | ||
| 1962 | # e.g. "p. 24-26" regarded as one number. | ||
| 1963 | # ignore 'N = 2' kind of equations, and | ||
| 1964 | # ignore '25th' kinds (e.g. Proc. 25th ICRC). | ||
| 1965 | # ignore 'protein Aquaporin-1 in ...' | ||
| 1966 | # ignore 'hep-th/9901001' | ||
| 1967 | # ignore ' ... 1.55, ...' | ||
| 1968 | while ($Text =~ /(?:^|\b)[a-z]*(\d+)([a-z]*) | ||
| 1969 | (?:-[a-z]*\d+[a-z]*)* | ||
| 1970 | (?:\b|$)/gix) { | ||
| 1971 | next if ($2 =~ /^th$/i); | ||
| 1972 | next if ($' =~ /^\.\d+/); | ||
| 1973 | next if ($` =~ /\d+\.$/); | ||
| 1974 | next if ($` =~ /[=<>\/-]\s*$/); | ||
| 1975 | push(@Nlist, $1); | ||
| 1976 | } | ||
| 1977 | $N = scalar(@Nlist); | ||
| 1978 | return $N | ||
| 1979 | } | ||
| 1980 | |||
| 1981 | |||
| 1982 | sub remove_extra_spc { | ||
| 1983 | my($Text) = @_; | ||
| 1984 | $Text =~ s/^\s+//; | ||
| 1985 | $Text =~ s/\s+$//; | ||
| 1986 | $Text =~ s/\s\s/ /g; | ||
| 1987 | return $Text | ||
| 1988 | }; | ||
| 1989 | |||
| 1990 | # | ||
| 1991 | # To assist accessing of the citation meta data. | ||
| 1992 | # | ||
| 1993 | sub srcText { | ||
| 1994 | my $cite = shift; | ||
| 1995 | return $cite->{'text'}; | ||
| 1996 | } | ||
| 1997 | |||
| 1998 | sub targetIdentifier { | ||
| 1999 | return $_[0]->{'targetID'}; | ||
| 2000 | } | ||
| 2001 | |||
| 2002 | sub targetURL { | ||
| 2003 | return $_[0]->{'targetURL'}; | ||
| 2004 | } | ||
| 2005 | |||
| 2006 | sub authors { | ||
| 2007 | return $_[0]->{'authors'}; | ||
| 2008 | } | ||
| 2009 | |||
| 2010 | sub list_authors { | ||
| 2011 | my $cite = shift; | ||
| 2012 | return $cite->{'authors'} | ||
| 2013 | } | ||
| 2014 | |||
| 2015 | sub aufull { | ||
| 2016 | return $_[0]->{'aufull'}; | ||
| 2017 | } | ||
| 2018 | |||
| 2019 | sub first_author { | ||
| 2020 | my $cite = shift; | ||
| 2021 | return $cite->{'aufull'}; | ||
| 2022 | } | ||
| 2023 | |||
| 2024 | sub aulast { | ||
| 2025 | my $cite = shift; | ||
| 2026 | return $cite->{'aulast'}; | ||
| 2027 | } | ||
| 2028 | |||
| 2029 | sub aufirst { | ||
| 2030 | my $cite = shift; | ||
| 2031 | return $cite->{'aufirst'}; | ||
| 2032 | } | ||
| 2033 | |||
| 2034 | sub auinit { | ||
| 2035 | my $cite = shift; | ||
| 2036 | return $cite->{'auinit'}; | ||
| 2037 | } | ||
| 2038 | |||
| 2039 | # journal title | ||
| 2040 | sub title { | ||
| 2041 | my $cite = shift; | ||
| 2042 | return $cite->{'title'}; | ||
| 2043 | } | ||
| 2044 | |||
| 2045 | # article title | ||
| 2046 | sub atitle { | ||
| 2047 | my $cite = shift; | ||
| 2048 | return $cite->{'atitle'}; | ||
| 2049 | } | ||
| 2050 | |||
| 2051 | sub volume { | ||
| 2052 | my $cite = shift; | ||
| 2053 | return $cite->{'volume'}; | ||
| 2054 | } | ||
| 2055 | |||
| 2056 | sub issue { | ||
| 2057 | my $cite = shift; | ||
| 2058 | return $cite->{'issue'}; | ||
| 2059 | } | ||
| 2060 | |||
| 2061 | sub supplement { | ||
| 2062 | my $cite = shift; | ||
| 2063 | return $cite->{'supl'}; | ||
| 2064 | } | ||
| 2065 | |||
| 2066 | sub year { | ||
| 2067 | my $cite = shift; | ||
| 2068 | return $cite->{'year'}; | ||
| 2069 | } | ||
| 2070 | |||
| 2071 | sub startpage { | ||
| 2072 | my $cite = shift; | ||
| 2073 | return $cite->{'spage'}; | ||
| 2074 | } | ||
| 2075 | |||
| 2076 | sub endpage { | ||
| 2077 | return $_[0]->{'epage'}; | ||
| 2078 | } | ||
| 2079 | |||
| 2080 | sub journal { | ||
| 2081 | my $cite = shift; | ||
| 2082 | return $cite->{'title'}; | ||
| 2083 | } | ||
| 2084 | |||
| 2085 | sub featureID { | ||
| 2086 | my $cite = shift; | ||
| 2087 | return $cite->{'featureID'} | ||
| 2088 | } | ||
| 2089 | |||
| 2090 | |||
| 2091 | sub mysql_load_file { | ||
| 2092 | my $cite = shift; | ||
| 2093 | |||
| 2094 | my $tm = localtime; | ||
| 2095 | my ($year,$mon,$mday); | ||
| 2096 | $year = $tm->year + 1900; | ||
| 2097 | $mon = $tm->mon + 1; | ||
| 2098 | $mday = $tm->mday; | ||
| 2099 | my $TimeStamp = $year.'-'.$mon.'-'.$mday; | ||
| 2100 | $cite->{'date'} = $TimeStamp; | ||
| 2101 | |||
| 2102 | print "$cite->{'date'}\t"; | ||
| 2103 | print "$cite->{'sourceID'}\t"; | ||
| 2104 | |||
| 2105 | ($cite->{'featureID'}) ? print "$cite->{'featureID'}\t" | ||
| 2106 | : print "\\N\t"; | ||
| 2107 | |||
| 2108 | ($cite->{'targetID'}) ? print "$cite->{'targetID'}\t" | ||
| 2109 | : print "\\N\t"; | ||
| 2110 | |||
| 2111 | ($cite->{refID}) ? print "$cite->{refID}\t" | ||
| 2112 | : print "\\N\t"; | ||
| 2113 | |||
| 2114 | ($cite->{'targetURL'}) ? print "$cite->{'targetURL'}\t" | ||
| 2115 | : print "\\N\t"; | ||
| 2116 | |||
| 2117 | ($cite->{'text'}) ? print "$cite->{'text'}\t" | ||
| 2118 | : print "\\N\t"; | ||
| 2119 | |||
| 2120 | ($cite->{'aufull'}) ? print "$cite->{'aufull'}\t" | ||
| 2121 | : print "\\N\t"; | ||
| 2122 | |||
| 2123 | ($cite->{'aulast'}) ? print "$cite->{'aulast'}\t" | ||
| 2124 | : print "\\N\t"; | ||
| 2125 | |||
| 2126 | ($cite->{'aufirst'}) ? print "$cite->{'aufirst'}\t" | ||
| 2127 | : print "\\N\t"; | ||
| 2128 | |||
| 2129 | ($cite->{'auinit'}) ? print "$cite->{'auinit'}\t" | ||
| 2130 | : print "\\N\t"; | ||
| 2131 | |||
| 2132 | ($cite->{'atitle'}) ? print "$cite->{'atitle'}\t" | ||
| 2133 | : print "\\N\t"; | ||
| 2134 | |||
| 2135 | ($cite->{'title'}) ? print "$cite->{'title'}\t" | ||
| 2136 | : print "\\N\t"; | ||
| 2137 | |||
| 2138 | ($cite->{'volume'}) ? print "$cite->{'volume'}\t" | ||
| 2139 | : print "\\N\t"; | ||
| 2140 | |||
| 2141 | ($cite->{'issue'}) ? print "$cite->{'issue'}\t" | ||
| 2142 | : print "\\N\t"; | ||
| 2143 | |||
| 2144 | ($cite->{'supl'}) ? print "$cite->{'supl'}\t" | ||
| 2145 | : print "\\N\t"; | ||
| 2146 | |||
| 2147 | ($cite->{'spage'}) ? print "$cite->{'spage'}\t" | ||
| 2148 | : print "\\N\t"; | ||
| 2149 | |||
| 2150 | ($cite->{'year'}) ? print "$cite->{'year'}" | ||
| 2151 | : print "\\N"; | ||
| 2152 | print "\n"; | ||
| 2153 | } | ||
| 2154 | |||
| 2155 | sub print_out { | ||
| 2156 | my $cite = shift; | ||
| 2157 | return if (!defined($cite->{'text'})); | ||
| 2158 | print '-'x70,"\n"; | ||
| 2159 | print "$cite->{'text'} \n", '-'x70, "\n"; | ||
| 2160 | print "sourceID: \t$cite->{'sourceID'}\n" if ($cite->{'sourceID'}); | ||
| 2161 | print "Authors: \t$cite->{'authors'}\n" if ($cite->{'authors'}); | ||
| 2162 | print "First Author: \t$cite->{'aufull'}\n" if ($cite->{'aufull'}); | ||
| 2163 | print "Article title:\t$cite->{'atitle'}\n" if ($cite->{'atitle'}); | ||
| 2164 | print "Journal: \t$cite->{'title'}\n" if ($cite->{'title'}); | ||
| 2165 | print "Volume: \t$cite->{'volume'}\n" if ($cite->{'volume'}); | ||
| 2166 | print "Issue: \t$cite->{'issue'} \n" if ($cite->{'issue'}); | ||
| 2167 | print "Supplement: \t$cite->{'supl'} \n" if ($cite->{'supl'}); | ||
| 2168 | print "Start Page: \t$cite->{'spage'}\n" if ($cite->{'spage'}); | ||
| 2169 | print "Year: \t\t$cite->{'year'}\n" if ($cite->{'year'}); | ||
| 2170 | print "targetURL: \t$cite->{'targetURL'}\n" if ($cite->{'targetURL'}); | ||
| 2171 | print "featureID: \t$cite->{'featureID'}\n" if ($cite->{'featureID'}); | ||
| 2172 | print "targetID: \t$cite->{'targetID'}\n" if ($cite->{'targetID'}); | ||
| 2173 | }; | ||
| 2174 | |||
| 2175 | 1; | ||
| 2176 |