1.0.0 • Published 7 years ago

honorifics v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

When dealing with names, you come across honorifics, titles, suffixes and prefixes.

Extracting these is important in dealing with the sanitrizing the names and/or inferring gender.

const honorifics = require('honorifics');

var str = 'Sir Dr. Alex Mark Jr.';
var res = honorifics.extract(str);
console.log(JSON.stringify(res,0,4));

var str = 'Dr. Alex Mark Jr.';
var res = honorifics.extract(str);
console.log(JSON.stringify(res,0,4));

This should output:

{
    "string": "Sir Dr. Alex Mark Jr.",
    "name": "Alex Mark",
    "gender": "male",
    "honorofics": [
        {
            "honorofic": "sir",
            "gender": "male"
        },
        {
            "honorofic": "dr.",
            "gender": "unknown"
        },
        {
            "honorofic": "jr.",
            "gender": "unknown"
        }
    ]
}       

{
    "string": "Dr. Alex Mark Jr.",
    "name": "Alex Mark",
    "gender": "unknown",
    "honorofics": [
        {
            "honorofic": "dr.",
            "gender": "unknown"
        },
        {
            "honorofic": "jr.",
            "gender": "unknown"
        }
    ]
}