public Result HeardSelfSayResponse(bool saveResultsAsIfRealtime, bool useConversationDataAsIfRealtime, User theFactSpeaker, User toWhom, string message, Result resultOfToWhomSpeakingToFactSpeaker, ThreadControl control) { if (this.TurnOffSelfListening) { return(null); } Result LR = null; if (message == null) { return(null); } bool lts = ListeningToSelf; bool prochp = ProcessHeardPreds; if (!lts && !prochp) { return(null); } message = ToHeard(message); if (string.IsNullOrEmpty(message)) { return(null); } Result result = null; var v = new SplitIntoSentences(null, message); bool stopProcessing = false; if (control != null) { control.AbortOrInteruptedRaised += (ctl, ex) => { stopProcessing = true; } } ; var sentences = v.TransformU(); for (int i = 0; i < sentences.Length; i++) { Unifiable sentence = sentences[i]; if (stopProcessing) { Unifiable unifiableJoin = Unifiable.Join(" <br> ", sentences, i, sentences.Length - 1); return(AbortedResult(unifiableJoin, result, control)); } result = HeardSomeoneSay1Sentence(saveResultsAsIfRealtime, useConversationDataAsIfRealtime, theFactSpeaker, toWhom, sentence, result, control); } return(result); }
public void testSplitterAllMadeFromWhiteSpace() { this.mockSplitter = new SplitIntoSentences(this.mockBot, " "); Assert.AreEqual(new string[0], this.mockSplitter.Transform()); }
public void testSplitterAllSentenceMadeOfSplitters() { this.mockSplitter = new SplitIntoSentences(this.mockBot, "!?.;"); Assert.AreEqual(new string[0], this.mockSplitter.Transform()); }
public void testSplitterAllSentenceWithSplitterAtStart() { this.mockSplitter = new SplitIntoSentences(this.mockBot, ".This is a sentence without splitters"); Assert.AreEqual("This is a sentence without splitters", (string)this.mockSplitter.Transform()[0]); }
public void testSplitterAllNoRawInput() { this.mockSplitter = new SplitIntoSentences(this.mockBot, ""); Assert.AreEqual(new string[0], this.mockSplitter.Transform()); }
public void testSplitterAllTokensPassedByMethod() { this.mockSplitter = new SplitIntoSentences(this.mockBot); Assert.AreEqual(this.goodResult, this.mockSplitter.Transform(rawInput)); }
// Token: 0x0600008E RID: 142 RVA: 0x000058A4 File Offset: 0x000048A4 public Result Chat(Request request) { Result result = new Result(request.user, this, request); if (this.isAcceptingUserInput) { AIMLLoader aimlloader = new AIMLLoader(this); SplitIntoSentences splitIntoSentences = new SplitIntoSentences(this); string[] array = splitIntoSentences.Transform(request.rawInput); foreach (string text in array) { result.InputSentences.Add(text); string item = aimlloader.generatePath(text, request.user.getLastBotOutput(), request.user.Topic, true); result.NormalizedPaths.Add(item); } foreach (string text2 in result.NormalizedPaths) { SubQuery subQuery = new SubQuery(text2); subQuery.Template = this.Graphmaster.evaluate(text2, subQuery, request, MatchState.UserInput, new StringBuilder()); result.SubQueries.Add(subQuery); } using (List <SubQuery> .Enumerator enumerator2 = result.SubQueries.GetEnumerator()) { while (enumerator2.MoveNext()) { SubQuery subQuery2 = enumerator2.Current; if (subQuery2.Template.Length > 0) { try { XmlNode node = AIMLTagHandler.getNode(subQuery2.Template); string text3 = this.processNode(node, subQuery2, request, result, request.user); if (text3.Length > 0) { result.OutputSentences.Add(text3); } } catch (Exception ex) { if (this.WillCallHome) { this.phoneHome(ex.Message, request); } this.writeToLog(string.Concat(new string[] { "WARNING! A problem was encountered when trying to process the input: ", request.rawInput, " with the template: \"", subQuery2.Template, "\"" })); } } } goto IL_1E4; } } result.OutputSentences.Add(this.NotAcceptingUserInputMessage); IL_1E4: result.Duration = DateTime.Now - request.StartedOn; request.user.addResult(result); return(result); }