traject_umich_format 0.3.0 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3a1b3c0500bb377df78ef5d7dc372ad5c2759f0b
4
- data.tar.gz: 2d84aa166bdf99f10e18ac3b5029a0392cb529f9
2
+ SHA256:
3
+ metadata.gz: 5d5c289456af156391507f875b2c204c9e8c734a5778eb1e669e0da1c0ee0b3d
4
+ data.tar.gz: 953420f1ab73559be5ab828c5702b950b4e68e126ce07d651a0eb3d527a1d5ff
5
5
  SHA512:
6
- metadata.gz: f3a4710ea2c9d25861b6f366bec46c6184b53d5d50bbe4e8d5278819f49b0408e24ef6564949d5ad70eca1fc7ecee01bd920810a5eec50023cf4de91c4a83abe
7
- data.tar.gz: fbeab98ec1044296d564fc6d962b079e01f53f64a71d56b6960016fee7db51d2210497a1e6a79d8c38c4f1a5cec5a1bd8c6484df9df8cdec0fa56820b81c2401
6
+ metadata.gz: fffed374bb32707d3026b1510fe9b410710e5e3ecd3f6ef557e11030599fa77e589d6fbed6013553fe530b23b874ab5a3192038a67441b9c8628aa4017e6e13f
7
+ data.tar.gz: 0565de640f6889aad2812f69bf4d882c87799adb174514b5f115a55f48d84d2b3846a6688d3cda6bb8629cdc405556d760a374406b6972ace71945d48c87e4d0
@@ -1,3 +1,16 @@
1
+ ### 0.4.4 / 2020-06-10
2
+
3
+ * Include "i" bib level in defs for formats other than bk or se.
4
+
5
+ ### 0.4.0 / 2017-12-01
6
+
7
+ * Improve recognition of audio and CD formats
8
+
9
+ ### 0.3.0 / 2017-04-13
10
+
11
+ * Call `uniq` on the list of formats before it's returned, since _serial_ can sometimes come
12
+ from two non-mutually-exclusive places. Thanks to @timothyprettyman.
13
+
1
14
  ### 0.2.0 / 2013-11-13
2
15
 
3
16
  * Make LP format detection more liberal (thank you for pull request, @jrochkind)
@@ -37,19 +37,19 @@ class Traject::UMichFormat::BibFormat
37
37
  end
38
38
 
39
39
  def bibformat_cf(type, lev)
40
- (type == 'm') && %w[a b c d m s].include?(lev)
40
+ (type == 'm') && %w[a b c d i m s].include?(lev)
41
41
  end
42
42
 
43
43
  def bibformat_vm(type, lev)
44
- %w[g k o r].include?(type) && %w[a b c d m s].include?(lev)
44
+ %w[g k o r].include?(type) && %w[a b c d i m s].include?(lev)
45
45
  end
46
46
 
47
47
  def bibformat_mu(type, lev)
48
- %w[c d i j].include?(type) && %w[a b c d m s].include?(lev)
48
+ %w[c d i j].include?(type) && %w[a b c d i m s].include?(lev)
49
49
  end
50
50
 
51
51
  def bibformat_mp(type, lev)
52
- %w[e f].include?(type) && %w[a b c d m s].include?(lev)
52
+ %w[e f].include?(type) && %w[a b c d i m s].include?(lev)
53
53
  end
54
54
 
55
55
  def bibformat_se(type, lev)
@@ -57,6 +57,6 @@ class Traject::UMichFormat::BibFormat
57
57
  end
58
58
 
59
59
  def bibformat_mx(type, lev)
60
- %w[b p].include?(type) && %w[a b c d m s].include?(lev)
60
+ %w[b p].include?(type) && %w[a b c d i m s].include?(lev)
61
61
  end
62
62
  end
@@ -38,6 +38,7 @@ class Traject::UMichFormat::BibTypes
38
38
  codes.concat self.reference_types
39
39
  codes.concat self.pp_types
40
40
  codes.concat self.videogame_types
41
+ codes.concat self.boardgame_types
41
42
 
42
43
  codes.uniq!
43
44
  codes.compact!
@@ -163,6 +164,14 @@ class Traject::UMichFormat::BibTypes
163
164
  end
164
165
  end
165
166
 
167
+ # RC: 007/00 is 's' and 007/01 is 'd' and 007/06 is 'g'
168
+ @record.fields('007').map{|f| f.value}.each do |f|
169
+ if (f[0] == 's') && (f[1] == 'd') && (f[6] == 'g')
170
+ types << 'RC'
171
+ break
172
+ end
173
+ end
174
+
166
175
  f8524.each do |f|
167
176
  if (f['b'].upcase == 'MUSIC') && (f['j'] =~ /\ACD/i)
168
177
  types << 'RC'
@@ -354,6 +363,7 @@ class Traject::UMichFormat::BibTypes
354
363
  # TYP CR CDROM 852## j MATCH cdrom*
355
364
  # TYP CR CDROM 852## j MATCH cd-rom*
356
365
  # TYP CS Software 852## j MATCH software*
366
+ # CR: 007/00 is 'c' and 007/01 is 'o' and 007/04 is 'g'
357
367
 
358
368
  def software_types
359
369
  types = []
@@ -365,6 +375,14 @@ class Traject::UMichFormat::BibTypes
365
375
  types << 'CS'
366
376
  end
367
377
  end
378
+
379
+ # CR: 007/00 is 'c' and 007/01 is 'o' and 007/04 is 'g'
380
+ @record.fields('007').map{|f| f.value}.each do |f|
381
+ if (f[0] == 'c') && (f[1] == 'o') && (f[4] == 'g')
382
+ types << 'CR'
383
+ end
384
+ end
385
+
368
386
  types.uniq!
369
387
  return types
370
388
  end
@@ -549,5 +567,22 @@ class Traject::UMichFormat::BibTypes
549
567
  end
550
568
  end
551
569
 
570
+ # TYP BG Board Games 655## a MATCH board games
571
+ # TYP BG Board Games 655## a MATCH card games
572
+ # TYP BG Board Games 852## j MATCH game board*
573
+ # TYP BG Board Games LDR F06-01 EQUAL [g,k,o,r]
574
+ # 008 F33-01 EQUAL g
575
+ # TYP BG Board Games LDR F06-01 EQUAL [g,k,o,r]
576
+ # 006 F16-01 EQUAL g
577
+
578
+
579
+ def boardgame_types
580
+ return ['BG'] if self['655a'].grep(/\A(board|card) games/i).size > 0
581
+ return ['BG'] if self['852j'].grep(/\Agame board/i).size > 0
582
+ return ['BG'] if %w[g k o r].include?(record.leader[6]) && (self['008[33]'].include? 'g')
583
+ return ['BG'] if %w[g k o r].include?(record.leader[6]) && (self['006[16]'].include? 'g')
584
+ return []
585
+ end
586
+
552
587
 
553
588
  end
@@ -44,7 +44,7 @@ module Traject::UMichFormat::Macros
44
44
  tmap = Traject::TranslationMap.new('umich/format')
45
45
  ->(record, acc, context) do
46
46
  context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
47
- acc.concat context.clipboard[:umich_format_obj].format_and_types.map{|x| tmap[x]}
47
+ acc.concat context.clipboard[:umich_format_obj].format_and_types.map{|x| tmap[x]}.uniq
48
48
  end
49
49
  end
50
50
 
@@ -1,5 +1,5 @@
1
1
  module Traject
2
2
  class UMichFormat
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
@@ -3,6 +3,7 @@
3
3
  "AN" => "Newspaper",
4
4
  "BI" => "Biography",
5
5
  "BK" => "Book",
6
+ "BG" => "Board Games",
6
7
  "CE" => "Data File",
7
8
  "CF" => "Data File",
8
9
  "CR" => "CDROM",
@@ -52,6 +52,15 @@ describe 'audio' do
52
52
  assert @umf.types.include?("RL"), "types include 'RL'"
53
53
  end
54
54
 
55
+ it "identifies an audio CD from the 007 field" do
56
+ @record = MARC::Reader.new(support_file_path 'audio_cd_007.mrc').first
57
+ @umf = Traject::UMichFormat.new(@record)
58
+
59
+ puts 'types from audio_cd_007.mrc file: ' + @umf.types.join(',')
60
+ #assert_equal 'MU', @umf.bib_format
61
+ assert @umf.types.include?("RC"), "types include 'RC'"
62
+ end
63
+
55
64
  end
56
65
 
57
66
  describe "macros" do
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traject_umich_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Dueber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2020-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - '>='
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0'
19
19
  name: bundler
@@ -21,13 +21,13 @@ dependencies:
21
21
  type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  name: rake
@@ -35,13 +35,13 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  name: yard
@@ -49,19 +49,21 @@ dependencies:
49
49
  type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: The algorithm used by the University of Michigan University Library to determine format (book, serial, etc.) and type (audio, video, conference, etc.) from a (ruby marc) MARC record
55
+ description: The algorithm used by the University of Michigan University Library to
56
+ determine format (book, serial, etc.) and type (audio, video, conference, etc.)
57
+ from a (ruby marc) MARC record
56
58
  email: bill@dueber.com
57
59
  executables: []
58
60
  extensions: []
59
61
  extra_rdoc_files: []
60
62
  files:
61
- - .document
62
- - .gitignore
63
- - .travis.yml
64
- - .yardopts
63
+ - ".document"
64
+ - ".gitignore"
65
+ - ".travis.yml"
66
+ - ".yardopts"
65
67
  - ChangeLog.md
66
68
  - Gemfile
67
69
  - LICENSE.txt
@@ -95,17 +97,17 @@ require_paths:
95
97
  - lib
96
98
  required_ruby_version: !ruby/object:Gem::Requirement
97
99
  requirements:
98
- - - '>='
100
+ - - ">="
99
101
  - !ruby/object:Gem::Version
100
102
  version: '0'
101
103
  required_rubygems_version: !ruby/object:Gem::Requirement
102
104
  requirements:
103
- - - '>='
105
+ - - ">="
104
106
  - !ruby/object:Gem::Version
105
107
  version: '0'
106
108
  requirements: []
107
109
  rubyforge_project:
108
- rubygems_version: 2.1.9
110
+ rubygems_version: 2.7.9
109
111
  signing_key:
110
112
  specification_version: 4
111
113
  summary: Extract the format and type from a MARC record, the UMich way
@@ -120,4 +122,3 @@ test_files:
120
122
  - spec/spec_support/video_dvd_rom.mrc
121
123
  - spec/version_spec.rb
122
124
  - spec/video_spec.rb
123
- has_rdoc: