|
persona-generator 4.1.3
Complete characters composed from the other dasmig generators for C++23
|
Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Data and Method · Releases
Complete characters composed from the other dasmig generators: one call draws a country, a city, a birth, a body, a name, interests, an occupation and a personality, each conditioned on what was drawn before, and returns them as typed results and one JSON document.
persona_request can fix the country, the sex, an age range, the reference date and the number of traits. What is left out is drawn. Set relations to also get the persona's family (parents, siblings, partners, children), drawn by relationship-generator; it is off by default and changes nothing else.get_persona(request, seed) is a pure function of the request, the seed and the data, and persona::seed() replays a previous persona. Each library draws from its own stream split from the seed, so forcing one choice does not shift the others.to_json() writes every library's result as that library writes it; signature() records the seed and a hash of the data of all eight libraries and the request.lite, full) and layers (extend()) are the persona's. Construct a psg over your own instances to use different data side by side.personagen.hpp is the library released here. It composes these libraries, which must be on the include path (with dasmig-core in each): biodata, birth, city, country, entity, interest, name, occupation, relationship and trait. The release notes list the versions it was tested with. Add
to the files you want to use it in. Each library finds its data as it does alone (a resources folder, or its compiled-in lite tier: define DASMIG_COUNTRY_EMBED, DASMIG_CITY_EMBED, DASMIG_BIRTH_EMBED, DASMIG_BIODATA_EMBED, DASMIG_NAME_EMBED, DASMIG_INTEREST_EMBED, DASMIG_OCCUPATION_EMBED and DASMIG_TRAIT_EMBED).
See the usage guide for everything else.
@dasmig/persona is this library compiled to WebAssembly, with the lite data of the libraries it composes built in, for browsers, Web Workers and Node 20+: npm install @dasmig/persona. Its source is in [package/](package) and the C API it wraps in [wasm/](wasm). make package (or python3 scripts/build_package.py) builds it with Emscripten into build/package, and CI tests it in Node and in headless Chrome, benchmarks it and packs it. The package has its own version; the library versions each build contains are in its versions.
The libraries it composes are sibling checkouts (LIBS=.., the default), with their lite data compiled in.
Tested with:
-std=c++23)-std=c++23)/std:c++latest)| Dependency | Version | Bundled | Purpose |
|---|---|---|---|
| dasmig-core | 1.4 | Yes (core.hpp, core/) | Platform-independent random engine and distributions, JSON |
| the nine libraries above | see CI | No | The persona's parts |
| Catch2 | 3.x | Yes (amalgamated) | Unit testing |
| Library | Description |
|---|---|
| address-generator | Postal addresses with real streets by place |
| biodata-generator | Procedural human physical characteristics |
| birth-generator | Demographically plausible birthdays |
| city-generator | Weighted city selection by population |
| country-generator | Weighted country selection by population |
| device-generator | Devices, browsers, user agents and IP addresses that fit together |
| email-generator | Email addresses in each country's style |
| entity-generator | ECS-based entity generation |
| interest-generator | Religion, hobbies and favourite media by country, age and sex |
| name-generator | Culturally appropriate full names |
| nickname-generator | Gamer-style nicknames |
| occupation-generator | Employment status, education and occupation by country, age and sex |
| phone-generator | Phone numbers valid in each country's numbering plan |
| relationship-generator | Families around a person: parents, siblings, partners and children |
| trait-generator | Personality traits with conflicts, synergies and Big Five axes |
| user-generator | Complete user records: account, username, email, phone and address |
This library is released under the MIT License.