Skip to content

mberry1989/MLNET-kontent-taxonomy-app

Repository files navigation

Kentico Kontent Sample Taxonomy Machine Learning Tool

A sample .NET Core 3.1 console application using the Kentico Kontent Delivery .NET SDK, Kentico Kontent Management SDK, and ML.NET.

This application demonstrates how to use ML.NET's multiclass classification to suggest taxonomy terms for Kentico Kontent content item variants. The application retrieves movies from a Kentico Kontent project then, uses an ML.NET model to predict what category the movie should be listed in based upon its title, description, and rating (e.g. PG, PG-13, R, etc.). After making a prediction, the application upserts the predicted "listed in" taxonomy term to the movie in the Kentico Kontent project.

Included in this repository is the ML.NET Model and ML.NET Console application projects generated by the ML.NET Model Builder Extension, as well as the Netflix movie data used to train the model, and an export package for creating the Movies project in Kentico Kontent.

Kentico Kontent setup

Creating the Movies project using the Template Manager

  1. Sign in to your Kentico Kontent account.
  2. Create a new project
  3. In Kentico Kontent, choose Project settings from the app menu.
  4. Under Development, choose API keys and copy the Project ID
  5. Paste the copied ID into the Project ID input on the Template Manager
  6. Enable the Management API and repeat step 5 with the Management API key and Template Manager input field
  7. Drop the project export package onto the Template Manager
  8. Uncheck "Publish import items"
  9. Click "Prepare import data"
  10. Click "Proceed with import"
  11. Proceed to "Application setup" instructions below

Application setup

Running the application

To run the app:

  1. Clone the app repository with your favorite GIT client
    1. For instance, you can use Visual Studio, Visual Studio Code, GitHub Desktop, etc.
    2. Alternatively, you can download the repo as a ZIP file, however, this will not adapt line endings in downloaded files to your platform (Windows, Unix).
  2. Open the solution in Visual Studio (using the MLNET-kontent-taxonomy-app.sln file).
  3. Follow instructions below to connect to your Movies project

Connecting to your Movies project

  1. In Kentico Kontent, choose Project settings from the app menu.
  2. Under Development, choose API keys.
    1. You will need the Project ID, Preview API, and Management API keys.
  3. Open the ~\MLNET-kontent-taxonomy-app\appsettings.json file.
  4. Use the values from your Kentico Kontent project in the appsettings.json file:
{
  "KontentKeys": {
    "ProjectId": "<YOUR PROJECT ID>",
    "PreviewApiKey": "<YOUR PREVIEW API KEY>",
    "ManagementApiKey": "<YOUR MANAGEMENT API KEY>"
  }
}
  1. Save the changes.
  2. Run the application.

Outcome: The three pre-created Movie content items will now have "Listed In" taxonomy terms assigned to them in Kentico Kontent.

Testing the taxonomy term suggestion with a new content item

  1. Create a new Movie content item in Kentico Kontent
  2. Fill-in the item Name, Title, Rating, and Description
    1. Leave the "Listed In" element blank
  3. Do not publish the item
    1. The Management API used in the application can only upsert on Unpublished content items
  4. Run the console application

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages