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 +4 -4
- data/lib/vicary/candidates.rb +30 -0
- data/lib/vicary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5bf0874dcc6fb688fb61bc76441886d82f709b45017a97e41a71a5de67a8be3
|
|
4
|
+
data.tar.gz: 21b6dcb645bd2a449ba89b8971d25e3c0cf650a6cc6e2515e0daff3c5e22e8a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3f1e0e9ed8bafb67ceb4812dce7c56cac60e3f58fb2fbc2ad0ecd5fce15741ebd9f9404c3ccf5a23912f27f849642bf867d805ad627981fcfcff56ce03162d9
|
|
7
|
+
data.tar.gz: f86e63597d16e1aa83ba33fa41bfe9a8fdff3ef59ecaa12e2d7fcaec2d38e00b837a0578fbafe25a53b90acb5017cc128f3929d02cfc6ade4cd25f3ea0e05d88
|
data/lib/vicary/candidates.rb
CHANGED
|
@@ -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
|
data/lib/vicary/version.rb
CHANGED
|
@@ -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.
|
|
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.
|
|
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-
|
|
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
|