#!/usr/bin/perl ##################################################################### # Expand journal name abbreviations to the correspond full names # # # # After you have run bibtex on your (la)TeX file, click on # # "Expand Journals!", go to the directory where your (la)TeX # # file is located, and select the .bib file for your (la)TeX file. # # Doesn't work on Macs since it uses a Tk interface. # ##################################################################### ########################################################## # (c) Ansgar Endress # # ansgarPLACEDOTHEREendressPLACEATHEREm4xPLACEDOTHEREorg # # # # Last update: 09/23/2009 # ########################################################## #use strict; use Tk; use LWP::Simple; our %names = ( # Here you can add your own journal abbreviations # Don't forget the comma at the end of each line "Acta Psychol (Amst)" => "Acta Psychologica", "Acta Psychol" => "Acta Psychologica", "Am J Primatol" => "American Journal of Primatology ", "Am Psychol" => "American Psychologist", "Amer Sci" => "American Scientist", "An Rev Appl Ling" => "Annual Review of Applied Linguistics", "Ann Rev Appl Ling" => "Annual Review of Applied Linguistics", "Anim Behav" => "Animal Behaviour", "Anim Cogn" => "Animal Cognition", "Anim Learn Behav" => "Animal Learning and Behavior", "Ann N Y Acad Sci" => "Annals of the New York Academy of Sciences", "Ann Rev Lang Acqu" => "Annual Review of Language Acquisition", "Annu Rev Cell Dev Biol" => "Annual Review of Cell and Developmental Biology", "Annu Rev Neurosci" => "Annual Review of Neuroscience", "Annu Rev Psychol" => "Annual Review of Psychology", "App Cognit Psychol" => "Applied Cognitive Psychology", "App Psycholing" => "Applied Psycholinguistics", "Appl Psycholing" => "Applied Psycholinguistics", "Arch Psychol" => "Archiv f\"ur Psychologie", "Auton Robots" => "Autonomous Robots", "Behav Brain Res" => "Behavioural Brain Research", "Behav Brain Sci" => "Behavioral and Brain Sciences", "Behav Processes" => "Behavioural Processes", "Behav Res Meth Instr C" => "Behavior Research Methods, Instruments, and Computers", "Behav Res Meth Instr Comp" => "Behavior Research Methods, Instruments, and Computers", "Behav Res Methods Instrum Comput" => "Behavior Research Methods, Instruments, and Computers", "Biol Cybern" => "Biological Cybernetics", "Biol Lett" => "Biology Letters", "Br J Psychol" => "British Journal of Psychology", "Brain Behav Evol" => "Brain, Behavior and Evolution", "Brain Lang" => "Brain and Language", "Brain Res Cogn Brain Res" => "Brain Research. Cognitive Brain Research", "Brain Res" => "Brain Research", "Brit J Phil Sci" => "British Journal for the Philosophy of Science", "Brit Jl Psychol" => "British Journal of Psychology", "Bull Psychon Soc" => "Bulletin of the Psychonomic Society", "Can J Psychol" => "Canadian Journal of Psychology", "Cereb Cortex" => "Cerebral Cortex", "Child Dev" => "Child Development", "Child Devel" => "Child Development", "Clin Neurophysiol" => "Clinical Neurophysiology", "Clin Neurosci" => "Clinical Neuroscience", "Cogn Dev" => "Cognitive Development", "Cogn Devel" => "Cognitive Development", "Cognit Devel" => "Cognitive Development", "Cognit Neuropsychol" => "Cognitive Neuropsychology", "Cogn Psychol" => "Cognitive Psychology", "Cognit Psychol" => "Cognitive Psychology", "Cognit Sci" => "Cognitive Science", "Comm ACM" => "Communications of the Association for Computing Machinery", "Comput. Linguist." => "Computational Linguistics", "Comput Linguist" => "Computational Linguistics", "Curr Biol" => "Current Biology", "Curr Dir Psycho Sci" => "Current Directions in Psychological Science", "Curr Opin Neurobiol" => "Current Opinion in Neurobiology", "Dev Pschol" => "Developmental Psychology", "Dev Psychol" => "Developmental Psychology", "Dev Sci" => "Developmental Science", "Electroencephalogr Clin Neurophysiol" => "Electroencephalography and Clinical Neurophysiology", "Eur J Neurosci" => "European Journal of Neuroscience", "Exp Brain Res" => "Experimental Brain Research", "Exp Psychol" => "Experimental Psychology", "Hear Res" => "Hearing Research", "Hum Neurobiol" => "Human Neurobiology", "IEEE Trans Neural Syst Rehabil Eng" => "IEEE Transactions on Neural Systems and Rehabilitation Engineering", "Inform Contr" => "Information and Control", "Inform Control" => "Information and Control", "Int J Neurosci" => "International Journal of Neuroscience", "J Assoc Res Otolaryngol" => "Journal of the Association for Research in Otolaryngology", "J Acoust Soc Am" => "Journal of the Acoustical Society of America", "J Biosci" => "Journal of Biosciences", "J Child Lang" => "Journal of Child Language", "J Clin Neurophysiol" => "Journal of Clinical Neurophysiology", "J Cogn Neurosci" => "Journal of Cognitive Neuroscience", "J Cognit Neurosci" => "Journal of Cognitive Neuroscience", "J Comp Physiol A Neuroethol Sens Neural Behav Physiol" => "Journal of Comparative Physiology. A, Neuroethology, Sensory, Neural, and Behavioral Physiology", "J Comp Physiol Psychol" => "Journal of Comparative and Physiological Psychology", "J Comp Psychol" => "Journal of Comparative Psychology", "J Comput Neurosci" => "Journal of Computational Neuroscience", "J Exp Anal Behav" => "Journal of the Experimental Analysis of Behavior", "J Exp Biol" => "The Journal of Experimental Biology", "J Exp Child Psychol" => "Journal of Experimental Child Psychology", "J Exp Psychol Anim Behav Process" => "Journal of Experimental Psychology. Animal Behavior Processes", "J Exp Psychol Appl" => "Journal of Experimental Psychology. Applied", "J Exp Psychol Gen" => "Journal of Experimental Psychology. General", "J Exp Psychol Hum Percept Perform" => "Journal of Experimental Psychology. Human Perception and Performance", "J Exp Psychol Learn Mem Cogn" => "Journal of Experimental Psychology. Learning, Memory, and Cognition", "J Exp Psychol Learn Mem Cognit" => "Journal of Experimental Psychology. Learning, Memory, and Cognition", "J Exp Psychol Hum Percept Perform" => "Journal of Experimental Psychology. Human Perception and Performance", "J Exp Psychol: Hum Perc Perf" => "Journal of Experimental Psychology. Human Perception and Performance", "J Exp Psychol" => "Journal of Experimental Psychology", "J Ling" => "Journal of Linguistics", "J Mem Lang" => "Journal of Memory and Language", "J Music Theory" => "Journal of Music Theory", "J Neurobiol" => "Journal of Neurobiology", "J Neurophysiol" => "Journal of Neurophysiology", "J Neurosci" => "Journal of Neuroscience", "J Pers Soc Psychol" => "Journal of personality and social psychology", "J Physiol" => "Journal of Physiology", "J Psycholing Res" => "Journal of Psycholinguistic Research", "J Psycholinguist Res" => "Journal of Psycholinguistic Research", "J Speech Lang Hear Res" => "Journal of Speech, Language, and Hearing Research", "J Theor Biol" => "Journal of Theoretical Biology", "J V Learn Verb Beha" => "Journal of Verbal Learning and Verbal Behavior", "J Verb Learn Verb Behav" => "Journal of Verbal Learning and Verbal Behavior", "J. ACM" => "Journal of the Association for Computing Machinery", "J ACM" => "Journal of the Association for Computing Machinery", "Lang Cogn Proc" => "Language and Cognitive Processes", "Lang Cognit Proc" => "Language and Cognitive Processes", "Lang Speech" => "Language and Speech", "Learn Mem" => "Language and Memory", "Ling Phil" => "Linguistics and Philosophy", "Linguist Rev" => "Linguistic Review", "Mem Cogn" => "Memory and Cognition", "Mem Cognit" => "Memory and Cognition", "Monogr Soc Res Child Dev" => "Monographs of the Society for Research in Child Development", "Music Perc" => "Music Perception", "Nat Lang Ling Theory" => "Natural Language Linguistic Theory", "Nat Neurosci" => "Nature Neuroscience", "Nat Rev Neurosci" => "Nature Reviews. Neuroscience", "Neural Comp" => "Neural Computation", "Neural Comput" => "Neural Computation", "Neural Netw" => "Neural Networks", "Neurosci Lett" => "Neuroscience Letters", "Percept Psychophys" => "Perception and Psychophysics", "Philos Trans R Soc Lond B Biol Sci" => "Philosophical transactions of the Royal Society of London. Series B, Biological Sciences", "Phys Rev E" => "Physical Review. E", "Phys Rev Lett" => "Physical Review Letters", "Physiol Behav" => "Physiology and Behavior", "PLoS Biol" => "PLoS Biology", "Proc Biol Sci" => "Proceedings. Biological Sciences", "Proc Natl Acad Sci U S A" => "Proceedings of the National Academy of Sciences of the United States of America", "Proc R Soc Lond B Biol Sci" => "Proceedings of the Royal Society of London. Series B", "Proc. ICSLP'96" => "Proceedings of the ICSLP'96", "Prog Neurobiol" => "Progress in neurobiology", "Psychol Bull" => "Psychological Bulletin", "Psychol Res" => "Psychological Research", "Psychol Rev" => "Psychological Review", "Psychol Sci" => "Psychological Science", "Psychon Bull Rev" => "Psychonomic Bulletin and Review", "Psychonom Bull Rev" => "Psychonomic Bulletin and Review", "Q J Exp Psychol A" => "The Quarterly Journal of Experimental Psychology. A, Human experimental Psychology", "Q J Exp Psychol" => "The Quarterly Journal of Experimental Psychology", "Quart J Exp Psychol:A" => "The Quarterly Journal of Experimental Psychology. A, Human Experimental Psychology", "Quarterly J Exp Psychol" => "The Quarterly journal of Experimental Psychology", "Sci Am" => "Scientific American", "Second Lang Res" => "Second Language Research", "Semin Speech Lang" => "Seminars in Speech and Language", "Soc Res" => "Social Research", "Speech Commun." => "Speech Communication", "Speech Commun" => "Speech Communication", "Trans Am Phil Ass" => "Transactions of the American Philosophical Society", "Trends Cogn Sci" => "Trends in Cognitive Sciences", "Trends Genet" => "Trends in Genetics", "Trends Neurosci" => "Trends in Neurosciences", "Vis Cogn" => "Visual Cognition", "Vis Cognit" => "Visual Cognition", "Vision Res" => "Vision Research" ); ######################################################################## ######################################################################## $BGC = '#DDDDFF'; $FGC = '#EE1111'; $ABGC = '#6666FF'; $AFGC = 'white'; $MW = MainWindow->new (-bg => $BGC, -fg => $FGC); $MW->Label(-text => 'Journal Names', -bg => $BGC, -fg => $FGC)->pack(-side => 'top'); $Top = $MW->Frame(-bg => $BGC,); $Top->Button(-text => 'Expand Journals!', -bg => $BGC, -fg => $FGC, -activebackground => $ABGC, -activeforeground => $AFGC, -command => \&open_file)->pack (-side=>'left'); $Top->Button(-text => 'Quit', -bg => $BGC, -fg => $FGC, -activebackground => $ABGC, -activeforeground => $AFGC, -command => sub{exit} )->pack (-side=>'right'); $Top->pack(-side => 'top', -fill=>'x'); MainLoop; sub open_file { my $fn=$Top->getOpenFile( -defaultextension => '.bbl', -filetypes => [ ['Bibliography files', '.bbl'], ['All Files', '*'] ]); unless (-e $fn) { print STDERR "Error: cannot open file '$fn'"; return; } &change_file ($fn); return; } sub change_file { my ($fn, @matches, $k); $fn = shift; rename ($fn, "$fn.sav"); open (IN, "$fn.sav") or return; open (OUT, ">$fn") or return; while (){ # Find LONGEST match to avoid matches # for J Exp Pscyhol instead of one of the other JEP's @matches = (); foreach $k (keys %names){ push (@matches, $k) if (/\{\s*$k\s*\}/i); # if (/$k/); } if (@matches){ @matches = sort {length{$b} <=> length {$a}} @matches; s/$matches[0]/$names{$matches[0]}/; print STDERR "Replacing $matches[0] with $names{$matches[0]}\n"; } print OUT; } print STDERR "\n!!! Done with file $fn !!!\n"; close OUT; close IN; }