| /* ๊ฐ๋จํ ์์ด ํ ํฌ๋์ด์ โ BM25์ฉ. | |
| * ์๋ฌธ์ํ + ๋น์์ซ์ ๋ถ๋ฆฌ. HotpotQA/MuSiQue ๊ฐ์ ์์ด ์ํค ํ ์คํธ๊ฐ ๋์์ด๋ผ | |
| * ์ด ์ ๋๋ก ์ถฉ๋ถํ๋ค. ํํ์ ๋ถ์์ ๋ฃ์ง ์๋๋ค โ ๋ฃ์ผ๋ฉด baseline์ด ์๋๋ผ | |
| * ์ด๋ฏธ ํ๋๋ ๊ฒ์ด ๋์ด ๋น๊ต๊ฐ ๋ถ๊ณต์ ํด์ง๋ค. */ | |
| inline std::vector<std::string> tokenize(const std::string& s) { | |
| std::vector<std::string> out; | |
| std::string cur; | |
| cur.reserve(24); | |
| for (unsigned char c : s) { | |
| if (std::isalnum(c)) { | |
| cur.push_back(static_cast<char>(std::tolower(c))); | |
| } else if (!cur.empty()) { | |
| out.push_back(cur); | |
| cur.clear(); | |
| } | |
| } | |
| if (!cur.empty()) out.push_back(cur); | |
| return out; | |
| } | |