145bb1fe75e462bb4c6fb2603f3275a62185a725
1 /* The person who associated a work with this deed has dedicated the
2 work to the public domain by waiving all of his or her rights to
3 the work worldwide under copyright law, including all related and
4 neighboring rights, to the extent allowed by law.
6 You can copy, modify, distribute and perform the work, even for
7 commercial purposes, all without asking permission.
9 See https://creativecommons.org/publicdomain/zero/1.0/ for details.
483 function capitalize (s
) {
484 return s
.split(" ").map(function (s
) {
485 return s
[0].toUpperCase() + s
.slice(1).toLowerCase();
489 function consonant (b
) {
490 var a
= this.replace(/C
/g
, 'K')
492 .replace(/[^A-Z]+/g, ' ')
493 .trimRight().split(/ +/g
);
494 var b
= b
.replace(/C
/g
, 'K')
496 .replace(/[^A-Z]+/g, ' ')
497 .trimRight().split(/ +/g
);
498 return intersects(a
, b
);
501 function generateName () {
502 var location
= choice(LOCATION
);
503 var denizen
= capitalize(choice(
504 DENIZEN
.filter(consonant
, location
)));
505 var adjective
= capitalize(choice(
506 ADJECTIVE
.filter(consonant
, location
)));
507 var state
= capitalize(choice(
508 STATE
.filter(consonant
, location
)));
509 location
= capitalize(location
);
511 ["The", denizen
+ "'s", location
],
512 ["The", adjective
, location
],
513 ["The", location
, "of", state
],
514 [state
+ "'s", location
],
515 ["The", location
, "of", "the", denizen
],
517 [capitalize(choice(ADJECTIVE
)), denizen
, location
],
518 [adjective
, denizen
, capitalize(choice(LOCATION
))],