Skip to content

A C# application for manipulation of a Watson Discovery environment

License

Notifications You must be signed in to change notification settings

modcarroll/csharp-discovery-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C#/.NET Watson Discovery Sample Application

Included components

  • Watson Discovery: A cognitive search and content analytics engine for applications to identify patterns, trends, and actionable insights.

Steps

  1. Clone the repo
  2. Create IBM Cloud services
  3. Load the Discovery files
  4. Configure credentials
  5. Run the application

1. Clone the repo

git clone https://github.com/modlanglais/csharp-discovery-example

2. Create IBM Cloud services

Create the following services:

3. Load the Discovery files

Launch the Watson Discovery tool. Create a new data collection by selecting the Update your own data option. Give the data collection a unique name.

When prompted to get started by uploading your data, select and upload your files. Once uploaded, you can then use the Configure data option to add the Keyword Extraction enrichment.

Note: failure to do this will result in no keywords being shown in the app.

Once the enrichments are selected, use the Apply changes to collection button. Warning - this make take several minutes to complete.

There may be a limit to the number of files you can upload, based on your IBM Cloud account permissions.

4. Configure credentials

Adding a .env file would be simpler, but for this iteration of this application the credentials will just be hard-corded. Warning Do NOT upload your application without first hiding your credentials!

Edit the Program.cs file to add your credentials on the following lines:

// Add the environment and collection IDs here
String environmentId = "{environment-id}";
String collectionId = "{collection-id}";

TokenOptions tokenOptions = new TokenOptions()
{
    // Add your URL and API key here
    IamApiKey = "{api-key}",
    ServiceUrl = "{url}"
};

// Add the Discovery version here
DiscoveryService service = new DiscoveryService(tokenOptions, "{version}");

// Add the query you would like to use here, i.e. "purple houses"
String inputQuery = "{your natural language query here}";

5. Run the application

  1. Install .Net, etc.
  2. Start the app by running dotnet run.
  3. This is a command line application, so there is no UI.

About

A C# application for manipulation of a Watson Discovery environment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages