Created
February 21, 2021 06:15
-
-
Save MrJeremyHobbs/d068f65e21251bc51b9e2cd6af8313d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;======== | |
; SELECT | |
;======== | |
SetWorkingDir %A_ScriptDir% | |
FileDelete results.txt | |
top = CALL#`tLC CLASS`tTITLE`tAUTHOR`tPUBLISHER`tPUBLICATION YEAR`tSUBJECT`tBARCODE`tISBN | |
FileAppend, %top%`n, results.txt | |
;======= | |
; PARSE | |
;======= | |
Loop, read, _list.txt | |
{ | |
line := A_LoopReadLine | |
StringReplace, line, line, ",,All | |
;" | |
StringSplit, l, line, %A_Tab% | |
LocationCode := l1 | |
LocationName := l2 | |
callNum := l3 | |
DisplayCallNumberNormalized := l4 | |
Title := l5 | |
Enumeration := l6 | |
CopyNumber := l7 | |
PossibleDuplicate := l8 | |
Author := l9 | |
Publisher := l10 | |
PublicationYear := l11 | |
Edition := l12 | |
PrimaryLanguage := l13 | |
Series := l14 | |
RecordedUsesItem := l15 | |
RecordedUsesTitle := l16 | |
LastChargeDateItem := l17 | |
LastChargeDateTitle := l18 | |
LastAddDateTitle := l19 | |
GlobalHoldingsSameEdition := l20 | |
USAHoldingsSamEdition := l21 | |
USAHoldingsAnyEdition := l22 | |
CaliforniaHoldingsSameEdition := l23 | |
CaliforniaHoldingsAnyEdition := l24 | |
AllComparatorLibraryHoldingsSameEdition := l25 | |
AllComparatorLibraryHoldingsAnyEdition := l26 | |
OtherCSUsSameEdition := l27 | |
OtherCSUsAnyEdition := l28 | |
UCsSameEdition := l29 | |
UCsAnyEdition := l30 | |
SelectedLinlPlusSameEdition := l31 | |
SelectedLinkPlusAnyEdition := l32 | |
RegionalComparatorsSameEdition := l33 | |
RegionalComparatorsAnyEdition := l34 | |
LocalComparatorsSameEdition := l35 | |
LocalComparatorsAnyEdition := l36 | |
Protected := l37 | |
HathiTrustPublicDomain := l38 | |
HathiTrustInCopyright := l39 | |
HathiTrustURL := l40 | |
OPACURL := l41 | |
WorldCatURL := l42 | |
OCLCWorkID := l43 | |
WorldCatOCLCNumber := l44 | |
BibRecordNumber := l45 | |
BibControlNumber := l46 | |
ItemControlNumber := l47 | |
ItemTypeCode := l48 | |
ItemStatusCode := l49 | |
ISBN := l50 | |
Barcode := l51 | |
;========================= | |
; NORMALIZE - CALL NUMBER | |
;========================= | |
callNum := RegExReplace(callNum, " v.*", "") | |
callNum := RegExReplace(callNum, " pt.*", "") | |
callNum := RegExReplace(callNum, "REF ", "") | |
callNum := RegExReplace(callNum, "INT GTR", "") | |
;=================== | |
; NORMALIZE - TITLE | |
;=================== | |
title := RegExReplace(title, "/.*", "") | |
title := RegExReplace(title, "/.*", "") | |
title := RegExReplace(title, "#.*", "") | |
title := RegExReplace(title, "/[/]", "") | |
;==================== | |
; NORMALIZE - AUTHOR | |
;==================== | |
author := RegExReplace(author, "\s\w\.", "") | |
author := RegExReplace(author, "\..*", "") | |
author := RegExReplace(author, "\d\d\d\d.*", "@") | |
author := RegExReplace(author, ",\s@", "") | |
author := RegExReplace(author, ",\s\s@", "") | |
author := RegExReplace(author, ",\s\r", "") | |
author := RegExReplace(author, "\(.*", "") | |
author := RegExReplace(author, ", author", "") | |
author := RegExReplace(author, ", Ph", "") | |
author := RegExReplace(author, ", editor", "") | |
author := RegExReplace(author, "#", " - ") | |
;========================= | |
; NORMALIZE - ENUMERATION | |
;========================= | |
enumeration := RegExReplace(enumeration, "\*", "") | |
;======================= | |
; NORMALIZE - PUBLISHER | |
;======================= | |
publisher := RegExReplace(publisher, ".*: ", "") | |
publisher := RegExReplace(publisher, "\d\d\d\d", "") | |
publisher := RegExReplace(publisher, ",.*", "") | |
;====================== | |
; NORMALIZE - PUB DATE | |
;====================== | |
RegExMatch(publicationYear, "\d\d\d\d", p) | |
publicationYear := p | |
;===================== | |
; NORMALIZE - EDITION | |
;===================== | |
edition := RegExReplace(edition, "\d(.*)", "") | |
;========== | |
; PULL OUT | |
;========== | |
subject = | |
if callNum not contains . | |
{ | |
callNum := RegExReplace(callNum, "\s", ".") | |
} | |
StringSplit, c, callNum, . | |
call := c1 | |
if c2 is integer | |
{ | |
call = %c1%`.%c2% | |
} | |
RegExMatch(call, "[A-Za-z]*", let) | |
RegExMatch(call, "\d.*", num) | |
num := RegExReplace(num, "\s.*", "") | |
callNormalized := let | |
If let = GE | |
{ | |
subject = Environmental Sciences | |
} | |
If let = GF | |
{ | |
if num between 51 and 74.999 | |
{ | |
subject = Environmental influences on man | |
} | |
if num between 75 and 79.999 | |
{ | |
subject = Man's influences on the environment | |
} | |
} | |
if let = GV | |
{ | |
if num between 443 and 443.999 | |
{ | |
subject = Physical education for children | |
} | |
if num between 446 and 446.999 | |
{ | |
subject = Special physical education | |
} | |
if num between 447 and 449.999 | |
{ | |
subject = Physical education for the aged | |
} | |
if num between 452 and 545.4999 | |
{ | |
subject = Excerise, gymnastics | |
} | |
} | |
if let = HM | |
{ | |
if num between 856 and 865.999 | |
{ | |
subject = Environment. Social ecology | |
} | |
} | |
if let = HN | |
{ | |
if num between 1 and 24.999 | |
{ | |
subject = Social history and conditions. Social problems | |
} | |
if num between 25 and 28.999 | |
{ | |
subject = Social history and confitions. General | |
} | |
} | |
if let = HV | |
{ | |
if num between 680 and 696.999 | |
{ | |
subject = Medical and other professional services | |
} | |
if num between 697 and 4996.999 | |
{ | |
subject = Social pathology. Special cases | |
} | |
if num between 4997 and 6000.999 | |
{ | |
subject = Substance abuse | |
} | |
} | |
if let = KF | |
{ | |
if num between 3300 and 3700.999 | |
{ | |
subject = Social legislation | |
} | |
if num between 3771 and 3774.999 | |
{ | |
subject = Birth control. Family planning | |
} | |
if num between 3775 and 3834.999 | |
{ | |
subject = Medical legislation | |
} | |
if num between 3861 and 3940.999 | |
{ | |
subject = Food. Drugs. Alcohol | |
} | |
} | |
if let = LB | |
{ | |
if num between 3401 and 3640.999 | |
{ | |
subject = School hygiene. School life | |
} | |
} | |
if let = QH | |
{ | |
if num between 323 and 323.999 | |
{ | |
subject = School hygiene. School life | |
} | |
} | |
if let = QP | |
{ | |
if num between 31 and 33.999 | |
{ | |
subject = Physiology. General | |
} | |
if num between 82 and 82.999 | |
{ | |
subject = Environmental influences, e.g. altitude, cold, pesticides, radiation, stress, etc. | |
} | |
if num between 83 and 87.999 | |
{ | |
subject = Developmental physiology, e.g. growth. aging, death | |
} | |
if num between 136 and 144.999 | |
{ | |
subject = Nutrition | |
} | |
if num between 301 and 350.999 | |
{ | |
subject = Movements. Kinesiology. Voice and speech | |
} | |
} | |
if let = QR | |
{ | |
if num between 48 and 50.999 | |
{ | |
subject = Sanitary microbiology | |
} | |
if num between 180 and 200.999 | |
{ | |
subject = Immunology | |
} | |
if num between 201 and 300.999 | |
{ | |
subject = Pathogenic micro-organisms | |
} | |
if num between 352 and 354.999 | |
{ | |
subject = Mycoplasmas. Rickettsias | |
} | |
if num between 355 and 502.999 | |
{ | |
subject = Virology | |
} | |
} | |
if let = RA | |
{ | |
subject = Public Aspects of Medicine | |
} | |
if let = RJ | |
{ | |
if num between 59 and 60.999 | |
{ | |
subject = Infant and neonatal morbidity and mortality | |
} | |
if num between 101 and 124.999 | |
{ | |
subject = Child health and wellness | |
} | |
if num between 240 and 244.999 | |
{ | |
subject = Immunization. Hospital care | |
} | |
if num between 370 and 599.999 | |
{ | |
subject = Diseases | |
} | |
} | |
if let = RK | |
{ | |
if num between 52 and 57.999 | |
{ | |
subject = Public health | |
} | |
} | |
if let = TD | |
{ | |
if num between 1 and 157.999 | |
{ | |
subject = Environmental Technology. Sanitary Engineering. General. History | |
} | |
if num between 172 and 192.999 | |
{ | |
subject = Environmental pollution. Remediation | |
} | |
if num between 194 and 195.399 | |
{ | |
subject = Effects of industries and plants | |
} | |
if num between 201 and 510.999 | |
{ | |
subject = Water supply | |
} | |
} | |
if let = TX | |
{ | |
If num between 341 and 644.999 | |
{ | |
subject = Nutrition. Food supply | |
} | |
} | |
;======= | |
; WRITE | |
;======= | |
if subject != | |
{ | |
write = %callNum%`t%callNormalized%`t%Title%`t%Author%`t%publisher%`t%PublicationYear%`t%subject%`t%barcode%`t%isbn% | |
FileAppend, %write%`n, results.txt | |
} | |
} | |
;======== | |
; FINISH | |
;======== | |
msgbox Done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment