Improved species matching
This commit is contained in:
		
							parent
							
								
									01ca2ce344
								
							
						
					
					
						commit
						d91f44d0db
					
				@ -1,5 +1,9 @@
 | 
				
			|||||||
# Changelog
 | 
					# Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 1.3.0
 | 
				
			||||||
 | 
					*   Improved species search and matching
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 1.2.0
 | 
					## 1.2.0
 | 
				
			||||||
*   Hide/show current character profile with Ctrl+P or Command+P
 | 
					*   Hide/show current character profile with Ctrl+P or Command+P
 | 
				
			||||||
*   Navigate back and forward in character profile view history
 | 
					*   Navigate back and forward in character profile view history
 | 
				
			||||||
 | 
				
			|||||||
@ -11,9 +11,9 @@
 | 
				
			|||||||
                v-model="data[item]" :placeholder="l('filter')" :title="l('characterSearch.' + item)" :options="options[item]" :key="item">
 | 
					                v-model="data[item]" :placeholder="l('filter')" :title="l('characterSearch.' + item)" :options="options[item]" :key="item">
 | 
				
			||||||
            </filterable-select>
 | 
					            </filterable-select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <filterable-select v-model="data.species" :multiple="true" :placeholder="l('filter')"
 | 
					            <filterable-select class="species-filter" v-model="data.species" :multiple="true" :placeholder="l('filter')"
 | 
				
			||||||
                :title="l('characterSearch.species')" :options="options.species">
 | 
					                :title="l('characterSearch.species')" :options="options.species">
 | 
				
			||||||
                <template slot-scope="s">{{s.option.name}}</template>
 | 
					                <template slot-scope="s">{{s.option.shortName}} <small>{{s.option.details}}</small></template>
 | 
				
			||||||
            </filterable-select>
 | 
					            </filterable-select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <div v-if="searchString" class="search-string">
 | 
					            <div v-if="searchString" class="search-string">
 | 
				
			||||||
@ -61,7 +61,7 @@
 | 
				
			|||||||
    import {EventBus} from './preview/event-bus';
 | 
					    import {EventBus} from './preview/event-bus';
 | 
				
			||||||
    import CharacterSearchHistory from './CharacterSearchHistory.vue';
 | 
					    import CharacterSearchHistory from './CharacterSearchHistory.vue';
 | 
				
			||||||
    import { Matcher } from '../learn/matcher';
 | 
					    import { Matcher } from '../learn/matcher';
 | 
				
			||||||
    import { Species, speciesNames } from '../learn/matcher-types';
 | 
					    import { Species, speciesMapping, speciesNames } from '../learn/matcher-types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    type Options = {
 | 
					    type Options = {
 | 
				
			||||||
        kinks: SearchKink[],
 | 
					        kinks: SearchKink[],
 | 
				
			||||||
@ -250,27 +250,38 @@
 | 
				
			|||||||
          return !!_.find(this.data.species, (s: SearchSpecies) => (s.id === species));
 | 
					          return !!_.find(this.data.species, (s: SearchSpecies) => (s.id === species));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        getSpeciesOptions(): SearchSpecies[] {
 | 
					        getSpeciesOptions(): SearchSpecies[] {
 | 
				
			||||||
            const species = _.map(
 | 
					            const species = _.map(
 | 
				
			||||||
                _.filter(Species, (s) => (_.isString(s))) as unknown[] as string[],
 | 
					                speciesMapping,
 | 
				
			||||||
                (speciesName: keyof typeof Species): SearchSpecies => {
 | 
					                (keywords: string[], speciesIdStr: Species): SearchSpecies => {
 | 
				
			||||||
                    const speciesId: number = Species[speciesName];
 | 
					                    // const speciesId: number = Species[speciesName];
 | 
				
			||||||
 | 
					                    const details = `${keywords.join(', ').substr(0, 24)}...`;
 | 
				
			||||||
 | 
					                    const speciesId = parseInt(speciesIdStr as any, 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (speciesId in speciesNames) {
 | 
					                    if (speciesId in speciesNames) {
 | 
				
			||||||
 | 
					                        const name = `${speciesNames[speciesId].substr(0, 1).toUpperCase()}${speciesNames[speciesId].substr(1)}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        return {
 | 
					                        return {
 | 
				
			||||||
                            name: `${speciesNames[speciesId].substr(0, 1).toUpperCase()}${speciesNames[speciesId].substr(1)} (species)`,
 | 
					                            details,
 | 
				
			||||||
 | 
					                            name: `${name} (species)`,
 | 
				
			||||||
 | 
					                            shortName: name,
 | 
				
			||||||
                            id: speciesId
 | 
					                            id: speciesId
 | 
				
			||||||
                        };
 | 
					                        };
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    const speciesName = Species[speciesId];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    return {
 | 
					                    return {
 | 
				
			||||||
 | 
					                        details,
 | 
				
			||||||
                        name: `${speciesName}s (species)`,
 | 
					                        name: `${speciesName}s (species)`,
 | 
				
			||||||
 | 
					                        shortName: `${speciesName}s`,
 | 
				
			||||||
                        id: speciesId
 | 
					                        id: speciesId
 | 
				
			||||||
                    };
 | 
					                    };
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ) as unknown[] as SearchSpecies[];
 | 
					            ) as unknown[] as SearchSpecies[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // console.log('SPECIES', species);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return _.sortBy(species, 'name');
 | 
					            return _.sortBy(species, 'name');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -364,6 +375,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<style lang="scss">
 | 
					<style lang="scss">
 | 
				
			||||||
    .character-search {
 | 
					    .character-search {
 | 
				
			||||||
 | 
					        .species-filter {
 | 
				
			||||||
 | 
					          small {
 | 
				
			||||||
 | 
					            color: var(--tabSecondaryFgColor)
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        .dropdown {
 | 
					        .dropdown {
 | 
				
			||||||
            margin-bottom: 10px;
 | 
					            margin-bottom: 10px;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -144,7 +144,7 @@ export interface Logs {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type SearchKink = {id: number, name: string, description: string};
 | 
					export type SearchKink = {id: number, name: string, description: string};
 | 
				
			||||||
export type SearchSpecies = {id: number, name: string};
 | 
					export type SearchSpecies = {id: number, name: string, shortName: string, details: string};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface SearchData {
 | 
					export interface SearchData {
 | 
				
			||||||
    kinks: SearchKink[]
 | 
					    kinks: SearchKink[]
 | 
				
			||||||
 | 
				
			|||||||
@ -153,19 +153,32 @@ export enum Species {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Minotaur = 12121212,
 | 
					    Minotaur = 12121212,
 | 
				
			||||||
    Giraffe = 13131313,
 | 
					    Giraffe = 13131313,
 | 
				
			||||||
    Rhinoceros = 14141414
 | 
					    Rhinoceros = 14141414,
 | 
				
			||||||
 | 
					    Suidae = 15151515,
 | 
				
			||||||
 | 
					    Herpestidae = 16161616,
 | 
				
			||||||
 | 
					    Were = 17171717,
 | 
				
			||||||
 | 
					    Erinaceidae = 18181818,
 | 
				
			||||||
 | 
					    Elephantidae = 19191919,
 | 
				
			||||||
 | 
					    Camielidae = 20202020,
 | 
				
			||||||
 | 
					    Hippopotamidae = 21212121,
 | 
				
			||||||
 | 
					    Hub = 22222222,
 | 
				
			||||||
 | 
					    Pinniped = 23232323,
 | 
				
			||||||
 | 
					    Hybrid = 24242424
 | 
				
			||||||
 }
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const nonAnthroSpecies = [
 | 
					export const nonAnthroSpecies = [
 | 
				
			||||||
    Species.Human, Species.Elf, Species.Orc, Species.Humanoid,
 | 
					    Species.Human, Species.Elf, Species.Orc, Species.Humanoid,
 | 
				
			||||||
    Species.Demon, Species.Divinity, Species.Alien, Species.Robot,
 | 
					    Species.Demon, Species.Divinity, Species.Alien, Species.Robot,
 | 
				
			||||||
    Species.Fae, Species.Vampire
 | 
					    Species.Fae, Species.Vampire, Species.Monster, Species.Pokemon,
 | 
				
			||||||
 | 
					    Species.Hub
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const mammalSpecies = [Species.Equine, Species.Feline, Species.Canine, Species.Vulpine, Species.Cervine, Species.Lapine,
 | 
					export const mammalSpecies = [Species.Equine, Species.Feline, Species.Canine, Species.Vulpine, Species.Cervine, Species.Lapine,
 | 
				
			||||||
    Species.Musteline, Species.Procyon, Species.Rodent, Species.Ursine, Species.MarineMammal, Species.Primate,
 | 
					    Species.Musteline, Species.Procyon, Species.Rodent, Species.Ursine, Species.MarineMammal, Species.Primate,
 | 
				
			||||||
    Species.Anthro, Species.Bovine, Species.Caprinae, Species.Marsupial, Species.Hyaenidae, Species.Minotaur,
 | 
					    Species.Anthro, Species.Bovine, Species.Caprinae, Species.Marsupial, Species.Hyaenidae, Species.Minotaur,
 | 
				
			||||||
    Species.Bat, Species.Mephitidae, Species.Taur, Species.Giraffe, Species.Rhinoceros];
 | 
					    Species.Bat, Species.Mephitidae, Species.Taur, Species.Giraffe, Species.Rhinoceros, Species.Suidae,
 | 
				
			||||||
 | 
					    Species.Herpestidae, Species.Were, Species.Erinaceidae, Species.Elephantidae, Species.Camielidae, Species.Hippopotamidae,
 | 
				
			||||||
 | 
					    Species.Pinniped, Species.Hybrid];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface SpeciesMap {
 | 
					export interface SpeciesMap {
 | 
				
			||||||
    [key: number]: string[];
 | 
					    [key: number]: string[];
 | 
				
			||||||
@ -180,59 +193,196 @@ export const speciesNames: SpeciesStrMap = {
 | 
				
			|||||||
    [Species.Elf]: 'elves',
 | 
					    [Species.Elf]: 'elves',
 | 
				
			||||||
    [Species.Fish]: 'fishes',
 | 
					    [Species.Fish]: 'fishes',
 | 
				
			||||||
    [Species.Mephitidae]: 'mephitis',
 | 
					    [Species.Mephitidae]: 'mephitis',
 | 
				
			||||||
    [Species.Rhinoceros]: 'rhinoceros'
 | 
					    [Species.Rhinoceros]: 'rhinoceros',
 | 
				
			||||||
 | 
					    [Species.Suidae]: 'swine'
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const likelyHuman: SpeciesMap = {
 | 
				
			||||||
 | 
					    [Species.Human]: ['bimbo', 'witch', 'wizard', 'gyaru', 'milf', '.*slut', 'black', 'azarathian', 'kryptonian', 'mensch', 'thot',
 | 
				
			||||||
 | 
					        'sister', 'brother', 'mother', 'father', 'fuckpig', 'hero', 'she-stud', 'college', 'cutie',
 | 
				
			||||||
 | 
					        'bimboi', 'homo', 'streamer', '.*human', 'femboy', 'nord', 'norse', 'norseman', 'man', 'whitebo[yi]', '.*bo[yi].*', '.*girl.*',
 | 
				
			||||||
 | 
					        'french', 'whore', 'slutty', 'adult', 'otaku', 'cumdump', 'thug', 'magus',
 | 
				
			||||||
 | 
					        'sapien[s]?',
 | 
				
			||||||
 | 
					        'paladin', 'knight',
 | 
				
			||||||
 | 
					        'male', 'female', 'shemale',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        'aasimar', 'astartes', 'saiyan', 'echani', 'cathar', 'shikaisen', 'cosplayer'
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// armadillo
 | 
				
			||||||
 | 
					// anteater
 | 
				
			||||||
 | 
					// red panda / akai pandamimi
 | 
				
			||||||
 | 
					// echidna
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const speciesMapping: SpeciesMap = {
 | 
					export const speciesMapping: SpeciesMap = {
 | 
				
			||||||
    [Species.Human]: ['human', 'humanoid', 'angel', 'android', 'african american', 'africanamerican', 'woman', 'dothraki', 'homo sapien', 'homosapien', 'homosapian', 'hooman', 'hoomin', 'hooomin'],
 | 
					    [Species.Anthro]: ['anthro', 'anthropomorphic', 'kemono', 'kemomimi', 'kemonomimi', 'furry'],
 | 
				
			||||||
    [Species.Humanoid]: ['satyr', 'gnome', 'dwarf', 'halfling', 'tiefling', 'humanoid'],
 | 
					    [Species.Human]: ['human.*', 'homo[ -]?sapien', '𝖧𝗎𝗆𝖺𝗇', 'woman', 'dothraki', 'amazon', 'african[ -]?american',
 | 
				
			||||||
    [Species.Equine]: ['horse', 'stallion', 'mare', 'filly', 'equine', 'shire', 'donkey', 'mule', 'zebra', 'pony', 'unicorn', 'clydesdale', 'shire',
 | 
					        'homo[ -]?sapian', 'hooman', 'hoomin', 'hooomin', 'humaine?', 'amazonian', 'latina', 'latino',
 | 
				
			||||||
        'appaloosa', 'friesian', 'draft', 'draught', 'alicorn', 'amazon', 'amazonian', 'horsie', 'hoss', 'pegasus', 'colt', 'filly'],
 | 
					        'nephilim', 'angel', 'nephalem', 'archangel'
 | 
				
			||||||
    [Species.Feline]: ['cat', 'kitten', 'catgirl', 'neko', 'tiger', 'puma', 'lion', 'lioness',
 | 
					        ],
 | 
				
			||||||
        'tigress', 'feline', 'jaguar', 'cheetah', 'lynx', 'leopard', 'cougar', 'kitty', 'migote', 'miqo\'te', 'miqote', 'ocelot',
 | 
					
 | 
				
			||||||
        'sabertooth', 'saber tooth', 'tabby', 'liger', 'serval'],
 | 
					    [Species.Elf]: ['drow', 'draenei', 'dunmer', 'blutelf', 'draenai', 'elf.*', 'drow.*', 'e l f', 'e-l-f', 'sin\'?dorei', 'kal\'?dorei',
 | 
				
			||||||
    [Species.Canine]: ['dog', 'wolf', 'dingo', 'coyote', 'jackal', 'canine', 'doberman', 'husky', 'hound', 'akita', 'pitbull', 'pit bull', 'terrier',
 | 
					        'elves', 'ᴇʟғ', 'elven', 'elfe', 'nachtelfe?', 'elvish', 'ren\'?dorei', 'quel\'?dorei', 'hal[bf][ -]elf', '.*elf', 'waldelfe',
 | 
				
			||||||
        'bull terrier', 'australian shepherd', 'australian shepard', 'german shepherd', 'german shepard', 'malinois', 'woof', 'labrador', 'collie',
 | 
					        'shal\'?dorei', 'san\'?layn'
 | 
				
			||||||
        'canis', 'canid', 'chihuahua', 'poodle', 'chinchilla', 'chowchow', 'corgi', 'anubis', 'anubian', 'dalmatian', 'inumimi', 'lupine', 'malamute', 'mastiff',
 | 
					        ],
 | 
				
			||||||
        'mutt', 'rottweiler', 'shih tzu', 'worgen'],
 | 
					
 | 
				
			||||||
    [Species.Vulpine]: ['fox', 'fennec', 'kitsune', 'vulpine', 'vixen'],
 | 
					    [Species.Canine]: ['dog', 'dingo', 'coyote', 'jackal', 'husky', 'canine', 'wolf.*', 'doberman[n]?', 'hound', 'akita', 'pit ?bull',
 | 
				
			||||||
    [Species.Avian]: ['bird', 'gryphon', 'phoenix', 'roc', 'chimera', 'avian', 'albatross', 'cockatiel', 'dove', 'eagle', 'owl', 'penguin', 'raven'],
 | 
					        'terrier', 'bull[ -]?terrier', 'australian[ -]?shepherd', 'australian[ -]?shep[h]?ard', 'german[ -]?shep[h]?erd',
 | 
				
			||||||
    [Species.Amphibian]: ['salamander', 'frog', 'toad', 'newt', 'amphibian'],
 | 
					        'german[ -]?shep[h]?ard', 'malinois', 'woof', 'labrador', 'collie', 'canis', 'canid', 'chihuahua', 'poodle', 'chinchilla',
 | 
				
			||||||
    [Species.Cervine]: ['deer', 'elk', 'moose', 'cervid', 'cervine', 'caribou', 'reindeer', 'doe', 'stag'],
 | 
					        'chow[ -]?chow', 'corgi', 'anubis', 'beagle', 'german[ -]?shep', '.*wolf', 'direwolf', 'pointer',
 | 
				
			||||||
    [Species.Insect]: ['bee', 'wasp', 'spider', 'scorpion', 'ant', 'insect'],
 | 
					        'anubian', 'dalmatian', 'dalmation', 'inumimi', 'lupine', 'malamute', 'mastiff', 'mutt', 'rottweill?er', 'shih[ -]?tzu', 'worgen',
 | 
				
			||||||
    [Species.Lapine]: ['bunny', 'rabbit', 'hare', 'lapine'],
 | 
					        'vallhund', 'puppy', 'okami', 'great[ -]?dane', 'golden[ -]?(retriever|lab|labrador)', 'cocker[ -]?spaniel', 'samoyed', 'awoo',
 | 
				
			||||||
    [Species.Dragon]: ['dragon', 'drake', 'wyvern', 'draconian'],
 | 
					        'borzoi', 'spaniel', 'ookamimimi', 'jakkarumimi', 'chinchiramimi', 'woffo', 'wuff', 'wolfdog', 'setter',
 | 
				
			||||||
    [Species.Demon]: ['demon', 'daemon', 'deamon', 'demoness', 'demonkin', 'devil', 'succubus', 'incubus', 'baphomet'],
 | 
					        '🐶', '🐺', '🐕', '🐩', 'aussie[ -]?doodle', 'shiba', 'inu', 'veil[ -]?hound', 'timber[ -]?wolf', 'hell[ -]?hound', 'hound',
 | 
				
			||||||
    [Species.Musteline]: ['mink', 'ferret', 'weasel', 'stoat', 'otter', 'wolverine', 'marten', 'musteline'],
 | 
					        'wolfess', 'latrans', 'dog[ -]?(girl|bo[yi][e]?)', 'wolf[ -]?(girl|bo[yi][e]?)', 'doggie', 'doggy', 'canis', 'fenrir', 'v[aá]na[r]?gand[r]?',
 | 
				
			||||||
    [Species.Procyon]: ['raccoon', 'racoon', 'coatimund', 'longtail', 'procyon'],
 | 
					        'doggo', 'barghest', 'barguest', 'crux', 'ᴡᴏʟғ', '𝗪𝗼𝗹𝗳', '𝙳𝚘𝚐', 'dire[ -]?hound'],
 | 
				
			||||||
    [Species.Rodent]: ['rat', 'mouse', 'chipmunk', 'squirrel', 'rodent', 'maus'],
 | 
					
 | 
				
			||||||
    [Species.Ursine]: ['bear', 'panda', 'black bear', 'brown bear', 'polar bear', 'ursine'],
 | 
					    [Species.Equine]: ['horse', 'zebra', 'pony', 'donkey', 'stallion', 'mare', 'filly', 'equine', 'shire', 'mule', 'zeeb', 'pon[yi][ -]?bo[yi]',
 | 
				
			||||||
    [Species.MarineMammal]: ['whale', 'killer whale', 'dolphin'],
 | 
					        'unicorn', 'clydesdale', 'shire', 'appaloosa', 'friesian', 'draft', 'draught', 'alicorn', 'horsie', 'hoss', 'pegasus', 'colt',
 | 
				
			||||||
    [Species.Primate]: ['monkey', 'ape', 'chimp', 'chimpanzee', 'gorilla', 'lemur', 'silverback'],
 | 
					        'filly', 'neigh', 'dullahan', 'tikbalang', 'gypsy[ -]?vanner', 'ardenne[r]?', 'ardennais[e]?', 'pony[ -]?(girl|bo[yi][e]?)',
 | 
				
			||||||
    [Species.Divinity]: ['god', 'goddess', 'demigod', 'demigoddess', 'demi-god', 'demi-goddess'],
 | 
					        'cream[ -]?draft', 'belgian[ -]?draft', 'saddle[ -]?bred', 'warm[ -]?blood', 'marsh tacky', 'fox[ -]?trotter', 'morab',
 | 
				
			||||||
    [Species.Elf]: ['elf', 'e l f', 'drow', 'draenei', 'draenai', 'kaldorei', 'sindorei'],
 | 
					        'saddle[ -]?horse', 'walkaloosa', 'welara', 'tiger[ -]?horse', 'horsekin', 'pone',
 | 
				
			||||||
    [Species.Fish]: ['fish', 'shark', 'great white', 'sergal', 'elven'],
 | 
					        'horse[ -]?(girl|bo[yi][e]?)', 'umamimi', 'shimaumamimi', 'thestral', 'pegusus',
 | 
				
			||||||
    [Species.Orc]: ['orc'],
 | 
					        'mustang', 'horse.*', '.*horse', 'equus', 'kelpie', 'kuranta', 'zonkey',
 | 
				
			||||||
    [Species.Reptile]: ['chameleon', 'anole', 'alligator', 'aligator', 'snake', 'crocodile', 'lizard', 'gator', 'gecko', 'reptile', 'reptilian'],
 | 
					        '🐴', '🦓', '🐎'],
 | 
				
			||||||
    [Species.Anthro]: ['anthro', 'anthropomorphic'],
 | 
					
 | 
				
			||||||
    [Species.Bovine]: ['cow', 'bovine', 'bison', 'antelope', 'gazelle', 'oryx', 'black angus', 'bull', 'ox'],
 | 
					    [Species.Feline]: ['cat', 'tiger.*', 'puma', 'lion.*', 'kitten', 'cat[ -]?(girl|bo[yi][e]?)', 'neko', 'neko[ -]?mimi', 'lioness', 'panther',
 | 
				
			||||||
    [Species.Caprinae]: ['sheep', 'goat', 'ibex', 'takin', 'bharal', 'goral', 'serow', 'lamb'],
 | 
					        'panthress', 'tigress', 'feline', 'jaguar', 'cheetah', 'lynx', 'leopard', 'cougar', 'kitty', 'migo\'?te', 'miqo\'?te', 'ocelot',
 | 
				
			||||||
    [Species.Marsupial]: ['opossum', 'possum', 'kangaroo', 'roo', 'koala', 'wombat'],
 | 
					        'saber[ -]?tooth', 'tabby', 'serval', 'russian[ -]?blue', 'thunderian', 'meow', 'lombax', 'domestic[ -]?shorthair',
 | 
				
			||||||
    [Species.Hyaenidae]: ['hyena'],
 | 
					        'british[ -]?shorthair', 'oriental[ -]?shorthair', 'american[ -]?shorthair', 'burmese', 'maine[ -]?coon', 'korat', 'ragdoll',
 | 
				
			||||||
 | 
					        'ocicat', 'chartreux', 'german[ -]?rex', 'turkish[ -]?van', 'ragamuffin', 'norwegian[ -]?forest[ -]?(cat)?',
 | 
				
			||||||
 | 
					        'exotic[ -]?shorthair', 'khajiit', 'catamount', 'cat[ -]?person', 'tetton', 'tigre', 'calico', 'caracal', 'tabaxi', 'housecat',
 | 
				
			||||||
 | 
					        'kodkod', 'karotanta', 'siamese', 'felis', 'catus', 'nekomata', 'nekomimi', 'trianii', 'caitian', 'catto', '.*cat', 'toramimi',
 | 
				
			||||||
 | 
					        'shishimimi', 'pansamimi', 'hyoumimi', 'mytharii', 'felinid', 'kitteh', 'cat[ -]folk', 'chat', 'lionkin', 'tigerkin',
 | 
				
			||||||
 | 
					        'liger', 'tigon',
 | 
				
			||||||
 | 
					        '🐅', '🐆', '🐯', '🦁', '🐈'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Vulpine]: ['fox', 'fennec', 'vixen', 'vulpine', 'fox.*', 'fennec', 'kitsune.*', 'kistune', 'gumiho', 'kumiho',
 | 
				
			||||||
 | 
					        'nogitsune', 'yako', '🦊', 'fox[ -]?(girl|bo[yi][e]?)', 'vulpes', 'silver[ -]?fox', 'arctic[ -]?fox', 'fennec[ -]?fox', 'red[ -]?fox',
 | 
				
			||||||
 | 
					        'cape[ -]?fox', 'ninetails', 'ninetales', 'vulpo', 'vulpera', 'kitsunemimi', 'foxkin', 'fire[ -]?fox'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Dragon]: ['dragon.*', 'drake', 'wyvern', 'felkin', 'night[ -]?fury', 'draconian', 'dragonn?ess', 'draconic', 'dragovian',
 | 
				
			||||||
 | 
					        '🐉', 'sea[ -]?dragon', 'doragonmimi', 'doragon', 'half[ -]dragon', 'dragonkin'
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Reptile]: ['lizard', 'snake', 'crocodile', 'alligator', 'chameleon', 'anole', 'aligator', 'snake.*', 'lizard', 'gator',
 | 
				
			||||||
 | 
					        'gecko', 'reptile', 'reptilian', 'scaly', 'scale[ -]?born', 'argonian', 'saxhleel', 'skink', 'cobra', 'turtle', 'tortoise',
 | 
				
			||||||
 | 
					        'nope[ -]rope', 'anaconda', 'python', 'lizardkin', 'lizard[ -]?folk', 'yuan[ -]?ti',
 | 
				
			||||||
 | 
					        '🐍'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Pokemon]: ['charizard', 'charmander', 'pikachu', 'digimon', 'renamon', 'eevee', 'gardev(oi|io)r', 'absol', 'aggron',
 | 
				
			||||||
 | 
					        'jolteon', 'lopunny', 'raichu', 'scyther', 'blaziken', 'lucario', 'gengar', 'mudsdale', 'mewtwo', 'glaceon', 'pokemon',
 | 
				
			||||||
 | 
					        'croconaw', 'rattata', 'toxtricity', 'audino', 'sandslash', 'luxray', 'samurott', 'pokémon', 'riolu', 'greninja',
 | 
				
			||||||
 | 
					        'meowstick', 'alolan', 'sylveon', 'arcanine', 'zebstrika', 'rapidash', 'umbreon', 'litten', 'vulpix', 'groudon',
 | 
				
			||||||
 | 
					        'gothitelle', 'kecleon', 'quagsire', 'garchomp', 'mismagius', 'zigzagoon', 'sceptile', 'joltik', 'cinderace',
 | 
				
			||||||
 | 
					        'hypnomade', 'furfrou', 'flareon', 'zeraora', 'mudkip', 'nidoking', 'zorua', 'salamence', 'lycanrock?',
 | 
				
			||||||
 | 
					        'dewott', 'delcatty', 'braixen', 'zacian', 'fennekin', 'kirlia', 'cinccino', 'growlithe', 'shaymin', 'salazzle',
 | 
				
			||||||
 | 
					        'vaporeon', 'reshiram', 'quilava', 'decidueye', 'marshadow', 'weavile',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // digimon
 | 
				
			||||||
 | 
					        'gatomon'
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Amphibian]: ['salamander', 'frog', 'toad', 'newt', 'amphibian', 'axolotl'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Avian]: ['bird', 'gryphon', 'raven', 'cardinal', 'griffon', 'phoenix', 'roc', 'chimera', 'avian', 'albatross', 'cockatiel',
 | 
				
			||||||
 | 
					        'dove', 'eagle', 'owl', 'penguin', 'cockatoo', 'shoebill', 'rito', 'crow', 'meadow[ -]?lark', 'torimimi',
 | 
				
			||||||
 | 
					        'peacock', 'chocobo', 'emu', 'ostrich', 'flamingo', 'duck', 'swallow', 'nightingale', 'toucan',
 | 
				
			||||||
 | 
					        '🦚', '🦃', '🦢', '🦆', '🦅', '🦉', '🦜', '🦩'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Bat]: ['bat', 'nimbat', 'foxbat', 'pteropus', 'komorimimi', '🦇'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Bovine]: ['cow', 'bison', 'bovine', 'antelope', 'gazelle', 'oryx', 'buffalo', 'bison', 'black[ -]?angus', 'bull', 'ox',
 | 
				
			||||||
 | 
					        'ushimimi', 'holstaur', 'moo', 'ᴍᴏᴏ', 'cattle', 'hucow', 'caprin[a]?e', 'goat-antelope', 'muskox', 'urial', 'mouflon',
 | 
				
			||||||
 | 
					        '🐃', '🐂', '🐄'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Caprinae]: ['sheep', 'goat', 'ibex', 'takin', 'bharal', 'goral', 'serow', 'lamb', 'faun', 'ram', 'faunus', 'goat.*',
 | 
				
			||||||
 | 
					        'yagimimi', 'hitsujimimi'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Camielidae]: ['camel', 'llama', 'alpaca', 'guanaco', 'dromedary', 'dromedar', '🦙', '🐪', '🐫'],
 | 
				
			||||||
 | 
					    [Species.Cervine]: ['deer', 'elk', 'moose', 'caribou', 'reindeer', 'doe', 'cervid', 'cervine', 'stag', 'shikamimi'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Dinosaur]: ['raptor', 't-rex', 'death[ -]?claw', 'pterodactyl', '[\\w-]*saurus', 'dinosaur', 'trex', 'tyrannosaurus',
 | 
				
			||||||
 | 
					        'saurian', '[\\w-]*raptor', 'deinonychus', 'dino',
 | 
				
			||||||
 | 
					        '🦖', '🦕'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Erinaceidae]: ['hedgehog', 'gymnure', 'moonrat'],
 | 
				
			||||||
 | 
					    [Species.Elephantidae]: ['elephant', 'mammoth', 'mastodon', 'pachyderm', 'tusker'],
 | 
				
			||||||
 | 
					    [Species.Fish]: ['shark', 'great white', 'sergal', 'fish', 'aquatic', 'melanopterus', 'carcharhinus', '.*fish', '.*shark'],
 | 
				
			||||||
 | 
					    [Species.Giraffe]: ['giraffe', '🦒', 'kirinmimi'],
 | 
				
			||||||
 | 
					    [Species.Hippopotamidae]: ['hippo', 'hippopotamus', '🦛'],
 | 
				
			||||||
 | 
					    [Species.Hyaenidae]: ['hyena', 'aardwolf', 'hyaena', 'yeen'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Hybrid]: ['hybrid', 'cabbit', 'fabbit', 'laquine', 'folf', 'myox', 'wolger', 'silkie', 'yumar',
 | 
				
			||||||
 | 
					        'foxcoon', 'drazelle', 'vulpkanin', 'poochyena', 'batpon', 'delphox'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Insect]: ['bug', 'bee', 'wasp', 'ant', 'spider', 'arachnid', 'scorpion', 'insect', 'buggo', 'hornet', 'vespidae',
 | 
				
			||||||
 | 
					        'mantis', 'beefolk', 'ladybug', 'hachimimi', 'moth', 'bumblebee'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Lapine]: ['bunny', 'rabbit', 'hare', 'lapine', 'viera', 'wabbit', 'lagomorph', 'bunny[ -]?(girl|bo[yi][e])', 'usagimimi',
 | 
				
			||||||
 | 
					        'bun', '.*bunny', 'cabbit', 'fabbit', 'häschen', 'bunbun', 'cottontail', 'jack[ -]?rabbit', 'lapine?', 'jackalope', '🐇'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.MarineMammal]: ['whale', 'killer[ -]?whale', 'dolphin', 'orca', '🐬'],
 | 
				
			||||||
 | 
					    [Species.Marsupial]: ['kangaroo', 'opossum', 'koala', 'wombat', 'possum', 'roo', 'bandicoot', 'bilby', 'numbat', 'wallaby',
 | 
				
			||||||
 | 
					        'thylacine', 'marsupial[ -]?wolf', 'tasmanian[ -]?tiger', 'quokka', 'glider', 'cuscus', 'marsupial', 'tasmanian[ -]?devil', 'musky[ -]?rat',
 | 
				
			||||||
 | 
					        'bettong', 'Känguru', '🦘', '🐨'],
 | 
				
			||||||
 | 
					    [Species.Mephitidae]: ['skunk', 'stink[ -]?badger', '🦨'],
 | 
				
			||||||
 | 
					    [Species.Herpestidae]: ['mongoose', 'meerkat', 'kusimanse', 'suricate'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Musteline]: ['otter', 'ferret', 'mink', 'weasel', 'stoat', 'wolverine', 'marten', 'musteline', 'badger', 'otterkin',
 | 
				
			||||||
 | 
					        'kawausomimi', 'itachimimi', 'ferettomimi', '🦡', '🦦'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Pinniped]: ['seal', 'walrus', 'fur seal', 'sea[ -]?lion'],
 | 
				
			||||||
 | 
					    [Species.Primate]: ['gorilla', 'monkey', 'ape', 'chimp', 'lemur', 'bonobo', 'chimpanzee', 'silverback', 'sarumimi', '🐒', '🦍', '🦧'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Procyon]: ['raccoon', 'coatimund', 'longtail', 'procyon', 'tanuki', 'tanukimimi', '🦝', 'racoon', 'rakunmimi',
 | 
				
			||||||
 | 
					        'ring[ -]?tail(ed)?'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Rhinoceros]: ['rhino', 'rhinoceros', '🦏', '.*rhino'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Rodent]: ['rat', 'mouse', 'chipmunk', 'squirrel', 'hamster', 'rodent', 'maus', 'gerbil', 'mousie', 'muskrat', 'ratsin',
 | 
				
			||||||
 | 
					        'skaven', 'roedor', 'risumimi', 'nezumimi', 'jerboa', 'burmecian', '🐀', '🐁', '🐿'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Suidae]: ['pig', 'boar', 'warthog', 'bushpig', 'babirusa', 'sow', 'swine', 'suid', 'suine', 'piglet', 'hog',
 | 
				
			||||||
 | 
					        'piggie', 'piggy', 'quilboar', 'porcine', 'porcid', 'butamimi', '🐗', '🐖'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Ursine]: ['bear', 'panda', 'grizzly', 'black[ -]?bear', 'brown[ -]?bear', 'polar[ -]?bear', 'ursine', 'pandaren', 'ursus',
 | 
				
			||||||
 | 
					        'pandamimi', 'kumamimi'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Demon]: ['demon', 'devil', 'succubus', 'incubus', 'daemon', 'deamon', 'demoness', 'demonkin', 'baphomet', 'eredar',
 | 
				
			||||||
 | 
					        'tengu', 'devilkin', 'd[a]?emonette', 'cambion', 'amanojaku', 'tanar[\']?ri', 'balor', 'marilith', 'lilith'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Divinity]: ['god', 'goddess', 'demi[ -]?god', 'demi[ -]?goddess'],
 | 
				
			||||||
 | 
					    [Species.Fae]: ['fairy', 'fae', 'imp', 'elemental', 'fey', 'pixie', 'nymph', 'faerie'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Humanoid]: ['satyr', 'gnome', 'dwarf', 'halfling', 't[h]?(ie|ei)fling', 'dwarves', 'humanoid', 'yordle', 'hylian', 'lalafell',
 | 
				
			||||||
 | 
					        'zwerg'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Species.Minotaur]: ['minotaur', 'tauren'],
 | 
					    [Species.Minotaur]: ['minotaur', 'tauren'],
 | 
				
			||||||
    [Species.Bat]: ['bat'],
 | 
					
 | 
				
			||||||
    [Species.Alien]: ['alien', 'krogan', 'xenomorph'],
 | 
					    [Species.Monster]: ['gnoll', 'goblin', 'kobold', 'monster', 'troll', 'illithid', 'golem', 'basilisk', 'oni', 'kaiju', 'mimic',
 | 
				
			||||||
    [Species.Mephitidae]: ['skunk'],
 | 
					        'hippogriff', 'hippogryph', 'manticore', 'harpy', 'gargoyle', 'ghost', 'eldritch', 'tentacle', 'youkai', 'ogre', 'skeleton',
 | 
				
			||||||
    [Species.Robot]: ['android', 'robot', 'cyborg'],
 | 
					        'ghoul', 'vrykolakas', 'godzilla', 'bugbear', 'gnobold', 'undead', 'lich',
 | 
				
			||||||
    [Species.Dinosaur]: ['saurus', 'deathclaw', 'dinosaur', 'raptor', 'trex', 't-rex'],
 | 
					        'gryphon', 'griffin', 'y[oō]kai', 'shinigami', 'bunyip'],
 | 
				
			||||||
    [Species.Pokemon]: ['charizard', 'charmander', 'pikachu', 'digimon', 'renamon', 'eevee', 'gardevoir', 'absol', 'aggron', 'jolteon', 'lopunny'],
 | 
					
 | 
				
			||||||
    [Species.Fae]: ['fairy', 'fae', 'imp', 'elemental'],
 | 
					 | 
				
			||||||
    [Species.Taur]: ['chakat', 'centaur', 'equitaur'],
 | 
					 | 
				
			||||||
    [Species.Vampire]: ['vampyre', 'vampire', 'dhampir', 'daywalker'],
 | 
					 | 
				
			||||||
    [Species.Naga]: ['naga', 'lamia'],
 | 
					    [Species.Naga]: ['naga', 'lamia'],
 | 
				
			||||||
    [Species.Monster]: ['gnoll', 'goblin', 'kobold', 'monster', 'troll', 'illithid', 'golem', 'basilisk'],
 | 
					    [Species.Taur]: ['centaur', 'chakat', 'equitaur', 'felitaur', 'weretaur', 'humantaur', 'taur'],
 | 
				
			||||||
    [Species.Giraffe]: ['giraffe'],
 | 
					    [Species.Orc]: ['orc', 'uruk-hai', 'snaga', 'uruk[ -]?hai', 'ork'],
 | 
				
			||||||
    [Species.Rhinoceros]: ['rhino', 'rhinoceros']
 | 
					    [Species.Vampire]: ['vampire', 'd[h]?amp[h]?ir', 'daywalker', 'vampyre', 'vampiric', 'vampir', 'nosferatu'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Were]: ['werewolf', 'lycan', 'werelion', 'weretiger', 'werebear', 'werecoyote', 'werehog', 'were[ -]?wolf', 'were[ -]?lion',
 | 
				
			||||||
 | 
					        'were[ -]?bear', 'were[ -]?coyote', 'were[ -]?hog', 'lycant[h]?rop[h]?e', 'loup[ -]?garou[sx]?',
 | 
				
			||||||
 | 
					        'were[ -]?squirrel', 'were[ -]?donkey'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Alien]: ['krogan', 'xenomorph', 'quarian', 'turian', 'asari', 'togruta', 'otolla', 'gungan', 'chiss', 'alien', 'puazi',
 | 
				
			||||||
 | 
					        'hutt', 'klyntar', 'twi\'?lek', 'sangheili', 'salarian', 't[\']?vaoan'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Robot]: ['android', 'cyborg', 'gynoid', 'automaton', 'robot', 'transformer', 'cybertronian', 'reploid', 'synth', 'ai'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Species.Hub]: ['hub', 'varies', 'various', 'variable', 'many', 'flexible', 'any', 'partner preference']
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -262,3 +412,14 @@ export const kinkMapping: KinkPreferenceMap = {
 | 
				
			|||||||
    no: KinkPreference.No
 | 
					    no: KinkPreference.No
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface SpeciesMappingCacheRecord {
 | 
				
			||||||
 | 
					    regexp: RegExp;
 | 
				
			||||||
 | 
					    keyword: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface SpeciesMappingCache {
 | 
				
			||||||
 | 
					    [key: number]: SpeciesMappingCacheRecord[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -10,9 +10,9 @@ import {
 | 
				
			|||||||
    Gender, genderKinkMapping,
 | 
					    Gender, genderKinkMapping,
 | 
				
			||||||
    Kink,
 | 
					    Kink,
 | 
				
			||||||
    kinkMapping,
 | 
					    kinkMapping,
 | 
				
			||||||
    KinkPreference, mammalSpecies, nonAnthroSpecies,
 | 
					    KinkPreference, likelyHuman, mammalSpecies, nonAnthroSpecies,
 | 
				
			||||||
    Orientation,
 | 
					    Orientation,
 | 
				
			||||||
    Species, speciesMapping,
 | 
					    Species, SpeciesMap, speciesMapping, SpeciesMappingCache,
 | 
				
			||||||
    speciesNames,
 | 
					    speciesNames,
 | 
				
			||||||
    SubDomRole,
 | 
					    SubDomRole,
 | 
				
			||||||
    TagId
 | 
					    TagId
 | 
				
			||||||
@ -421,6 +421,7 @@ export class Matcher {
 | 
				
			|||||||
        const speciesScore = Matcher.getKinkSpeciesPreference(you, theirSpecies);
 | 
					        const speciesScore = Matcher.getKinkSpeciesPreference(you, theirSpecies);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (speciesScore !== null) {
 | 
					        if (speciesScore !== null) {
 | 
				
			||||||
 | 
					            // console.log(this.them.name, speciesScore, theirSpecies);
 | 
				
			||||||
            const speciesName = speciesNames[theirSpecies] || `${Species[theirSpecies].toLowerCase()}s`;
 | 
					            const speciesName = speciesNames[theirSpecies] || `${Species[theirSpecies].toLowerCase()}s`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return Matcher.formatKinkScore(speciesScore, speciesName);
 | 
					            return Matcher.formatKinkScore(speciesScore, speciesName);
 | 
				
			||||||
@ -744,23 +745,50 @@ export class Matcher {
 | 
				
			|||||||
            return Species.Human; // best guess
 | 
					            return Species.Human; // best guess
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return Matcher.getMappedSpecies(mySpecies.string);
 | 
					        const s = Matcher.getMappedSpecies(mySpecies.string);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!s) {
 | 
				
			||||||
 | 
					            console.log('Unknown species', c.name, mySpecies.string);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return s;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static getMappedSpecies(species: string): Species | null {
 | 
					    static generateSpeciesMappingCache(mapping: SpeciesMap): SpeciesMappingCache {
 | 
				
			||||||
 | 
					        return _.mapValues(
 | 
				
			||||||
 | 
					            mapping,
 | 
				
			||||||
 | 
					            (keywords: string[]) => _.map(
 | 
				
			||||||
 | 
					                keywords,
 | 
				
			||||||
 | 
					                (keyword: string) => {
 | 
				
			||||||
 | 
					                    const keywordPlural = `${keyword}s`; // this is weak: elf -> elves doesn't occur
 | 
				
			||||||
 | 
					                    return {
 | 
				
			||||||
 | 
					                        keyword,
 | 
				
			||||||
 | 
					                        regexp: RegExp(`(^|\\b)(${keyword}|${keywordPlural})($|\\b)`)
 | 
				
			||||||
 | 
					                    };
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static speciesMappingCache?: SpeciesMappingCache;
 | 
				
			||||||
 | 
					    private static likelyHumanCache?: SpeciesMappingCache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static matchMappedSpecies(species: string, mapping: SpeciesMappingCache): Species | null {
 | 
				
			||||||
        let foundSpeciesId: Species | null = null;
 | 
					        let foundSpeciesId: Species | null = null;
 | 
				
			||||||
        let match = '';
 | 
					        let match = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const finalSpecies = species.toLowerCase().trim();
 | 
					        const finalSpecies = species.toLowerCase().trim();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _.each(
 | 
					        _.each(
 | 
				
			||||||
            speciesMapping,
 | 
					            mapping,
 | 
				
			||||||
            (keywords: string[], speciesId: string) => {
 | 
					            (matchers, speciesId: string) => {
 | 
				
			||||||
                _.each(
 | 
					                _.each(
 | 
				
			||||||
                    keywords,
 | 
					                    matchers,
 | 
				
			||||||
                    (k: string) => {
 | 
					                    (matcher) => {
 | 
				
			||||||
                        if ((k.length > match.length) && (finalSpecies.indexOf(k) >= 0)) {
 | 
					
 | 
				
			||||||
                            match = k;
 | 
					                        // finalSpecies.indexOf(k) >= 0)
 | 
				
			||||||
 | 
					                        if ((matcher.keyword.length > match.length) && (matcher.regexp.test(finalSpecies))) {
 | 
				
			||||||
 | 
					                            match = matcher.keyword;
 | 
				
			||||||
                            foundSpeciesId = parseInt(speciesId, 10);
 | 
					                            foundSpeciesId = parseInt(speciesId, 10);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -771,6 +799,19 @@ export class Matcher {
 | 
				
			|||||||
        return foundSpeciesId;
 | 
					        return foundSpeciesId;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static getMappedSpecies(species: string): Species | null {
 | 
				
			||||||
 | 
					        if (!Matcher.speciesMappingCache) {
 | 
				
			||||||
 | 
					            Matcher.speciesMappingCache = Matcher.generateSpeciesMappingCache(speciesMapping);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!Matcher.likelyHumanCache) {
 | 
				
			||||||
 | 
					            Matcher.likelyHumanCache = Matcher.generateSpeciesMappingCache(likelyHuman);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return Matcher.matchMappedSpecies(species, Matcher.speciesMappingCache)
 | 
				
			||||||
 | 
					            || Matcher.matchMappedSpecies(species, Matcher.likelyHumanCache);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static getAllSpecies(c: Character): Species[] {
 | 
					    static getAllSpecies(c: Character): Species[] {
 | 
				
			||||||
        const species = Matcher.getAllSpeciesAsStr(c);
 | 
					        const species = Matcher.getAllSpeciesAsStr(c);
 | 
				
			||||||
        return _.filter(_.map(species, (s) => Matcher.getMappedSpecies(s)), (s) => (s !== null)) as Species[];
 | 
					        return _.filter(_.map(species, (s) => Matcher.getMappedSpecies(s)), (s) => (s !== null)) as Species[];
 | 
				
			||||||
@ -783,7 +824,8 @@ export class Matcher {
 | 
				
			|||||||
            return [];
 | 
					            return [];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const speciesStr = mySpecies.string.trim().toLowerCase().replace(/optionally|alternatively/g, ',').replace(/[)(]/g, '');
 | 
					        const speciesStr = mySpecies.string.toLowerCase().replace(/optionally|alternatively/g, ',')
 | 
				
			||||||
 | 
					            .replace(/[)(]/g, ' ').trim();
 | 
				
			||||||
        const matches = speciesStr.split(/[,]? or |,/);
 | 
					        const matches = speciesStr.split(/[,]? or |,/);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return _.filter(_.map(matches, (m) => m.toLowerCase().trim()), (m) => (m !== ''));
 | 
					        return _.filter(_.map(matches, (m) => m.toLowerCase().trim()), (m) => (m !== ''));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user