mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 01:54:00 +00:00
40 lines
1.2 KiB
C++
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};
|
|
}
|