vicary 0.2.18 → 0.2.19

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: 96894f65cf1e88e86b89131843ae808215e94c6df4ce8e62b47286fd8ba60431
4
- data.tar.gz: 3054de303e6ba58b370a27d34d96b046ba27878f2bcbe8e40efa0c421c09f1b3
3
+ metadata.gz: a5bf0874dcc6fb688fb61bc76441886d82f709b45017a97e41a71a5de67a8be3
4
+ data.tar.gz: 21b6dcb645bd2a449ba89b8971d25e3c0cf650a6cc6e2515e0daff3c5e22e8a7
5
5
  SHA512:
6
- metadata.gz: 80246adb714cb8a2d32794187fafdd80cc58b573bf633cf5f6c89528f89cc71624e1bba013eea26f6b0c7fdf238f8d7e033b25391b60fd7338c7439ad8e823fd
7
- data.tar.gz: 9c1b2a572734f144b49cc770be0d731f4b3559d88d020b9a6be77d78c9dd24faa1a25219a5a1274e46c1e3697c87c569e36d7b9228acd84769e24fcb1faed1ce
6
+ metadata.gz: a3f1e0e9ed8bafb67ceb4812dce7c56cac60e3f58fb2fbc2ad0ecd5fce15741ebd9f9404c3ccf5a23912f27f849642bf867d805ad627981fcfcff56ce03162d9
7
+ data.tar.gz: f86e63597d16e1aa83ba33fa41bfe9a8fdff3ef59ecaa12e2d7fcaec2d38e00b837a0578fbafe25a53b90acb5017cc128f3929d02cfc6ade4cd25f3ea0e05d88
@@ -1993,6 +1993,30 @@ module Vicary
1993
1993
  out
1994
1994
  end
1995
1995
 
1996
+ # A title abbreviation and the word it introduces, the title in any case.
1997
+ # With a period every title in the set counts; without one only `mr` and
1998
+ # `mrs`, because a bare `ms` or `dr` is as often "ms paint" or "dr" for drive.
1999
+ TITLED_WORD_RE = /\b(?:(?:mrs|mr|ms|dr|prof)\.[ \t]+|(?:mrs|mr)[ \t]+)([A-Za-z][A-Za-z'’]*(?:-[A-Za-z][A-Za-z'’]*)*)/i
2000
+
2001
+ # A surname written in lowercase behind a title: "mr. kowalski". The
2002
+ # lowercase route seeds on the given-name tier, so a surname alone never
2003
+ # reaches it, and the capitalised route needs the capital the writer left
2004
+ # off. A title is the one place the word after it is a name whatever its
2005
+ # case, so the span is the title and that one word. A stop word or a single
2006
+ # letter after the title is skipped.
2007
+ def find_titled_lowercase_candidates(text, protected_span, settlement = nil)
2008
+ out = []
2009
+ each_match(text, TITLED_WORD_RE) do |m|
2010
+ word = m[1]
2011
+ start = m.begin(0)
2012
+ stop = start + m[0].length
2013
+ next if word.length < 2 || stop?(word.downcase) || protected_span.call(start, stop)
2014
+
2015
+ out << Candidate.new(m[0], start, stop, classify(words(m[0]), settlement))
2016
+ end
2017
+ out
2018
+ end
2019
+
1996
2020
  # Every name-shaped span, before any notability decision.
1997
2021
  #
1998
2022
  # High recall and deliberately poor precision — precision is what the
@@ -2166,6 +2190,12 @@ module Vicary
2166
2190
  ).each do |candidate|
2167
2191
  next if claimed.any? { |s, e| candidate.start < e && candidate.end > s }
2168
2192
 
2193
+ out << candidate
2194
+ end
2195
+ claimed = out.map { |candidate| [candidate.start, candidate.end] }
2196
+ find_titled_lowercase_candidates(text, is_protected, settlement).each do |candidate|
2197
+ next if claimed.any? { |s, e| candidate.start < e && candidate.end > s }
2198
+
2169
2199
  out << candidate
2170
2200
  end
2171
2201
  end
@@ -6,5 +6,5 @@ module Vicary
6
6
  # Shared across all three front doors on purpose: one detector, one number. A
7
7
  # gem 0.3.0 that corresponds to nothing on PyPI cannot be reasoned about, and
8
8
  # the parity claim is between *versions*, not between package names.
9
- VERSION = "0.2.18"
9
+ VERSION = "0.2.19"
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vicary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Thomas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-22 00:00:00.000000000 Z
11
+ date: 2026-10-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Finds the names a student writes about — classmates, teachers, relatives — and