Example #1
0
    static public void Main()
    {
        // Create an AlchemyAPI object.
        AlchemyAPI.AlchemyAPI    alchemyObj    = new AlchemyAPI.AlchemyAPI();
        AlchemyAPI_KeywordParams keywordParams = new AlchemyAPI_KeywordParams();
        AlchemyAPI_EntityParams  entityParams  = new AlchemyAPI_EntityParams();

        // Load an API key from disk.
        alchemyObj.LoadAPIKey("api_key.txt");
        keywordParams.setMaxRetrieve(1);
        keywordParams.setShowSourceText(true);
        keywordParams.setSourceText(AlchemyAPI_KeywordParams.SourceTextMode.RAW);
        keywordParams.setSentiment(true);
        // Extract a ranked list of named entities from a web URL with parameters.
        string xml = alchemyObj.URLGetRankedKeywords("http://www.techcrunch.com/", keywordParams);

        Console.WriteLine(xml);

        // Load a HTML document to analyze.
        StreamReader streamReader = new StreamReader("data/example.html");
        string       htmlDoc      = streamReader.ReadToEnd();

        streamReader.Close();


        entityParams.setMaxRetrieve(3);
        entityParams.setDisambiguate(true);
        entityParams.setOutputMode(AlchemyAPI_BaseParams.OutputMode.RDF);
        entityParams.setSentiment(true);
        // Extract a ranked list of named entities from a HTML document with parameters.
        xml = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/", entityParams);
        Console.WriteLine(xml);
    }
Example #2
0
	static public 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 named entities from a web URL.
		string xml = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/");
		Console.WriteLine (xml);


		// Extract a ranked list of named entities from a text string.
		xml = alchemyObj.TextGetRankedNamedEntities("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 named entities from a HTML document.
		xml = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/");
		Console.WriteLine (xml);
	}
Example #3
0
    static public 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 named entities from a web URL.
        string xml = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/");

        Console.WriteLine(xml);


        // Extract a ranked list of named entities from a text string.
        xml = alchemyObj.TextGetRankedNamedEntities("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 named entities from a HTML document.
        xml = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/");
        Console.WriteLine(xml);
    }
Example #4
0
    public static void Main()
    {
        // Create an AlchemyAPI object.
        AlchemyAPI.AlchemyAPI alchemyObj = new AlchemyAPI.AlchemyAPI();
        AlchemyAPI_KeywordParams keywordParams = new AlchemyAPI_KeywordParams();
        AlchemyAPI_EntityParams entityParams = new AlchemyAPI_EntityParams();

        // Load an API key from disk.
        alchemyObj.LoadAPIKey("api_key.txt");
        keywordParams.setMaxRetrieve(1);
        keywordParams.setShowSourceText(true);
        keywordParams.setSourceText(AlchemyAPI_KeywordParams.SourceTextMode.RAW);
        keywordParams.setSentiment(true);
        // Extract a ranked list of named entities from a web URL with parameters.
        string xml = alchemyObj.URLGetRankedKeywords("http://www.techcrunch.com/", keywordParams);
        Console.WriteLine (xml);

        // Load a HTML document to analyze.
        StreamReader streamReader = new StreamReader("data/example.html");
        string htmlDoc = streamReader.ReadToEnd();
        streamReader.Close();

        entityParams.setMaxRetrieve(3);
        entityParams.setDisambiguate(true);
        entityParams.setOutputMode(AlchemyAPI_BaseParams.OutputMode.RDF);
        entityParams.setSentiment(true);
        // Extract a ranked list of named entities from a HTML document with parameters.
        xml = alchemyObj.HTMLGetRankedNamedEntities(htmlDoc, "http://www.test.com/", entityParams);
        Console.WriteLine (xml);
    }