Human Name parsing

后端 未结 5 1041
醉话见心
醉话见心 2021-01-05 13:32

I have a bunch of human names. They are all \"Western\" names and I only need American conventions/abbreviations (e.g., Mr. instead of Sr. for señor). Unfortunately, the pe

5条回答
  •  逝去的感伤
    2021-01-05 14:03

    humanparser

    Parse a human name string into salutation, first name, middle name, last name, suffix.

    Install

    npm install humanparser
    

    Usage

    var human = require('humanparser');
    
    var fullName = 'Mr. William R. Jenkins, III'
        , attrs = human.parseName(fullName);
    
    console.log(attrs);
    
    //produces the following output
    
    { saluation: 'Mr.',
      firstName: 'William',
      suffix: 'III',
      lastName: 'Jenkins',
      middleName: 'R.',
      fullName: 'Mr. William R. Jenkins, III' }
    

提交回复
热议问题