| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "makoveeva_s_number_of_sentence/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <string> | ||
| 4 | |||
| 5 | #include "makoveeva_s_number_of_sentence/common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace makoveeva_s_number_of_sentence { | ||
| 8 | |||
| 9 |
1/2✓ Branch 1 taken 216 times.
✗ Branch 2 not taken.
|
216 | SentencesCounterSEQ::SentencesCounterSEQ(const InType &in) { |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 11 | GetInput() = in; | ||
| 12 | 216 | GetOutput() = 0; | |
| 13 | 216 | } | |
| 14 | |||
| 15 | 216 | bool SentencesCounterSEQ::ValidationImpl() { | |
| 16 | 216 | return true; | |
| 17 | } | ||
| 18 | |||
| 19 | 216 | bool SentencesCounterSEQ::PreProcessingImpl() { | |
| 20 | 216 | return true; | |
| 21 | } | ||
| 22 | |||
| 23 | 216 | bool SentencesCounterSEQ::RunImpl() { | |
| 24 | const std::string &text = GetInput(); | ||
| 25 | int sentence_count = 0; | ||
| 26 | bool in_sentence_end = false; | ||
| 27 | |||
| 28 |
2/2✓ Branch 0 taken 3672 times.
✓ Branch 1 taken 216 times.
|
3888 | for (char c : text) { |
| 29 |
2/2✓ Branch 0 taken 824 times.
✓ Branch 1 taken 2848 times.
|
3672 | if (c == '.' || c == '!' || c == '?') { |
| 30 |
2/2✓ Branch 0 taken 632 times.
✓ Branch 1 taken 192 times.
|
824 | if (!in_sentence_end) { |
| 31 | 632 | sentence_count++; | |
| 32 | in_sentence_end = true; | ||
| 33 | } | ||
| 34 | } else { | ||
| 35 | in_sentence_end = false; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 216 | GetOutput() = sentence_count; | |
| 40 | 216 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 | 216 | bool SentencesCounterSEQ::PostProcessingImpl() { | |
| 44 | 216 | return true; | |
| 45 | } | ||
| 46 | |||
| 47 | } // namespace makoveeva_s_number_of_sentence | ||
| 48 |