Blender
V3.3
|
Namespaces | |
tests | |
Functions | |
static int64_t | count_utf8_code_points (StringRef str) |
int | damerau_levenshtein_distance (StringRef a, StringRef b) |
int | get_fuzzy_match_errors (StringRef query, StringRef full) |
static bool | match_word_initials (StringRef query, Span< StringRef > words, Span< int > word_match_map, MutableSpan< bool > r_word_is_matched, int start=0) |
static int | get_shortest_word_index_that_startswith (StringRef query, Span< StringRef > words, Span< int > word_match_map) |
static int | get_word_index_that_fuzzy_matches (StringRef query, Span< StringRef > words, Span< int > word_match_map, int *r_error_count) |
static int | score_query_against_words (Span< StringRef > query_words, Span< StringRef > result_words) |
void | extract_normalized_words (StringRef str, LinearAllocator<> &allocator, Vector< StringRef, 64 > &r_words) |
Variables | |
static constexpr int | unused_word = -1 |
Definition at line 19 of file string_search.cc.
References BLI_strnlen_utf8(), and str.
Referenced by damerau_levenshtein_distance(), and get_fuzzy_match_errors().
Definition at line 24 of file string_search.cc.
References Freestyle::a, usdtokens::b(), BLI_str_utf8_as_unicode_step(), count_utf8_code_points(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), min, v1, and v2.
Referenced by get_fuzzy_match_errors(), and blender::string_search::tests::TEST().
void blender::string_search::extract_normalized_words | ( | StringRef | str, |
LinearAllocator<> & | allocator, | ||
Vector< StringRef, 64 > & | r_words | ||
) |
Definition at line 344 of file string_search.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert, BLI_str_tolower_ascii(), BLI_str_utf8_as_unicode(), BLI_str_utf8_as_unicode_step(), blender::LinearAllocator< Allocator >::copy_string(), blender::StringRefBase::data(), blender::StringRef::drop_prefix(), ELEM, offset, size(), str, blender::StringRefBase::substr(), UI_MENU_ARROW_SEP, and UI_MENU_ARROW_SEP_UNICODE.
Referenced by BLI_string_search_add(), BLI_string_search_query(), and blender::string_search::tests::TEST().
Definition at line 87 of file string_search.cc.
References blender::StringRefBase::begin(), BLI_assert, BLI_str_utf8_as_unicode(), BLI_str_utf8_size(), count_utf8_code_points(), damerau_levenshtein_distance(), blender::math::distance(), ELEM, blender::StringRefBase::end(), blender::StringRefBase::find(), max, min, blender::StringRefBase::not_found, and query.
Referenced by get_word_index_that_fuzzy_matches(), and blender::string_search::tests::TEST().
|
static |
Definition at line 228 of file string_search.cc.
References blender::Span< T >::index_range(), INT32_MAX, query, blender::StringRefBase::size(), blender::StringRefBase::startswith(), and unused_word.
Referenced by score_query_against_words().
|
static |
Definition at line 249 of file string_search.cc.
References get_fuzzy_match_errors(), blender::Span< T >::index_range(), query, and unused_word.
Referenced by score_query_against_words().
|
static |
Takes a query and tries to match it with the first characters of some words. For example, "msfv" matches "Mark Sharp from Vertices". Multiple letters of the beginning of a word can be matched as well. For example, "seboulo" matches "select boundary loop". The order of words is important. So "bose" does not match "select boundary". However, individual words can be skipped. For example, "rocc" matches "rotate edge ccw".
Definition at line 166 of file string_search.cc.
References BLI_assert, BLI_str_utf8_as_unicode_step(), blender::StringRefBase::data(), blender::MutableSpan< T >::fill(), query, blender::Span< T >::size(), blender::StringRefBase::size(), and unused_word.
Referenced by score_query_against_words().
|
static |
Checks how well the query matches a result. If it does not match, -1 is returned. A positive return value indicates how good the match is. The higher the value, the better the match.
Definition at line 272 of file string_search.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), get_shortest_word_index_that_startswith(), get_word_index_that_fuzzy_matches(), blender::Span< T >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), match_word_initials(), blender::Span< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and unused_word.
Referenced by BLI_string_search_query().
|
staticconstexpr |
Definition at line 154 of file string_search.cc.
Referenced by get_shortest_word_index_that_startswith(), get_word_index_that_fuzzy_matches(), match_word_initials(), and score_query_against_words().