From f6b70b9127257451ff088ba881f7b4cf216e6e1f Mon Sep 17 00:00:00 2001 From: ENCRYPTED_FOREVER Date: Wed, 4 Sep 2024 22:24:10 +0300 Subject: [PATCH] Fix for https://github.com/ark0f/tg-bot-api/issues/21 --- src/parser/sentence.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/parser/sentence.rs b/src/parser/sentence.rs index 6a26ff4..8abc7af 100644 --- a/src/parser/sentence.rs +++ b/src/parser/sentence.rs @@ -19,6 +19,12 @@ impl Pattern { fn parts(self) -> Vec { match self { Pattern::ReturnType => vec![ + SearcherPattern::default() + .by_word("Returns") + .by_word("the") + .by_word("bot's") + .by_word("Telegram") + .exclude(), SearcherPattern::default().by_word("On").by_word("success"), SearcherPattern::default().by_word("Returns"), SearcherPattern::default().by_word("returns"), @@ -95,7 +101,7 @@ impl SearcherPattern { self } - /// Useful for partial matching + /// Useful for partial matching fn with_offset(mut self, offset: isize) -> Self { self.offset = offset; self @@ -518,6 +524,9 @@ where as usize; let sentence = &sentence[offset..]; + if sentence.contains(&["Telegram"]) { + println!("Found {sentence:?} via pattern {pattern:?}"); + } result = Some(sentence); break 'sentences; }