-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNameAssociator.h
More file actions
62 lines (51 loc) · 2.25 KB
/
NameAssociator.h
File metadata and controls
62 lines (51 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <map>
#include <vector>
#include <string>
#include <filesystem>
#include "SyllableAssociator.h"
#include "SymbolPairing.h"
class NameAssociator
{
public:
using RegionLabel = std::string;
using ConsonanceList = std::vector<SyllableAssociator::ConsonanceLabel>;
struct ConsoncancePossibilities { ConsonanceList first_names, last_names, particles; };
using FullNameFormat = std::string;
struct FullNameMixup { FullNameFormat format; ConsoncancePossibilities possibilities; };
using FullNameDict = std::map<RegionLabel, FullNameMixup>;
/**
** @brief Constructor of the classs. Calls the CSVReader class
** @param filepath : path to the CSV file to parse
** @param syllable_reader : an instance of the Syllable Associator
** @param SymbolPairing : How the format symbol should be read
**/
NameAssociator(const std::filesystem::path & filepath, SyllableAssociator && syllable_reader, SymbolPairing && symbol_pairing);
/**
** @brief computes the list of available regions and returns it
** @return the list of regions available in the dictionary
**/
std::vector<RegionLabel> get_region_list() const;
/**
** @brief computes the list of available regions and returns it (static version only : only reads the first column of the file)
** @param filepath : path to the CSV file to parse
** @return the list of regions available in the dictionary
**/
static std::vector<RegionLabel> get_region_list(const std::filesystem::path & filepath);
/**
** @brief generates a random name given a region
** @param region : the desired region
** @return the generated name
**/
std::string generate_random_full_name(const RegionLabel & region) const;
/**
** @brief generates a formated string of the full name format
** @param region : the desired region
** @return the format formated
**/
std::string get_formated_full_name_format(const RegionLabel & region) const;
private:
SyllableAssociator m_syllable_reader;
SymbolPairing m_symbol_pairing;
FullNameDict m_full_name_dict;
};