diff --git a/highlighter.h b/highlighter.h new file mode 100644 index 0000000..4018894 --- /dev/null +++ b/highlighter.h @@ -0,0 +1,29 @@ +#pragma once +#include +#include + +class Highlighter { +public: + struct HighlightSpan { + size_t start; + size_t length; + }; + + static std::string highlight_text( + const std::string& text, + const std::vector& keywords, + const std::string& pre_tag = "", + const std::string& post_tag = "" + ); + + static std::vector find_keyword_positions( + const std::string& text, + const std::vector& keywords + ); + + static std::string extract_snippet( + const std::string& text, + const std::vector& spans, + size_t context_size = 50 + ); +}; \ No newline at end of file