module ICLATEXT

Classify text extracted from ICLA

Constants

FORMS

underlines have all been compressed to 16 char, as that was the shortest found Also dropped the following prefixes: “(optional)”, “*”

TEXT
TEXTS

Tried using __END__ text but the DATA pointer relates to the calling file. The first line is deliberately blank The lines below have been extracted from all icla.pdf versions since r1029599, compressed and deduplicated.

UNDER
UNDERCOUNT
UNDER_MATCH

Public Class Methods

compress(str) click to toggle source
# File lib/whimsy/asf/icla_text.rb, line 6
def self.compress(str)
  str.strip.squeeze(' ')
end
type(line) click to toggle source
# File lib/whimsy/asf/icla_text.rb, line 13
def self.type(line)
  txt = compress(line)
  return :text if TEXT.include? txt
  # drop leading "*" and "(optional"
  sqz = txt.sub(%r{^\* *}, '').sub(%r{^ *\(optional\) *}, '').gsub(UNDER_MATCH, UNDER)
  return FORMS[sqz] || :other
end