metanorma-iso 3.5.47 → 3.5.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 372d5e59693d5e2a7175dc72c426aeb5ebcee7ec6d7391574b3b0a8dfd786a11
4
- data.tar.gz: cda30c4d8fc6386a0dae519534a19a8bfa78ab00267288deac875871c94747aa
3
+ metadata.gz: caf0f3672485e93024b4194bb56add38ede556bfccade7b2419e7d873eb9319d
4
+ data.tar.gz: 9f90530ad2e1c86c3e19e9c1e603ae1ddb25d3f0c7c50ea5abbc6cb488ac73ed
5
5
  SHA512:
6
- metadata.gz: 3b7506a8fb1ae44a22e0c54ab2f2a011f7844a861f4a580f42f49d71440cc753d1108470cb113a061b40cf22843134b55cca815e2d6c9b8a5791bb7479c840cf
7
- data.tar.gz: 896ba0a86b328212ce12ab60b9ef7e227a0f610bd23a55fc31d045c79770e69456aa5935f3ae3babf9fd5edb2414b7ce8a3f105e8bee4f19cf0c285bd9ce3dd8
6
+ metadata.gz: 366be427dca9af171ad41218a43e5dfda619a5b014639cec292af68aa2d12998e412cd4f9c122c53379a4824cdbcd06a2a5a25ac9f376014d55a58bb8496e34f
7
+ data.tar.gz: b608126fc118ef1799ff00adb447acc1b8ec9373741cdc8b22bdaca58d32fa80da9c1a8bb06346a5146a0493bd416b3bfd4657422f127b7425d1207a3695c94d
@@ -25,6 +25,11 @@ module Metanorma
25
25
 
26
26
  # Words with an initial vowel SOUND: they take "an" despite
27
27
  # the consonant spelling (silent letters).
28
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
29
+ # hand-maintained sound-class word list (letter-name pronunciation; a pronunciation lexicon, not derivable from the alphabet). The end state is the kotoshu
30
+ # grammar-model integration, which supplies the word class and
31
+ # retires this table; it is not to be extended by hand.
32
+
28
33
  A_BEFORE_VOWEL_SOUND_REGEX =
29
34
  /\ba\s+(?:hour(?:ly)?|honest(?:ly)?|honesty|hono(?:u)?r(?:ed)?|heir)\b/i.freeze
30
35
 
@@ -9,7 +9,10 @@ module Metanorma
9
9
  # narrow: it flags only the doubled-s form "MSSs" (the plural
10
10
  # of the abbreviated term "MSS" written as "MSSs"). Broader
11
11
  # abbreviated-term pluralization is a high-false-positive
12
- # context-sensitive check and is out of scope here.
12
+ # context-sensitive check and is out of scope here. The shape is
13
+ # derived, not spelled (metanorma-iso#1963): any abbreviation
14
+ # that already ends in a capital S and then takes a lowercase
15
+ # "s" ("MSSs", "ISSs") is the doubled-s plural.
13
16
  class StyleAbbrevPluralRule < StyleRule
14
17
  code "ISO_64"
15
18
 
@@ -17,14 +20,16 @@ module Metanorma
17
20
  rule: "abbreviated terms are invariant — do not pluralize by appending 's'",
18
21
  source: :house_style, mn_category: :style
19
22
 
20
- # Case-sensitive: the doubled-s plural form of "MSS".
21
- MSSS_REGEX = /\bMSSs\b/.freeze
23
+ # Case-sensitive: an abbreviation ending in capital S plus a
24
+ # lowercase "s" ("MSSs"); "DVDs" and "SOPs" are regular plurals
25
+ # and pass.
26
+ MSSS_REGEX = /\b[A-Z]{2,}Ss\b/.freeze
22
27
 
23
28
  def scan_text(node, text)
24
29
  finding_if_match(
25
30
  node, text, MSSS_REGEX,
26
- "style: 'MSSs' (abbreviated terms are invariant — 'MSS' " \
27
- "is not pluralized)"
31
+ "style: '%s' (abbreviated terms ending in S are invariant — " \
32
+ "do not append 's')"
28
33
  )
29
34
  end
30
35
  end
@@ -33,6 +33,11 @@ module Metanorma
33
33
  # headings, the document-vocabulary words used as labels
34
34
  # ("NOTE", "EXAMPLE", ...), and the lowercase-only
35
35
  # abbreviations ("etc.", "cf.").
36
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
37
+ # hand-maintained English-word list (word-ness needs a dictionary wordlist, not derivable). The end state is the kotoshu
38
+ # grammar-model integration, which supplies the word class and
39
+ # retires this table; it is not to be extended by hand.
40
+
36
41
  STOPWORDS = %w[
37
42
  all also and any are as at be been both but by can cannot
38
43
  case cf come could data date did do does done each eg end
@@ -28,17 +28,21 @@ module Metanorma
28
28
  rule: "use 'to' between digits in quantity ranges ('5 mm to 10 mm')",
29
29
  source: :house_style, mn_category: :style
30
30
 
31
- UNITS = %w[
32
- mm cm km m um nm g mg kg t s ms us ns min h
33
- Hz kHz MHz GHz Pa kPa MPa GPa N kN MN A mA V mV kV
34
- W mW kW MW J kJ MJ Wh kWh dB dBm mol cd lx lm Bq Gy Sv kat
35
- bar % °C
36
- ].freeze
31
+ # The unit set is the Unitsdb registry, shared with ISO_121 and
32
+ # ISO_146 (UnitTokens), with the SI prefixes composing as the
33
+ # Brochure defines them (metanorma-iso#1963); the hand list it
34
+ # replaces diverged from ISO_121's and missed "ft", "K" and
35
+ # "300-350 K"-style ranges. The per-cent sign is ISO 80000-1's
36
+ # non-SI unit and is not carried by Unitsdb.
37
+ PER_CENT_SIGN = "%".freeze
37
38
 
38
- UNIT_ALT = UNITS.map { |u| Regexp.escape(u) }.join("|").freeze
39
+ UNIT_ALT = (UnitTokens.all_symbols + [PER_CENT_SIGN])
40
+ .map { |u| Regexp.escape(u) }.sort_by(&:length).reverse.join("|").freeze
41
+ PREFIX_ALT = UnitTokens.si_prefix_symbols
42
+ .sort_by(&:length).reverse.map { |p| Regexp.escape(p) }.join("|").freeze
39
43
 
40
44
  # One unit word, e.g. " mm", " %" or " °C".
41
- UNIT_WORD = /\s+(?:#{UNIT_ALT})(?![a-zA-Z])/.freeze
45
+ UNIT_WORD = /\s+(?:#{PREFIX_ALT})?(?:#{UNIT_ALT})(?![a-zA-Z])/.freeze
42
46
 
43
47
  # "10 mm to 20 mm" second half: number + unit.
44
48
  NUMBER_UNIT_BODY = /\d+(?:[.,]\d+)?#{UNIT_WORD}/.freeze
@@ -23,6 +23,11 @@ module Metanorma
23
23
  "'less than' with quantities ('less than 10 min')",
24
24
  source: :house_style, mn_category: :style
25
25
 
26
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
27
+ # hand-maintained count-noun list (countability is a lexical property; a corpus or lexicon, not derivable). The end state is the kotoshu
28
+ # grammar-model integration, which supplies the word class and
29
+ # retires this table; it is not to be extended by hand.
30
+
26
31
  COUNT_NOUNS = %w[
27
32
  samples specimens tests trials results measurements readings
28
33
  errors items products documents examples cases steps
@@ -7,9 +7,14 @@ module Metanorma
7
7
  # Style warnings for personal pronouns (ISO House Style:
8
8
  # impersonal tone in technical documents). "I", "we", "our",
9
9
  # "you", "your", "yours" as standalone words are flagged. The
10
- # list is kept tight: "us" is excluded because a case-insensitive
11
- # match collides with the country code "US"; "I" is matched
12
- # case-sensitively to avoid lowercase roman-numeral and
10
+ # paradigm of English personal pronouns is a closed grammar table
11
+ # and is derived in full (metanorma-iso#1963): the first-person
12
+ # singular set is matched case-sensitively ("I", "me", "my",
13
+ # "mine", "myself"), the third-person set too ("SHE" is a
14
+ # management-system abbreviation), the plural and second-person
15
+ # sets case-insensitively. "us" stays excluded because a
16
+ # case-insensitive match collides with the country code "US";
17
+ # case-sensitive matching avoids lowercase roman-numeral and
13
18
  # identifier noise. As with every style warning, the noise level
14
19
  # of a quoted string is accepted (severity is a warning).
15
20
  class StyleImpersonalRule < StyleRule
@@ -19,14 +24,15 @@ module Metanorma
19
24
  rule: "use an impersonal tone; avoid 'I', 'we', 'you' and other personal pronouns",
20
25
  source: :house_style, mn_category: :style
21
26
 
22
- PRONOUN_I_REGEX = /\b(I)\b/.freeze
23
- PRONOUN_WE_YOU_REGEX = /\b(we|our|you|your|yours)\b/i.freeze
27
+ PRONOUN_SINGULAR_REGEX = /\b(I|me|my|mine|myself)\b/.freeze
28
+ PRONOUN_THIRD_REGEX = /\b(he|him|his|himself|she|her|hers|herself)\b/.freeze
29
+ PRONOUN_PLURAL_REGEX =
30
+ /\b(we|our|ours|ourselves|you|your|yours|yourself|yourselves|they|them|their|theirs|themselves)\b/i.freeze
24
31
 
25
32
  def scan_text(node, text)
26
- findings_for_matches(node, text, PRONOUN_I_REGEX,
27
- "style: '%s' (use impersonal wording)") +
28
- findings_for_matches(node, text, PRONOUN_WE_YOU_REGEX,
29
- "style: '%s' (use impersonal wording)")
33
+ [PRONOUN_SINGULAR_REGEX, PRONOUN_THIRD_REGEX, PRONOUN_PLURAL_REGEX].flat_map do |regex|
34
+ findings_for_matches(node, text, regex, "style: '%s' (use impersonal wording)")
35
+ end
30
36
  end
31
37
  end
32
38
  end
@@ -8,6 +8,11 @@ module Metanorma
8
8
  # Style: cite the element by its identifier -- "see Clause 5",
9
9
  # "see Figure 3" -- not "the following clause", "the figure
10
10
  # above", "the table below", "the preceding section").
11
+ #
12
+ # The banned phrase is compositional and derived
13
+ # (metanorma-iso#1963): "the" + a positional word (following,
14
+ # preceding, above, below) + a document element noun, in either
15
+ # order.
11
16
  class StyleImpreciseRefsRule < StyleRule
12
17
  code "ISO_94"
13
18
 
@@ -15,13 +20,16 @@ module Metanorma
15
20
  rule: "cite the element by its identifier, not 'the following clause' or 'the figure above'",
16
21
  source: :house_style, mn_category: :references
17
22
 
23
+ POSITIONAL_WORDS = %w[following preceding above below].freeze
24
+ ELEMENT_NOUNS = %w[
25
+ clause subclause section paragraph figure table annex formula
26
+ chapter note example definition term appendix bibliography
27
+ reference
28
+ ].freeze
29
+
18
30
  IMPRECISE_REFS_REGEX = /
19
- \b(the\ following\ clauses?
20
- |the\ following\ sections?
21
- |the\ preceding\ clauses?
22
- |the\ preceding\ sections?
23
- |the\ figures?\ above
24
- |the\ tables?\ below)
31
+ \bthe\s+(?:following|preceding)\s+(?:#{ELEMENT_NOUNS.join("|")})s?(?![\w-])
32
+ |\bthe\s+(?:#{ELEMENT_NOUNS.join("|")})s?\s+(?:above|below)(?![\w-])
25
33
  /xi.freeze
26
34
 
27
35
  def scan_text(node, text)
@@ -28,6 +28,11 @@ module Metanorma
28
28
  # Base-form verbs that open an imperative instruction
29
29
  # ("Apply a load of 10 N."). Kept closed: a wrong word here
30
30
  # would misclassify declarative sentences as requirements.
31
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
32
+ # hand-maintained verb list (imperative-ness is a part-of-speech property, not derivable). The end state is the kotoshu
33
+ # grammar-model integration, which supplies the word class and
34
+ # retires this table; it is not to be extended by hand.
35
+
31
36
  IMPERATIVE_VERBS = %w[
32
37
  apply calibrate consider connect ensure follow include measure
33
38
  mount perform place protect provide record refer remove repeat
@@ -23,6 +23,11 @@ module Metanorma
23
23
  rule: "use the Latin/Greek plurals ('criteria', 'phenomena'); 'data' is plural",
24
24
  source: :house_style, mn_category: :style
25
25
 
26
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
27
+ # hand-maintained declension pair list (Latin declension is derivable per class only with the lexicon of Latin-origin nouns and the House Style's accepted anglicized plurals). The end state is the kotoshu
28
+ # grammar-model integration, which supplies the word class and
29
+ # retires this table; it is not to be extended by hand.
30
+
26
31
  LATIN_PLURALS = {
27
32
  /\bcriterias\b/i => "criterias (use 'criteria')",
28
33
  /\bphenomenons\b/i => "phenomenons (use 'phenomena')",
@@ -6,7 +6,10 @@ module Metanorma
6
6
  module Rules
7
7
  # Style warnings for ordinal adverbs (ISO House Style: use
8
8
  # "first", "second", "third", not "firstly", "secondly",
9
- # "thirdly").
9
+ # "thirdly"). The ordinal paradigm of English is closed and
10
+ # regular (metanorma-iso#1963): an ordinal adverb is any ordinal
11
+ # word with "ly", including the hyphenated compounds, so the
12
+ # rule derives the whole class instead of listing three members.
10
13
  class StyleOrdinalsRule < StyleRule
11
14
  code "ISO_106"
12
15
 
@@ -14,7 +17,17 @@ module Metanorma
14
17
  rule: "write first, second, third rather than firstly, secondly, thirdly",
15
18
  source: :house_style, mn_category: :style
16
19
 
17
- ORDINAL_ADVERBS_REGEX = /\b(firstly|secondly|thirdly)\b/i.freeze
20
+ ORDINAL_WORDS = %w[
21
+ first second third fourth fifth sixth seventh eighth ninth tenth
22
+ eleventh twelfth thirteenth fourteenth fifteenth sixteenth
23
+ seventeenth eighteenth nineteenth twentieth thirtieth fortieth
24
+ fiftieth sixtieth seventieth eightieth ninetieth hundredth
25
+ thousandth millionth
26
+ ].freeze
27
+ ORDINAL_TENS = %w[twenty thirty forty fifty sixty seventy eighty ninety].freeze
28
+
29
+ ORDINAL_ADVERBS_REGEX =
30
+ /\b(?:(?:#{ORDINAL_TENS.join("|")})[-\s])?(?:#{ORDINAL_WORDS.join("|")})ly\b/i.freeze
18
31
 
19
32
  def scan_text(node, text)
20
33
  findings_for_matches(
@@ -95,6 +95,11 @@ module Metanorma
95
95
  PETRI_DISH_REGEX = /\bpetri[ ]dish(?:es)?\b/x.freeze
96
96
  SULFUR_REGEX = /\bsulph\w*/xi.freeze
97
97
 
98
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
99
+ # hand-maintained exception lexicon (-ise→-ize is derivable only with the etymological lexicon of Greek-derived verbs; the Oxford list is the registry and is not machine-sourced today). The end state is the kotoshu
100
+ # grammar-model integration, which supplies the word class and
101
+ # retires this table; it is not to be extended by hand.
102
+
98
103
  OXFORD = {
99
104
  IZE_SPELLING_REGEX =>
100
105
  "style: '-ise' spelling (use '-ize': organize, recognize, " \
@@ -9,11 +9,16 @@ module Metanorma
9
9
  # possibility use "may" and "can" (StyleAmbigWordsRule covers
10
10
  # the ambiguous modals "might", "could" and "need to").
11
11
  #
12
- # Heuristic-limited by design: the rule flags only the closed
13
- # list of requirement-shaped continuations of "will" (a bare
14
- # "will" + verb-phrase). Future-tense narration in informative
15
- # text is not distinguished from requirement phrasing and will
16
- # be reported too; the finding is a warning for the editor.
12
+ # Every auxiliary "will" is a verbal form (metanorma-iso#1963):
13
+ # the Directives table bans it for requirements wholesale, so the
14
+ # rule derives "will" + verb-phrase instead of listing four
15
+ # continuations ("will meet", "will provide" and "will result"
16
+ # passed silently). The noun "will" is recognised structurally by
17
+ # a preceding determiner, possessive or quantifier ("the will of
18
+ # the committee", "their will to succeed") and is never flagged.
19
+ # Future-tense narration in informative text is not distinguished
20
+ # from requirement phrasing and will be reported too; the finding
21
+ # is a warning for the editor.
17
22
  class StyleVerbalFormsRule < StyleRule
18
23
  code "ISO_118"
19
24
 
@@ -21,14 +26,24 @@ module Metanorma
21
26
  rule: "requirements are expressed with 'shall' — not 'will' or other verbal forms",
22
27
  source: :house_style, mn_category: :style
23
28
 
24
- # Closed list: requirement-shaped continuations of "will".
25
- WILL_REQUIREMENT_REGEX =
26
- /\bwill\s+(?:(?:not\s+)?be|apply|contain|consist)\b/i.freeze
29
+ # "will" + (not) + (be) + verb: any verbal continuation.
30
+ WILL_REGEX = /\bwill(?:\s+not)?\s+(?:be\s+)?[a-z]+\b/i.freeze
31
+
32
+ # The closed determiner class of English: articles, possessives,
33
+ # demonstratives and quantifiers, plus the two adjective
34
+ # collocations of the noun ("free will", "good will").
35
+ DETERMINER_BEFORE_REGEX =
36
+ /\b(?:the|an?|his|her|their|its|our|your|my|this|that|these|those|every|each|any|no|some|either|neither|both|free|good|own)\s*\z/i.freeze
27
37
 
28
38
  LABEL = "style: '%s' (verbal form: use 'shall' for requirements)".freeze
29
39
 
30
40
  def scan_text(node, text)
31
- findings_for_matches(node, text, WILL_REQUIREMENT_REGEX, LABEL)
41
+ text.to_enum(:scan, WILL_REGEX).filter_map do
42
+ match = Regexp.last_match
43
+ next if DETERMINER_BEFORE_REGEX.match?(text[0...match.begin(0)])
44
+
45
+ build_warning(node, format(LABEL, match[0]))
46
+ end
32
47
  end
33
48
  end
34
49
  end
@@ -73,6 +73,11 @@ module Metanorma
73
73
  UNIT_FOLLOW_REGEX =
74
74
  /\A\s?(?!#{ENGLISH_HOMOGRAPH_GROUP})(?:#{SI_PREFIX_GROUP})?(?:#{UNIT_GROUP})(?![a-z])/i.freeze
75
75
 
76
+ # INTERIM (metanorma-iso#1963, per the ISO_63 ruling): a
77
+ # hand-maintained residual word list (month names are a CLDR registry; the currency and reference-token lists below are Unitsdb names and document-model vocabulary). The end state is the kotoshu
78
+ # grammar-model integration, which supplies the word class and
79
+ # retires these tables; it is not to be extended by hand.
80
+
76
81
  MONTHS = %w[
77
82
  january february march april may june july august september
78
83
  october november december
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "3.5.47".freeze
3
+ VERSION = "3.5.48".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.47
4
+ version: 3.5.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.