matlock 0.1.1 → 0.1.2
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.
- data/lib/matlock.rb +1 -1
- data/lib/matlock/version.rb +1 -1
- data/test/matlock_test.rb +6 -0
- metadata +1 -1
data/lib/matlock.rb
CHANGED
@@ -47,7 +47,7 @@ class Matlock
|
|
47
47
|
names = []
|
48
48
|
|
49
49
|
# Split content into words.
|
50
|
-
words = content.split(/[^-
|
50
|
+
words = content.split(/[^-_a-z0-9]+/i).select {|v| v.index(/^[-a-z]+$/i)}
|
51
51
|
|
52
52
|
# Loop over each bigram and check if the words are title cased and if at
|
53
53
|
# least one of the words is a first or last name.
|
data/lib/matlock/version.rb
CHANGED
data/test/matlock_test.rb
CHANGED
@@ -27,4 +27,10 @@ class TestMatlock < MiniTest::Unit::TestCase
|
|
27
27
|
names = @matlock.extract_names(html)
|
28
28
|
assert_equal ["Delloreen Ennis-London"], names
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_name_underscored_names
|
32
|
+
html = "This name Wally_Bullingotn_Practice_Complex should not work."
|
33
|
+
names = @matlock.extract_names(html)
|
34
|
+
assert_equal [], names
|
35
|
+
end
|
30
36
|
end
|