Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs for other source extraction patterns #198

Open
ronaldtse opened this issue Nov 18, 2021 · 0 comments
Open

Add specs for other source extraction patterns #198

ronaldtse opened this issue Nov 18, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Member

  describe ".extract_source_ref" do

    it "parses 'SI Brochure'" do
      phrases = [
        'SI Brochure, 9th edition, 2019, 2.3.1',
        'SI Brochure, 9th edition, 2019, Appendix 1',
        'Brochure sur le SI, 9<sup>e</sup> édition, 2019, Annexe 1'
      ]

      results = phrases.map do |p|
        builder.extract_source_ref(p)
      end

      expect(results.all? { |r| r == 'BBIPM SI Brochure TEMP DISABLED DUE TO RELATON' })
    end

    it "parses 'VIM'" do
      phrases = [
        '≠ VIM 3.1',
        '≈ VIM 3.1',
        'VIM 3.1',
        'VIM 3.1 MOD',
        '≠ VIM 3.10 + NOTE 2'
      ]

      results = phrases.map do |p|
        builder.extract_source_ref(p)
      end

      expect(results.all? { |r| r == 'JCGM VIM' })
    end

    # TODO
    # # IEC 60050-121, 151-12-05
    # when /IEC 60050-(\d+), (\d{2,3}-\d{2,3}-\d{2,3})/
    #   "IEC 60050-#{$LAST_MATCH_INFO[1]}"
    # when /IEC 60050-(\d+):(\d+), (\d{2,3}-\d{2,3}-\d{2,3})/
    #   "IEC 60050-#{$LAST_MATCH_INFO[1]}:#{$LAST_MATCH_INFO[2]}"
    # when /(AIEA|IAEA) (\d+)/
    #   "IAEA #{$LAST_MATCH_INFO[2]}"
    # when /IEC\sIEEE ([\d\:\-]+)/
    #   "IEC/IEEE #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /CISPR ([\d\:\-]+)/
    #   "IEC CISPR #{$LAST_MATCH_INFO[1]}"
    # when /RR (\d+)/
    #   "ITU RR"
    # # IEC 50(845)
    # when /IEC (\d+)\((\d+)\)/
    #   "IEC 600#{$LAST_MATCH_INFO[1]}-#{$LAST_MATCH_INFO[1]}"
    # when /(ISO|IEC)[\/\ ](PAS|TR|TS) ([\d\:\-]+)/
    #   "#{$LAST_MATCH_INFO[1]}/#{$LAST_MATCH_INFO[2]} #{$LAST_MATCH_INFO[3]}".sub(/:\Z/, "")
    # when /ISO\/IEC ([\d\:\-]+)/
    #   "ISO/IEC #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /ISO\/IEC\/IEEE ([\d\:\-]+)/
    #   "ISO/IEC/IEEE #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    #
    # # ISO 140/4
    # when /ISO (\d+)\/(\d+)/
    #   "ISO #{$LAST_MATCH_INFO[1]}-#{$LAST_MATCH_INFO[2]}"
    # when /Norme ISO (\d+)-(\d+)/
    #   "ISO #{$LAST_MATCH_INFO[1]}:#{$LAST_MATCH_INFO[2]}"
    # when /ISO\/IEC Guide ([\d\:\-]+)/i
    #   "ISO/IEC Guide #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /(ISO|IEC) Guide ([\d\:\-]+)/i
    #   "#{$LAST_MATCH_INFO[1]} Guide #{$LAST_MATCH_INFO[2]}".sub(/:\Z/, "")
    #
    # # ITU-T Recommendation F.791 (11/2015)
    # when /ITU-T Recommendation (\w.\d+) \((\d+\/\d+)\)/i
    #   "ITU-T Recommendation #{$LAST_MATCH_INFO[1]} (#{$LAST_MATCH_INFO[2]})"
    #
    # # ITU-T Recommendation F.791:2015
    # when /ITU-T Recommendation (\w.\d+):(\d+)/i
    #   "ITU-T Recommendation #{$LAST_MATCH_INFO[1]} (#{$LAST_MATCH_INFO[2]})"
    #
    # when /ITU-T Recommendation (\w\.\d+)/i
    #   "ITU-T Recommendation #{$LAST_MATCH_INFO[1]}"
    #
    # # ITU-R Recommendation 592 MOD
    # when /ITU-R Recommendation (\d+)/i
    #   "ITU-R Recommendation #{$LAST_MATCH_INFO[1]}"
    # # ISO 669: 2000 3.1.16
    # when /ISO ([\d\-]+:\s?\d{4})/
    #   "ISO #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /ISO ([\d\:\-]+)/
    #   "ISO #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /IEC ([\d\:\-]+)/
    #   "IEC #{$LAST_MATCH_INFO[1]}".sub(/:\Z/, "")
    # when /definition (\d\.[\d\.]+) of ([\d\-])/
    #   "IEC #{$LAST_MATCH_INFO[2]}".sub(/:\Z/, "")
    # when /définition (\d\.[\d\.]+) de la ([\d\-])/
    #   "IEC #{$LAST_MATCH_INFO[2]}".sub(/:\Z/, "")
    #
    # when /IEV (\d{2,3}-\d{2,3}-\d{2,3})/, /(\d{2,3}-\d{2,3}-\d{2,3})/
    #   "IEV"
    # when /IEV part\s+(\d+)/, /partie\s+(\d+)\s+de l'IEV/
    #   "IEC 60050-#{$LAST_MATCH_INFO[1]}"
    #
    # when /International Telecommunication Union (ITU) Constitution/,
    #   /Constitution de l’Union internationale des télécommunications (UIT)/
    #   "International Telecommunication Union (ITU) Constitution (Ed. 2015)"
@ronaldtse ronaldtse added the enhancement New feature or request label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants