Skip to content

Commit

Permalink
[FEATURE] Search for similarities also in the extended info
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Sep 6, 2021
1 parent 62250d1 commit e3eec0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paramkit/include/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ namespace paramkit {
//! Checks if the description contains the keyword
virtual bool isKeywordInDescription(const std::string &keyword)
{
util::stringsim_type sim_type = util::has_keyword(m_info, keyword);
if (util::has_keyword(m_info, keyword)) return true;

util::stringsim_type sim_type = util::has_keyword(m_extInfo, keyword);
return (sim_type != util::SIM_NONE) ? true : false;
}

Expand Down
6 changes: 6 additions & 0 deletions paramkit/strings_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ bool paramkit::util::has_similar_histogram(const char s1[], const char s2[])

paramkit::util::stringsim_type paramkit::util::has_keyword( std::string param, std::string filter)
{
if (param.empty() || filter.empty()) {
return SIM_NONE;
}
param = to_lowercase(param);
filter = to_lowercase(filter);
const bool sim_found = (param.find(filter) != std::string::npos) || (filter.find(param) != std::string::npos);
Expand All @@ -128,6 +131,9 @@ paramkit::util::stringsim_type paramkit::util::has_keyword( std::string param, s

paramkit::util::stringsim_type paramkit::util::is_string_similar(const std::string &param, const std::string &filter)
{
if (param.empty() || filter.empty()) {
return SIM_NONE;
}
bool sim_found = false;
if (has_keyword(param, filter) != SIM_NONE) {
return SIM_SUBSTR;
Expand Down

0 comments on commit e3eec0f

Please sign in to comment.