<commit_before><?php
/**
 * Works with a Name object to parse out the parts of a name.
 *
 * Example usage:
 *		$parser = new Parser("<NAME>");
 *		echo  $parser->getLast() . ", " . $parser->getFirst();
 *		//returns "<NAME>"
 *
 *
 */
class HumanNameParser_Parser {
	private $name;
	private $leadingInit;
	private $first;
	private $nicknames;
	private $middle;
	private $last;
	private $suffix;

	private $suffixes;
	private $prefixes;

	/*
	  * Constructor
	  *
	  * @param	mixed $name	Either a name as a string or as a Name object.
	  */
	public function __construct($name = NULL)
	{
		$this->setName($name);
	}

	/**
	 * Sets name string and parses it.
	 * Takes Name object or a simple string (converts the string into a Name obj),
	 * parses and loads its constituant parts.
	 *
	 * @param	mixed $name	Either a name as a string or as a Name object.
	 */
	public function setName($name = NULL){
		if ($name) {

			if (is_object($name) && get_class($name) == "HumanNameParser_Name") { // this is mostly for testing
				$this->name = $name;
			}
			else {
				$this->name = new HumanNameParser_Name($name);
			}

			$this->leadingInit = "";
			$this->first = "";
			$this->nicknames = "";
			$this->middle = "";
			$this->last = "";
			$this->suffix = "";

			$this->suffixes = array('esq','esquire','jr','sr','2','ii','iii','iv', 'v');
			$this->prefixes = array('bar','ben','bin','da','dal','de la', 'de', 'del','der','di',
				'ibn','la','le','san','st','ste','van', 'van der', 'van den', 'vel','von');

			$this->parse();
		}
	}

	public function getleadingInit() {
		return $this->leadingInit;
	}
	public function getFirst() {
		return $this->first;<commit_msg>add phd as suffix option<commit_after><?php
/**
 * Works with a Name object to parse out the parts of a name.
 *
 * Example usage:
 *		$parser = new Parser("<NAME>");
 *		echo  $parser->getLast() . ", " . $parser->getFirst();
 *		//returns "Smith, John"
 *
 *
 */
class HumanNameParser_Parser {
	private $name;
	private $leadingInit;
	private $first;
	private $nicknames;
	private $middle;
	private $last;
	private $suffix;

	private $suffixes;
	private $prefixes;

	/*
	  * Constructor
	  *
	  * @param	mixed $name	Either a name as a string or as a Name object.
	  */
	public function __construct($name = NULL)
	{
		$this->setName($name);
	}

	/**
	 * Sets name string and parses it.
	 * Takes Name object or a simple string (converts the string into a Name obj),
	 * parses and loads its constituant parts.
	 *
	 * @param	mixed $name	Either a name as a string or as a Name object.
	 */
	public function setName($name = NULL){
		if ($name) {

			if (is_object($name) && get_class($name) == "HumanNameParser_Name") { // this is mostly for testing
				$this->name = $name;
			}
			else {
				$this->name = new HumanNameParser_Name($name);
			}

			$this->leadingInit = "";
			$this->first = "";
			$this->nicknames = "";
			$this->middle = "";
			$this->last = "";
			$this->suffix = "";

			$this->suffixes = array('esq','esquire','jr','sr','2','ii','iii','iv', 'v', 'phd');
			$this->prefixes = array('bar','ben','bin','da','dal','de la', 'de', 'del','der','di',
				'ibn','la','le','san','st','ste','van', 'van der', 'van den', 'vel','von');

			$this->parse();
		}
	}

	public function getleadingInit() {
		return $this->leadingInit;
	}
	public function getFirst() {
		return $this->first;
{'fraction_non_alphanumeric': 0.19160963998809877, 'fraction_numerical': 0.0005950609937518596, 'mean_word_length': 3.4529801324503313, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6660614', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1142, 'n_words': 317}