Quickstart#

Introduction#

Name Object automates the handling of name data, making it simple to send personalized business mail, tailored specifically to the gender of the people in your mailing list, while screening out vulgar or obviously false names.

Sample Code#

Name Object is compatible with multiple coding languages across different systems. The table below will link you to the sample code for each language hosted in the github repositories.

Language

System

Repository

C# .NET

Windows

melissa_favicon MelissaData/NameObject-Dotnet

Linux

melissa_favicon MelissaData/NameObject-Dotnet-Linux

melissa_favicon MelissaData/NameObject-Dotnet-Wrappers

C++

Windows

melissa_favicon MelissaData/NameObject-Cpp

Linux

melissa_favicon MelissaData/NameObject-Cpp-Linux

Java

Windows

melissa_favicon MelissaData/NameObject-Java

Linux

melissa_favicon MelissaData/NameObject-Java-Linux

melissa_favicon MelissaData/NameObject-Java-Wrappers

Python3

Windows

melissa_favicon MelissaData/NameObject-Python3

Linux

melissa_favicon MelissaData/NameObject-Python3-Linux

melissa_favicon MelissaData/NameObject-Python3-Wrappers

How To Get Data#

Use the Melissa Updater to download the data files using the manifest named dq_name_data.

Getting Started#

Basic Flow of Actions#

To use the Name Object, you can give it a first and last name. It will then analyze the name and store relevant information about it. It can also return result codes based on the validity of the name.

This is the flow of how Name Object is usually implemented:

The Reference Guide goes into detail on every method available with the Name Object. All the Result Codes and descriptions are also in the reference guide.

1. Initialize Name Object#

Start by creating an instance of the Melissa Name Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Create instance of Melissa Name Object
public mdName mdNameObj = new mdName();
// Create instance of Melissa Name Object
mdName* mdNameObj = new mdName;
// Create instance of Melissa Name Object
mdName mdNameObj = new mdName();
# Create instance of Melissa Name Object
md_name_obj = mdName_pythoncode.mdName()

2. Set a License#

To set a license, either configure the environmental variable for the license or use the method SetLicenseString.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set license string
mdNameObj.SetLicenseString(MELISSA_LICENSE_STRING);
// Set license string
mdNameObj->SetLicenseString(MELISSA_LICENSE_STRING.c_str());
// Set license string
mdNameObj.SetLicenseString(MELISSA_LICENSE_STRING);
# Set license string
md_name_obj.SetLicenseString(MELISSA_LICENSE_STRING)

To see when the license will expire, use the method GetLicenseExpirationDate.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
Console.WriteLine($"Expiration Date: {mdNameObj.GetLicenseStringExpirationDate()}");
cout << "Expiration Date: " + string(mdNameObj->GetLicenseStringExpirationDate()) << endl;
System.out.println("Expiration Date: " + mdNameObj.GetLicenseStringExpirationDate());
print(f"Expiration Date: {md_name_obj.GetLicenseStringExpirationDate()}")

3. Initialize Data Files#

To set the path for the data files, use the method SetPathToNameFiles.

Use the method InitializeDataFiles to setup the data files.

ProgramStatus can be used to store the result from InitializeDataFiles to ensure it worked as expected.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set path to data files (.dat, etc)
mdNameObj.SetPathToNameFiles(PATH_TO_DATA_FILES);
mdName.ProgramStatus pStatus = mdNameObj.InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdName.ProgramStatus.NoError)
{
    Console.WriteLine("Failed to Initialize Object.");
    Console.WriteLine(pStatus);
    return;
}
// Set path to datafiles (.dat, etc)
mdNameObj->SetPathToNameFiles(PATH_TO_DATA_FILES.c_str());
mdName::ProgramStatus pStatus = mdNameObj->InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdName::ProgramStatus::NoError)
{
    cout << "Failed to Initialize Object." << endl;
    cout << pStatus << endl;
    return;
}
// Set path to data files (.dat, etc)
mdNameObj.SetPathToNameFiles(PATH_TO_DATA_FILES);
mdName.ProgramStatus pStatus = mdNameObj.InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdName.ProgramStatus.NoError)
{
    System.out.println("Failed to Initialize Object.");
    System.out.println(pStatus);
    return;
}
# Set path to data files  (.dat, etc)
md_name_obj.SetPathToNameFiles(PATH_TO_DATA_FILES)
p_status = md_name_obj.InitializeDataFiles()

# If an issue occurred while initializing the data files, this will throw
if (p_status != mdName_pythoncode.ProgramStatus.NoError):
    print("Failed to Initialize Object.")
    print(p_status)
    return

To check at what date the database was updated, use the method GetDatabaseDate.

The method GetBuildNumber gives the development build number of Name Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// If you see a different date than expected, check your license string and either download
// the new data files or use the Melissa Updater program to update your data files.
Console.WriteLine($"DataBase Date: {mdNameObj.GetDatabaseDate()}");

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
Console.WriteLine($"Object Version: {mdNameObj.GetBuildNumber()}\n");
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
cout << "DataBase Date: " + string(mdNameObj->GetDatabaseDate()) << endl;

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
cout << "Object Version: " + string(mdNameObj->GetBuildNumber()) << endl;
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
System.out.println("DataBase Date: " + mdNameObj.GetDatabaseDate());

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
System.out.println("Object Version: " + mdNameObj.GetBuildNumber());
# If you see a different date than expected, check your license string and either download
# the new data files or use the Melissa Updater program to update your data files.
print(f"DataBase Date: {md_name_obj.GetDatabaseDate()}")

# This number should match with file properties of the Melissa Object binary file.
# If TEST appears with the build number, there may be a license key issue.
print(f"Object Version: {md_name_obj.GetBuildNumber()}\n")

The method GetInitializeErrorString can get the status on errors in initialization. This can help determine if the code should continue running.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
bool shouldContinueRunning = true;

if (mdNameObj.GetInitializeErrorString() != "No error.")
{
    shouldContinueRunning = false;
}
bool shouldContinueRunning = true;

if (string(mdNameObj->GetInitializeErrorString()) != "No error.")
{
    shouldContinueRunning = false;
}
Boolean shouldContinueRunning = true;

if (!mdNameObj.GetInitializeErrorString().equals("No error."))
    shouldContinueRunning = false;
should_continue_running = True

if md_name_obj.GetInitializeErrorString() != "No error.":
    should_continue_running = False

4. Lookup and Process the Name#

The method SetFullName assigns a name for the method Parse to look up.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdNameObj.ClearProperties();

// This will call the lookup function to process the input name
// as well as generate the result codes
mdNameObj.SetFullName(NAME_STRING);
mdNameObj.Parse();
mdNameObj.Genderize();
mdNameObj.Salutate();
mdNameObj->ClearProperties();

// This will call the lookup function to process the input name
// as well as generate the result codes
mdNameObj->SetFullName(NAME_STRING);
mdNameObj->Parse();
mdNameObj.Genderize();
mdNameObj.Salutate();
mdNameObj.ClearProperties();

// This will call the lookup function to process the input name
// as well as generate the result codes
mdNameObj.SetFullName(data.Name);
mdNameObj.Parse();
mdNameObj.Genderize();
mdNameObj.Salutate();
md_name_obj.ClearProperties()

# This will call the lookup function to process the input name
# as well as generate the result codes
md_name_obj.SetFullName(NAME_STRING)
md_name_obj.Parse()
md_name_obj.Genderize()
md_name_obj.Salutate()

5. Get Name Object Information#

These methods get data from the parsed name:

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdNameObj.GetPrefix();
mdNameObj.GetFirstName();
mdNameObj.GetMiddleName();
mdNameObj.GetLastName();
mdNameObj.GetSuffix();
mdNameObj.GetGender();
mdNameObj.GetSalutation();
mdNameObj.GetPrefix();
mdNameObj.GetFirstName();
mdNameObj.GetMiddleName();
mdNameObj.GetLastName();
mdNameObj.GetSuffix();
mdNameObj.GetGender();
mdNameObj.GetSalutation();
mdNameObj.GetPrefix();
mdNameObj.GetFirstName();
mdNameObj.GetMiddleName();
mdNameObj.GetLastName();
mdNameObj.GetSuffix();
mdNameObj.GetGender();
mdNameObj.GetSalutation();
md_name_obj.GetPrefix()
md_name_obj.GetFirstName()
md_name_obj.GetMiddleName()
md_name_obj.GetLastName()
md_name_obj.GetSuffix()
md_name_obj.GetGender()
md_name_obj.GetSalutation()

6. Get the Melissa Result Codes#

To get the result codes, use the method GetResults. This will return all of the result codes stacked together in a single String separated by ‘,’ delimiters.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
String ResultCodes = mdNameObj.GetResults();

// ResultsCodes explain any issues Name Object has with the object.
string ResultCodes = mdNameObj->GetResults();

// ResultsCodes explain any issues Name Object has with the object.
String ResultCodes = mdNameObj.GetResults();

// ResultsCodes explain any issues Name Object has with the object.
result_codes = md_name_obj.GetResults()

# ResultsCodes explain any issues Name Object has with the object.

The following implementation shows one way of interpreting the results by using the method GetResultCodeDescription:

  • C#
  • C++
  • Java
  • Python3
mdNameObj.GetResultCodeDescription(RESULT_CODE_STRING, mdName.ResultCdDescOpt.ResultCodeDescriptionLong);
mdNameObj->GetResultCodeDescription(RESULT_CODE_STRING.c_str(), mdNameObj->ResultCodeDescriptionLong);
mdNameObj.GetResultCodeDescription(RESULT_CODE_STRING, mdName.ResultCdDescOpt.ResultCodeDescriptionLong);
md_name_obj.GetResultCodeDescription(RESULT_CODE_STRING, mdName_pythoncode.ResultCdDescOpt.ResultCodeDescriptionLong)