2016-04-22 05:31:46 -04:00
|
|
|
#include "extractor/suffix_table.hpp"
|
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
#include "extractor/scripting_environment.hpp"
|
2016-04-22 05:31:46 -04:00
|
|
|
|
|
|
|
#include <boost/algorithm/string.hpp>
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
2016-07-11 11:44:58 -04:00
|
|
|
SuffixTable::SuffixTable(ScriptingEnvironment &scripting_environment)
|
2016-04-22 05:31:46 -04:00
|
|
|
{
|
2016-07-11 11:44:58 -04:00
|
|
|
std::vector<std::string> suffixes_vector = scripting_environment.GetNameSuffixList();
|
2016-04-22 05:31:46 -04:00
|
|
|
for (auto &suffix : suffixes_vector)
|
|
|
|
boost::algorithm::to_lower(suffix);
|
|
|
|
suffix_set.insert(std::begin(suffixes_vector), std::end(suffixes_vector));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SuffixTable::isSuffix(const std::string &possible_suffix) const
|
|
|
|
{
|
|
|
|
return suffix_set.count(possible_suffix) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace extractor */
|
|
|
|
} /* namespace osrm */
|