Files
the-biergarten-app/pipeline/src/data_generation/mock/generate_brewery.cpp

40 lines
1.2 KiB
C++

/**
* @file data_generation/mock/generate_brewery.cpp
* @brief Builds deterministic brewery names and descriptions by hashing city
* and country into fixed mock phrase catalogs.
*/
#include <string>
#include "data_generation/mock_generator.h"
auto MockGenerator::GenerateBrewery(const BreweryLocation& location,
const std::string& /*region_context*/)
-> BreweryResult {
const std::size_t hash = DeterministicHash(location);
const std::string& adjective =
kBreweryAdjectives.at(hash % kBreweryAdjectives.size());
const std::string& noun =
kBreweryNouns.at((hash / 7) % kBreweryNouns.size());
const std::string& base_description =
kBreweryDescriptions.at((hash / 13) % kBreweryDescriptions.size());
std::string name(location.city_name);
name.append(" ");
name.append(adjective);
name.append(" ");
name.append(noun);
std::string description = base_description;
description.append(" Based in ");
description.append(location.city_name);
if (!location.country_name.empty()) {
description.append(", ");
description.append(location.country_name);
}
description.append(".");
return {name, description};
}