-
Notifications
You must be signed in to change notification settings - Fork 32
Getting Started
The quickest introduction uses StaticContext and the sample KPCData.xml. It needs no database and supports the same IKPCContext API used by persistent applications.
The public Samples repository includes a snapshot with 2,707 ingredients, forms and NLP metadata, and 30 recipes:
git clone https://github.com/KitchenPC/Samples.git KitchenPC-Samples
cd KitchenPC-Samples
dotnet run --project Console/Console.csprojThat terminal application parses entries such as 12 bananas, aggregates compatible quantities, and saves the list locally.
dotnet new console --name KitchenPcQuickStart
cd KitchenPcQuickStart
dotnet add package KitchenPC.Core --version 2.0.0Copy SampleData/KPCData.xml from the Samples repository and add it to the project output:
<ItemGroup>
<None Include="SampleData/KPCData.xml"
CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>Initialize a context once, then use the engine:
using KitchenPC.Core;
using KitchenPC.Core.Context;
var dataDirectory = Path.Combine(AppContext.BaseDirectory, "SampleData");
var context = StaticContext.Configure
.DataDirectory(dataDirectory)
.Identity(() => AuthIdentity.Anonymous)
.Create();
context.Initialize();
var parsed = context.ParseIngredientUsage("a dozen eggs");
Console.WriteLine(parsed.Usage);
var results = context.Recipes
.Search(q => q.Keywords("chocolate"))
.Results();
foreach (var recipe in results.Briefs)
Console.WriteLine(recipe.Title);Check the NLP result type before assuming Usage is populated; see Ingredient parsing and units.
- Learn when to use each context in Contexts and configuration.
- Provision a persistent database with PostgreSQL and database provisioning.
- Start an HTTP application from the React and ASP.NET Core sample.
The sample snapshot is intentionally small and is not a production ingredient or recipe catalog.
KitchenPC is MIT licensed. Runnable applications live in KitchenPC/Samples.