Click here to Skip to main content
15,883,883 members
Articles / Desktop Programming / MFC

Name genderization

Rate me:
Please Sign up or sign in to vote.
4.80/5 (6 votes)
22 Apr 2002CPOL3 min read 111.1K   2.4K   19  
Extrapolate the gender of a person based on their first name
// CFPSGenderize
// Author:	Matt Gullett
//			gullettm@yahoo.com
// Copyright (c) 2000
//
// This is a back-end utility class implementing support for name
// genderization services.  It is an extremely simple class with
// a map of names and genders.
//
// This class is highly dependent on the list of names/genders 
// available.
//
// You may freely use this source code in personal, freeware, shareware
// or commercial applications provided that 1) my name is recognized in the
// code and if this code represents a substantial portion of the application
// that my name be included in the credits for the application (about box, etc)
//
// Use this code at your own risk.  This code is provided AS-IS.  No warranty
// is granted as to the correctness, usefulness or value of this code.
//
// *******************************************************************
// TECHNICAL NOTES:
//
// See .cpp file for tech notes
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FPSGENDERIZER_H__500DF6DA_E2C9_46F2_8D89_C20D96FB77B6__INCLUDED_)
#define AFX_FPSGENDERIZER_H__500DF6DA_E2C9_46F2_8D89_C20D96FB77B6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define FPSGENDER_DEFAULT_TABLENAME		"FRST_NM_GNDR"
#define FPSGENDER_DEFAULT_HASHTABLESIZE	8001

class CFPSGenderizer  
{
public:
	virtual char Genderize(LPCTSTR lpszName);
	CFPSGenderizer();
	virtual ~CFPSGenderizer();

	virtual BOOL SetTableName(LPCTSTR lpszName);
	virtual BOOL Load(CArchive& ar);
	virtual BOOL Load(LPCTSTR lpszFileName);
	virtual BOOL Load(_ConnectionPtr& pConnection);

protected:
	void AddName(LPCTSTR lpszName, LPCTSTR lpszGender);
	void Optimize(CPtrList& List);

private:
	char		m_szTableName[MAX_PATH+1];

	CMapStringToString	m_mapNames;
};

#endif // !defined(AFX_FPSGENDERIZER_H__500DF6DA_E2C9_46F2_8D89_C20D96FB77B6__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions