{"_id":"@alistairheus/name-generator","_rev":"2-a76271c539002e97cc6560edd29e219a","name":"@alistairheus/name-generator","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@alistairheus/name-generator","version":"1.0.0","keywords":["names","first-names","generator","markov"],"author":{"name":"alistairheus"},"license":"MIT","_id":"@alistairheus/name-generator@1.0.0","maintainers":[{"name":"alistairheus","email":"kartikjha13@gmail.com"}],"homepage":"https://github.com/AlistairHeus/names-db#readme","bugs":{"url":"https://github.com/AlistairHeus/names-db/issues"},"bin":{"name-generator":"dist/cli.js"},"dist":{"shasum":"05448dfbaa135a3edd7c2cff9f1091a362356ffb","tarball":"https://registry.npmjs.org/@alistairheus/name-generator/-/name-generator-1.0.0.tgz","fileCount":60,"integrity":"sha512-u7YrPB3mequiz/Cdiisuo0N2YZ8c8ZMbmJ5ltRW8HXeckz7kNtuRNBKLDRD2re1eLoow6ukczUGnCreiCssmZQ==","signatures":[{"sig":"MEQCIHzBbwrUMF6HZ+KGTctRsaQ2tWssRn0cSSkoIARGTq7VAiBjMAJvBzNSk1Bj/kteVX8P0heTZ10ZrjrEsv6s9Myl0w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1901407},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"4b970f179a1c150802942049a0d8906df36ec4c9","scripts":{"test":"tsx --test test/**/*.test.ts","build":"tsc -p tsconfig.build.json && tsx scripts/pack-regions.ts && tsx scripts/fix-cli-bin.ts","prepack":"npm run build","generate":"tsx src/cli.ts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"alistairheus","email":"kartikjha13@gmail.com"},"repository":{"url":"git+https://github.com/AlistairHeus/names-db.git","type":"git"},"_npmVersion":"11.11.0","description":"Generate first names from regional registers using random, morph, or Markov strategies.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"zod":"^3.24.2","lodash":"^4.17.21"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.3","typescript":"^5.8.2","@types/node":"^22.13.10","@types/lodash":"^4.17.16"},"_npmOperationalInternal":{"tmp":"tmp/name-generator_1.0.0_1786990557849_0.4380228357419844","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alistairheus/name-generator","version":"1.0.1","description":"Generate first names from regional registers using random, morph, or Markov strategies.","license":"MIT","author":{"name":"alistairheus"},"repository":{"type":"git","url":"git+https://github.com/AlistairHeus/names-db.git"},"homepage":"https://github.com/AlistairHeus/names-db#readme","bugs":{"url":"https://github.com/AlistairHeus/names-db/issues"},"type":"module","engines":{"node":">=20"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"bin":{"name-generator":"dist/cli.js"},"scripts":{"generate":"tsx src/cli.ts","build":"tsc -p tsconfig.build.json && tsx scripts/pack-regions.ts && tsx scripts/fix-cli-bin.ts","prepack":"npm run build","test":"tsx --test test/**/*.test.ts","typecheck":"tsc --noEmit"},"publishConfig":{"access":"public"},"keywords":["names","first-names","generator","markov"],"dependencies":{"lodash":"^4.17.21","zod":"^3.24.2"},"devDependencies":{"@types/lodash":"^4.17.16","@types/node":"^22.13.10","tsx":"^4.19.3","typescript":"^5.8.2"},"gitHead":"71043d2cfee2bda84061542f06081713d8ff4a9a","_id":"@alistairheus/name-generator@1.0.1","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-/+INOQiQH4/8sh1qa95qcfV9Q7Rct1vthp/eZBE5D7nN5o09ZsgnBlAviWkC2BOavPeUx0+/3ErSda4sy+/n2g==","shasum":"a47ac1ab911b1505274f5aee644fd099979eb2e7","tarball":"https://registry.npmjs.org/@alistairheus/name-generator/-/name-generator-1.0.1.tgz","fileCount":60,"unpackedSize":1908624,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMwHEdjhQuCohGUX3GlOPx9nBumg8GpGpfV92zsQU80wIhAMo1KKnICuuFiN3Uxdf5Upn5X4oHLEIF4O9QpgyRbr8V"}]},"_npmUser":{"name":"alistairheus","email":"kartikjha13@gmail.com"},"directories":{},"maintainers":[{"name":"alistairheus","email":"kartikjha13@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/name-generator_1.0.1_1787776507302_0.7445058875144699"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T18:15:57.576Z","modified":"2026-08-26T20:35:07.670Z","1.0.0":"2026-08-17T18:15:58.044Z","1.0.1":"2026-08-26T20:35:07.511Z"},"bugs":{"url":"https://github.com/AlistairHeus/names-db/issues"},"author":{"name":"alistairheus"},"license":"MIT","homepage":"https://github.com/AlistairHeus/names-db#readme","keywords":["names","first-names","generator","markov"],"repository":{"type":"git","url":"git+https://github.com/AlistairHeus/names-db.git"},"description":"Generate first names from regional registers using random, morph, or Markov strategies.","maintainers":[{"name":"alistairheus","email":"kartikjha13@gmail.com"}],"readme":"# @alistairheus/name-generator\n\nNode library and CLI that generate first names from attributed regional lists (Ireland, Scotland, Norway, Sweden, Cologne/Germany, plus reconstructed Japan, France, Nordic, and ASOIAF tags).\n\nThis package is for **Node 20+** (a worldbuilding server, scripts, CI). Do not import it from a React bundle: it reads JSON from disk.\n\n## Install\n\n```bash\nnpm install @alistairheus/name-generator\n```\n\n## Library\n\n```ts\nimport { generateNames } from '@alistairheus/name-generator';\n\nconst names = generateNames({\n  strategy: 'markov',\n  gender: 'female',\n  region: 'ireland',\n  pool: 'exclusive',\n  count: 10,\n});\n```\n\n`loadNameData()` unions the regional JSON shipped in the package. It does not include the repo’s large unique dump (untagged sports-data names). `--region any` is the union of those regional lists.\n\n`--region` selects a tag. `--pool` controls how strict that selection is:\n\n| `--pool` | Meaning |\n| --- | --- |\n| `register` | Every name tagged with that region (default) |\n| `exclusive` | The name’s other tags stay inside a small overlap set (Ireland↔Scotland, Nordic cluster). `Takeshi` is not exclusive Japanese if it is also Swedish |\n| `morph` | Register names that pass European morph eligibility |\n\n`counts` are source totals where the official file has them (Irish/Scottish births, Swedish bearers, Cologne births). They are not comparable across countries.\n\n## CLI\n\n```bash\nnpx @alistairheus/name-generator --gender female --count 5\nnpx @alistairheus/name-generator --strategy markov --region ireland --pool exclusive --gender female --count 10\n```\n\nIn this repo:\n\n```bash\nnpm install\nnpm run generate -- --region ireland --pool exclusive --gender female --count 10\n```\n\n### Options\n\n| Option | Values | Default | Description |\n| --- | --- | --- | --- |\n| `--strategy` | `random`, `morph`, `markov` | `random` | How names are produced |\n| `--gender` | `male`, `female`, `any` | `any` | Which cleaned pool to use |\n| `--region` | `any`, `ireland`, `scotland`, `norway`, `sweden`, `germany`, `japan`, `france`, `nordic`, `asoiaf` | `any` | Keep names tagged with this region |\n| `--pool` | `register`, `exclusive`, `morph` | `register` | How strictly to filter that region |\n| `--count` | positive integer | `1` | How many unique names to print |\n| `--json` | flag | off | Print a JSON array instead of one name per line |\n| `--help` | flag | off | Show usage text |\n\nInvalid options, a count larger than the `random` pool, or exhausted `morph` or `markov` retries print an error and exit with a nonzero status.\n\n## Strategies\n\n`random` samples existing cleaned names uniformly, without replacement, using `crypto.randomInt`.\n\n`morph` invents names from European given-name structure learned in the selected pool:\n\n- it trains only on Latin given names with ordinary phonotactics and productive endings such as `-ina`, `-elle`, `-ian`, and `-o`\n- it skips Japanese romanized morphemes, Arabic theophoric prefixes, and other shapes that do not follow that morphology\n- it keeps stems that occur repeatedly, then joins `stem + suffix` only when the sound boundary is legal\n- it does not generate hyphenated names\n\n`markov` invents names from an order-3 letter chain trained uniformly, in memory, on the selected pool:\n\n- each letter-only name in the pool contributes one set of letter triples; source `counts` are unused\n- it skips hyphenated names and anything that is not `a-z` after accent folding\n- it does not copy a training name\n- `--pool exclusive` and `--pool morph` are the intended views; `register` still works and will learn the full tagged mix\n\n## Data\n\nOfficial and reconstructed lists live in [`data/regions/`](data/regions/README.md). The unique JSON under `data/unique/` is a local rebuild index for this repo and is **not** published.\n\n## Development\n\n```bash\nnpm test\nnpm run typecheck\nnpm run build\nnpx tsx scripts/eval-markov.ts --region ireland --pool exclusive --gender female\n```\n","readmeFilename":"README.md"}