예제 #1
0
        private void OnGetCombinedCall(CombinedCallData combinedCallData, string data)
        {
            m_NumberOfTestEntityExtraction--;
            Log.Status("TestAlchemyAPI", "Remaining: {0}, original text:{1}, OnGetCombinedCall: {2}, OnLongResult: {3}", m_NumberOfTestEntityExtraction, data, combinedCallData.EntityCombinedCommaSeperated, combinedCallData.ToLongString());

            if (m_NumberOfTestEntityExtraction <= 0)
            {
                Test(true);
                m_EntityExtractionTested = true;
            }
        }
    private void OnGetCombinedData(CombinedCallData combinedData, string data)
    {
        if (combinedData != null)
        {
            Log.Debug("ExampleAlchemyLanguage", "status: {0}", combinedData.status);
            Log.Debug("ExampleAlchemyLanguage", "url: {0}", combinedData.url);
            Log.Debug("ExampleAlchemyLanguage", "language: {0}", combinedData.language);
            Log.Debug("ExampleAlchemyLanguage", "text: {0}", combinedData.text);
            Log.Debug("ExampleAlchemyLanguage", "image: {0}", combinedData.image);

            if (combinedData.imageKeywords != null && combinedData.imageKeywords.Length > 0)
            {
                foreach (ImageKeyword imageKeyword in combinedData.imageKeywords)
                {
                    Log.Debug("ExampleAlchemyLanguage", "ImageKeyword: {0}, Score: {1}", imageKeyword.text, imageKeyword.score);
                }
            }

            if (combinedData.publicationDate != null)
            {
                Log.Debug("ExampleAlchemyLanguage", "publicationDate: {0}, Score: {1}", combinedData.publicationDate.date, combinedData.publicationDate.confident);
            }

            if (combinedData.authors != null && combinedData.authors.names.Length > 0)
            {
                foreach (string authors in combinedData.authors.names)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Authors: {0}", authors);
                }
            }

            if (combinedData.docSentiment != null)
            {
                Log.Debug("ExampleAlchemyLanguage", "DocSentiment: {0}, Score: {1}, Mixed: {2}", combinedData.docSentiment.type, combinedData.docSentiment.score, combinedData.docSentiment.mixed);
            }

            if (combinedData.feeds != null && combinedData.feeds.Length > 0)
            {
                foreach (Feed feed in combinedData.feeds)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Feeds: {0}", feed.feed);
                }
            }

            if (combinedData.keywords != null && combinedData.keywords.Length > 0)
            {
                foreach (Keyword keyword in combinedData.keywords)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Keyword: {0}, relevance: {1}", keyword.text, keyword.relevance);
                }
            }

            if (combinedData.concepts != null && combinedData.concepts.Length > 0)
            {
                foreach (Concept concept in combinedData.concepts)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance);
                }
            }

            if (combinedData.entities != null && combinedData.entities.Length > 0)
            {
                foreach (Entity entity in combinedData.entities)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Entity: {0}, Type: {1}, Relevance: {2}", entity.text, entity.type, entity.relevance);
                }
            }

            if (combinedData.relations != null && combinedData.relations.Length > 0)
            {
                foreach (Relation relation in combinedData.relations)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Relations: {0}", relation.subject.text);
                }
            }

            if (combinedData.taxonomy != null && combinedData.taxonomy.Length > 0)
            {
                foreach (Taxonomy taxonomy in combinedData.taxonomy)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Taxonomy: {0}, Score: {1}, Confident: {2}", taxonomy.label, taxonomy.score, taxonomy.confident);
                }
            }

            if (combinedData.dates != null && combinedData.dates.Length > 0)
            {
                foreach (Date date in combinedData.dates)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Dates", date.text, date.date);
                }
            }

            if (combinedData.docEmotions != null && combinedData.docEmotions.Length > 0)
            {
                foreach (DocEmotions emotions in combinedData.docEmotions)
                {
                    Log.Debug("ExampleAlchemyLanguage", "Doc Emotions: anger: {0}, disgust: {1}, fear: {2}, joy: {3}, sadness: {4}", emotions.anger, emotions.disgust, emotions.fear, emotions.joy, emotions.sadness);
                }
            }
        }
        else
        {
            Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data!");
        }
    }
예제 #3
0
 private void OnGetCombinedDataText(CombinedCallData combinedData, string data)
 {
     Log.Debug("ExampleAlchemyLanguage", "Alchemy Language - Get Combined Data Text response: {0}", data);
     Test(combinedData != null);
     _getCombinedDataTextTested = true;
 }
 private void OnGetCombinedDataText(CombinedCallData combinedData, Dictionary <string, object> customData)
 {
     Log.Debug("ExampleAlchemyLanguage.OnGetCombinedDataText()", "Alchemy Language - Get Combined Data Text response: {0}", customData["json"].ToString());
     _getCombinedDataTextTested = true;
 }
예제 #5
0
 private void OnGetCombinedDataUrl(CombinedCallData combinedData, string data)
 {
     Log.Debug("ExampleAlchemyLanguage", "Alchemy Language - Get Combined Data Url response: {0}", data);
     _getCombinedDataURLTested = true;
 }