Page MenuHomePhabricator (Chris)

name_generator.h
No OneTemporary

Authored By
Unknown
Size
798 B
Referenced Files
None
Subscribers
None

name_generator.h

#pragma once
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
//Second order markov chain name generator
class NameGenerator {
public:
struct ProbData {
int occurances;
std::unordered_map<int, int> nextCount;
};
std::map<std::pair<int,int>,ProbData> data;
std::vector<std::string> names;
std::map<std::pair<int,int>,int> nameStarts;
std::set<std::string> usedNames;
float mutationChance;
bool useGeneration;
bool preventDuplicates;
NameGenerator();
void clear();
void read(const std::string& filename);
void write(const std::string& filename);
bool hasName(const std::string& name);
void addName(const std::string& name);
void addAssociation(int first, int second, int next);
unsigned getNameCount();
std::string generate();
};

File Metadata

Mime Type
text/x-c++
Expires
Sun, Nov 15, 4:14 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
130321
Default Alt Text
name_generator.h (798 B)

Event Timeline