Skip to content

GenderPrediction.Turkish is a library that provides prediction of gender from Turkish names built on ML.NET Both training application and library included in source code.

License

Notifications You must be signed in to change notification settings

Blind-Striker/gender-prediction-turkish

Repository files navigation

Turkish Names Gender Prediction

GenderPrediction.Turkish is a library that provides prediction of gender from Turkish names built on ML.NET Both training application and library included in source code.

NuGet

Supported Platforms

Continuous integration

Build server Platform Build status Integration tests
AppVeyor Windows Build status
Travis Linux / MacOS Build Status

Table of Contents

  1. Installation
  2. Usage
  3. License

Installation

NuGet

Following commands can be used to install GenderPrediction.Turkish, run the following command in the Package Manager Console

Install-Package GenderPrediction.Turkish

Or use dotnet cli

dotnet GenderPrediction.Turkish

Usage

GenderPrediction.Turkish can be used with any DI library, or it can be used standalone.

Standalone Initialization

If you do not want to use any DI framework, you have to instantiate GenderPredictionStandalone as follows.

IGenderPredictionService genderPredictionService = GenderPredictionStandalone.Create();

Microsoft.Extensions.DependencyInjection Initialization

First, you need to install Microsoft.Extensions.DependencyInjection NuGet package as follows

dotnet add package Microsoft.Extensions.DependencyInjection

Register necessary dependencies to ServiceCollection as follows

var services = new ServiceCollection();
services.AddSingleton<IGenderPredictionEngine, GenderPredictionEngine>();
services.AddTransient<IGenderPredictionService, GenderPredictionService>();

ServiceProvider buildServiceProvider = services.BuildServiceProvider();

var genderPredictionService = buildServiceProvider.GetRequiredService<IGenderPredictionService>();

The singleton registration of the GenderPredictionEngine is important for performance, since its loads and initialize the trained model. After the library is initialized, it is very easy to use.

GenderPredictionModel model = genderPredictionService.Predict("Deniz");

string name = genderPredictionModel.Name;
Gender predictedGender = genderPredictionModel.PredictedGender;
float maleProbability = genderPredictionModel.Score[Gender.Male];
float femaleProbability = genderPredictionModel.Score[Gender.Female];
float unisexProbability = genderPredictionModel.UnisexProbability

Or

string[] names = new[] {"Dilek", "Hasan", "Mehmet", "İbrahim"};
IEnumerable<GenderPredictionModel> model = genderPredictionService.Predict(names);

License

Licensed under MIT, see LICENSE for the full text.

About

GenderPrediction.Turkish is a library that provides prediction of gender from Turkish names built on ML.NET Both training application and library included in source code.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages