Sha256: a6212aae890145fb76719cb195885d6817e3a9aed3d28b0e818d8862b030ad94

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

module Nameable
  class Latin
    ##
    # Regex's to match the detritus that people add to their names
    module Patterns
      PREFIX = {
        "Mr."    => /^\(*(mr\.*|mister)\)*$/i,
        "Mrs."   => /^\(*(mrs\.*|misses)\)*$/i,
        "Ms."    => /^\(*(ms\.*|miss)\)*$/i,
        "Dr."    => /^\(*(dr\.*|doctor)\)*$/i,
        "Rev."   => /^\(*(rev\.*|reverand)\)*$/i,
        "Fr."    => /^\(*(fr\.*|friar)\)*$/i,
        "Master" => /^\(*(master)\)*$/i,
        "Sir"    => /^\(*(sir)\)*$/i
      }

      SUFFIX = {
        "Sr."   => /^\(*(sr\.?|senior)\)*$/i,
        "Jr."   => /^\(*(jr\.?|junior)\)*$/i,
        "Esq."  => /^\(*(esq\.?|esquire)\)*$/i,
        "Ph.D." => /^\(*(p\.?h\.?d\.?)\)*$/i
      }

      SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX.]+\)*$/i
      SUFFIX_ACADEMIC = /^(APR|RPh|MD|MA|DMD|DDS|PharmD|EngD|DPhil|JD|DD|DO|BA|BS|BSc|BE|BFA|MA|MS|MSc|MFA|MLA|MBA)$/i
      SUFFIX_PROFESSIONAL = /^(PE|CSA|CPA|CPL|CME|CEng|OFM|CSV|Douchebag)$/i
      SUFFIX_ABBREVIATION = /^[A-Z.]+[A-Z.]+$/  # It should be at least 2 letters

      # http://www.onlineaspect.com/2009/08/17/splitting-names/
      LAST_NAME_PRE_DANGLERS = /^(mc|vere|von|van|da|de|del|della|di|da|pietro|vanden|du|st|la|ter|ten)$/i
      O_LAST_NAME_PRE_CONCATS = /^(o'|o`|o")$/i
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nameable-1.1.1 lib/nameable/latin/patterns.rb
nameable-1.1.0 lib/nameable/latin/patterns.rb
nameable-1.0.0 lib/nameable/latin/patterns.rb