public void Initialize() { alchemyObj = new AlchemyAPI.AlchemyAPI(); alchemyObj.LoadAPIKey("alchemyapikey.txt"); eparams = new AlchemyAPI_EntityParams(); eparams.setMaxRetrieve(250); kparams = new AlchemyAPI_KeywordParams(); kparams.setMaxRetrieve(250); cparams = new AlchemyAPI_ConceptParams(); cparams.setMaxRetrieve(250); }
protected DataSet GetConcepts(string url) { DataSet dsConcepts = new DataSet(); #if TEST // Using previously captured dataset dsConcepts.ReadXml("alchemyConceptsTestResponse.xml"); #else if (!Cached("Concept", url, ref dsConcepts)) { AlchemyAPI_ConceptParams eparams = new AlchemyAPI_ConceptParams(); eparams.setMaxRetrieve(250); string xml = alchemyObj.URLGetRankedConcepts(url, eparams); TextReader tr = new StringReader(xml); XmlReader xr = XmlReader.Create(tr); dsConcepts.ReadXml(xr); xr.Close(); tr.Close(); Cache("Concept", url, dsConcepts); } #endif return dsConcepts; }