| 255 | } |
| 256 | |
| 257 | void PreprocessBeforeTokenization(UniString & query) |
| 258 | { |
| 259 | search::Delimiters const delims; |
| 260 | |
| 261 | for (auto const & replacement : kPreprocessReplacements) |
| 262 | { |
| 263 | auto start = query.begin(); |
| 264 | while ((start = std::search(start, query.end(), replacement.first.begin(), replacement.first.end())) != query.end()) |
| 265 | { |
| 266 | auto end = start + replacement.first.size(); |
| 267 | if ((start == query.begin() || delims(*(start - 1))) && (end == query.end() || delims(*end))) |
| 268 | { |
| 269 | auto const dist = std::distance(query.begin(), start); |
| 270 | query.Replace(start, end, replacement.second.begin(), replacement.second.end()); |
| 271 | start = query.begin() + dist; |
| 272 | } |
| 273 | start += 1; |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | UniString FeatureTypeToString(uint32_t type) |
| 279 | { |