private async void button_Click(object sender, RoutedEventArgs e) { var text = this.inputBox.Text; var client = new EntityLinkingServiceClient("6a15dbc029324c9caefcaece90863e28"); var linkResponse = await client.LinkAsync(text); var result = string.Join(", ", linkResponse.Select(i => i.WikipediaID).ToList()); this.outputBlock.Text = result; }
private async void OnButtonClickedAsync(object sender, EventArgs e) { var text = txtvalue.Text; EntityLinkingServiceClient client = new EntityLinkingServiceClient("e52917bb34d1426f80ac816dc818e8de", "https://api.labs.cognitive.microsoft.com"); var linkResponse = await client.LinkAsync(text); var result = string.Join(", ", linkResponse.Select(i => i.WikipediaID).ToList()); this.outputBlock.Text = result; //await MakeRequest(); }
// Get Entitiy Linking results for input text private async void btnGetResult_Click(object sender, RoutedEventArgs e) { var text = this.inputBox.Text; // Create a new Cognitive Services Entity Linking Service client, pass our subscription ID var client = new EntityLinkingServiceClient("b2663927e9d242269740dd5390070e76"); // Send our text for entity linking var linkResponse = await client.LinkAsync(text); // Display the results var result = string.Join(", ", linkResponse.Select(i => i.WikipediaID).ToList()); this.outputBlock.Text = result; }
static EnrichFunction() { blobContainer = new ImageStore($"DefaultEndpointsProtocol=https;AccountName={Config.IMAGE_AZURE_STORAGE_ACCOUNT_NAME};AccountKey={Config.IMAGE_BLOB_STORAGE_ACCOUNT_KEY};EndpointSuffix=core.windows.net", Config.IMAGE_BLOB_STORAGE_CONTAINER); visionClient = new Vision(Config.VISION_API_KEY, Config.VISION_API_REGION); var serviceClient = new SearchServiceClient(Config.AZURE_SEARCH_SERVICE_NAME, new SearchCredentials(Config.AZURE_SEARCH_ADMIN_KEY)); indexClient = serviceClient.Indexes.GetClient(Config.AZURE_SEARCH_INDEX_NAME); linkedEntityClient = new EntityLinkingServiceClient(Config.ENTITY_LINKING_API_KEY); cosmosDb = new AnnotationStore(); // read the list of cia-cryptonymns using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EnricherFunction.cia-cryptonyms.json")) using (StreamReader reader = new StreamReader(stream)) { cryptonymns = JsonConvert.DeserializeObject <Dictionary <string, string> >(reader.ReadToEnd()); } }
public static async Task <string> getEntityLink(string messageBody) { //Set up response var response = ""; try { //Step 2a: Call into the Entity Linking API; EntityLink[] entityResult; var ELISClient = new EntityLinkingServiceClient(Keys.ELIS); entityResult = await ELISClient.LinkAsync(messageBody); //Step 2b: Store the results as a comma separated list of wikipedia URLs response += string.Join(", ", entityResult.Select(i => "https://en.wikipedia.org/wiki/" + i.WikipediaID.Replace(" ", "_")).ToList()); } catch (Exception ex) { response = ex.ToString(); } //Return response return(response); }
/// <summary> /// EntityLinking constructor. Creates a new <see cref="EntityLinkingServiceClient"/> object /// </summary> /// <param name="apiKey">Entity Linking API key</param> public EntityLinking(string apiKey) { _entityLinkingServiceClient = new EntityLinkingServiceClient(apiKey, "ROOT_URI"); }