示例#1
0
        public static async Task <TextAnalysisDocumentStore> GetPhrasesforConversation()
        {
            TextAnalysisClient        client       = new TextAnalysisClient("d75051af54634a9e809edf8b2bf4e262");
            TextAnalysisDocumentStore SentResponse = await client.ExtractKeyphrases(fullConvHistory);

            return(SentResponse);
        }
示例#2
0
            public async Task AddSentance(string text, TextAnalysisDocumentStore fullhistory)
            {
                MessageCount++;
                Sentances.Add(text);
                if (Sentances.Count > 2)
                {
                    string merged = string.Empty;
                    foreach (string item in Sentances)
                    {
                        merged += " " + item;
                    }

                    TextAnalysisDocumentStore localStore = new TextAnalysisDocumentStore();
                    TextAnalysisDocument      doc        = new TextAnalysisDocument()
                    {
                        id = (localStore.documents.Count + 1).ToString(), text = merged
                    };
                    localStore.documents.Add(doc);
                    TextAnalysisClient client = new TextAnalysisClient("d75051af54634a9e809edf8b2bf4e262");
                    Sentances.Clear();
                    TextAnalysisDocumentStore SentResponse = await client.AnalyzeSentiment(localStore);

                    this.Sentiment = SentResponse.documents[0].score;
                    Graph.Add(ConversationState.GlobalTime++, Sentiment);
                    doc.id = (Convert.ToInt64(fullhistory.documents.Count) + 1).ToString();
                    fullhistory.documents.Add(doc);
                }
            }