https://github.com/benbjohnson/matlock
Simple name extraction utility.
https://github.com/benbjohnson/matlock
Last synced: 5 months ago
JSON representation
Simple name extraction utility.
- Host: GitHub
- URL: https://github.com/benbjohnson/matlock
- Owner: benbjohnson
- License: mit
- Created: 2013-01-05T16:15:10.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2015-06-03T14:16:04.000Z (over 10 years ago)
- Last Synced: 2025-07-22T02:04:14.208Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 750 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Matlock
=======
## Overview
Matlock is a simple name extraction utility.
It's useful for pulling out all the full names from a string.
For example, pass in the HTML for a web page and it will return an array of full names mentioned.
It's premise is pretty simple and it is geared toward names in the United States.
Matlock extracts all bigrams (first name, surname) from the string where either the first name or surname is in the US Census list of common names.
The US Census data has been cleaned so that common words and US cities and states have been removed.
You can see the full list of name data in the `lib/matlock/data` directory.
## Getting Started
To use Matlock, simply install the gem:
```bash
$ gem install matlock
```
Then in your script simply require the gem and extract names from a string:
```ruby
require "matlock"
require 'open-uri'
html = open("http://cnn.com").read
matlock = Matlock.new()
names = matlock.extract_names(html)
#=> ["Lance Armstrong", "Anderson Cooper", ...]
```
Matlock will get some false positives and some true negatives.
It's not meant to be an "end all, be all" name extraction tool.
It's mainly meant to be quick and dirty but that's effective for many use cases.