public string TextGetRelations(string text, AlchemyAPI_RelationParams parameters) { CheckText(text); parameters.setText(text); return(POST("TextGetRelations", "text", parameters)); }
public string URLGetRelations(string url, AlchemyAPI_RelationParams parameters) { CheckURL(url); parameters.setUrl(url); return(GET("URLGetRelations", "url", parameters)); }
public string HTMLGetRelations(string html, string url, AlchemyAPI_RelationParams parameters) { CheckHTML(html, url); parameters.setHtml(html); parameters.setUrl(url); return(POST("HTMLGetRelations", "html", parameters)); }
public static void Main() { // Create an AlchemyAPI object. AlchemyAPI.AlchemyAPI alchemyObj = new AlchemyAPI.AlchemyAPI(); // Load an API key from disk. alchemyObj.LoadAPIKey("api_key.txt"); // Extract a ranked list of relations from a web URL. string xml = alchemyObj.URLGetRelations("http://www.techcrunch.com/"); Console.WriteLine (xml); // Extract a ranked list of relations from a text string. xml = alchemyObj.TextGetRelations("Hello there, my name is Bob Jones. I live in the United States of America. Where do you live, Fred?"); Console.WriteLine (xml); // Load a HTML document to analyze. StreamReader streamReader = new StreamReader("data/example.html"); string htmlDoc = streamReader.ReadToEnd(); streamReader.Close(); // Extract a ranked list of relations from a HTML document. xml = alchemyObj.HTMLGetRelations(htmlDoc, "http://www.test.com/"); Console.WriteLine (xml); AlchemyAPI_RelationParams relationParams = new AlchemyAPI_RelationParams(); relationParams.setSentiment(true); relationParams.setEntities(true); relationParams.setDisambiguate(true); relationParams.setSentimentExcludeEntities(true); xml = alchemyObj.TextGetRelations("Madonna enjoys tasty Pepsi. I love her style.", relationParams); Console.WriteLine (xml); relationParams.setSentiment(true); relationParams.setRequireEntities(true); relationParams.setSentimentExcludeEntities(false); xml = alchemyObj.TextGetRelations("Madonna enjoys tasty Pepsi. I love her style.", relationParams); Console.WriteLine (xml); }
public string URLGetRelations(string url, AlchemyAPI_RelationParams parameters) { CheckURL(url); parameters.setUrl(url); return GET("URLGetRelations", "url", parameters); }
public string TextGetRelations(string text, AlchemyAPI_RelationParams parameters) { CheckText(text); parameters.setText(text); return POST("TextGetRelations", "text", parameters); }
public string HTMLGetRelations(string html, string url, AlchemyAPI_RelationParams parameters) { CheckHTML(html, url); parameters.setHtml(html); parameters.setUrl(url); return POST("HTMLGetRelations", "html", parameters); }