mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 22:44:32 +02:00
The Power of const
This commit is contained in:
@@ -0,0 +1,285 @@
|
||||
const dictionary = {
|
||||
"i": "tem",
|
||||
"hi": "hoi",
|
||||
"that": "dat",
|
||||
"that's": "dat",
|
||||
"hello": "hoi",
|
||||
"me": "temmie",
|
||||
"goodbye": "boi",
|
||||
"bye": "boi",
|
||||
"later": "boi",
|
||||
"college": "colleg",
|
||||
"money": "muns",
|
||||
"food": "tem flakes",
|
||||
"snack": "tem flakes",
|
||||
"snacks": "tem flakes",
|
||||
"meal": "tem flakes",
|
||||
"meals": "tem flakes",
|
||||
"human": "hooman",
|
||||
"humans": "hoomans",
|
||||
"chocolate": "choco",
|
||||
"cute": "coot",
|
||||
"allergic": "allergics",
|
||||
"allergy": "allergics",
|
||||
"do": "dos",
|
||||
"does": "dos",
|
||||
"what": "ppppppppp...",
|
||||
"who": "ppppppppp...",
|
||||
"when": "ppppppppp...",
|
||||
"why": "ppppppppp...",
|
||||
"where": "ppppppppp...",
|
||||
"how": "ppppppppp...",
|
||||
"xd": "xd",
|
||||
"but": "b-but",
|
||||
"store": "tem shop",
|
||||
"restaurant": "tem shop",
|
||||
"shop": "tem shop",
|
||||
"temmie": "temmiy",
|
||||
"sick": "holves",
|
||||
"illness": "holves",
|
||||
"ill": "holves",
|
||||
"disease": "holves",
|
||||
"cat": "tem",
|
||||
"dog": 'tem',
|
||||
"hugs": "pets",
|
||||
"pats": "pets",
|
||||
"waves": "pets",
|
||||
"high-fives": "pets",
|
||||
"fistbumps": "pets",
|
||||
"hug": "pet",
|
||||
"pat": "pet",
|
||||
"wave": "pet",
|
||||
"high-five": "pet",
|
||||
"fistbump": "pet",
|
||||
"hungry": "hungr",
|
||||
"muscles": "not coot",
|
||||
"aw": "awwawa",
|
||||
"yikes": "omg!",
|
||||
"ah": "omg!",
|
||||
"oh": "omg!",
|
||||
"yipe": "omg!",
|
||||
"wait": "omg!",
|
||||
"yes": "yee!",
|
||||
"no": "no!",
|
||||
"person": "bark",
|
||||
"monster": "munster",
|
||||
"monsters": "munsters",
|
||||
"great": "tem outta tem",
|
||||
"awesome": "tem outta tem",
|
||||
"cool": "tem outta tem",
|
||||
"nice": "tem outta tem",
|
||||
"good": "tem outta tem",
|
||||
"walks": "vibrates",
|
||||
"moves": "vibrates",
|
||||
"sits": "vibrates",
|
||||
"goes": "vibrates",
|
||||
"runs": "vibrates intensely",
|
||||
"climbs": "vibrates intensely",
|
||||
"escapes": "vibrates intensely",
|
||||
"normal": "bob",
|
||||
"hmm": "p...",
|
||||
"okay": "ok",
|
||||
"lol": "lel",
|
||||
"enemy": "special enemy",
|
||||
"villain": "special enemy",
|
||||
"bad guy": "special enemy",
|
||||
"badguy": "special enemy",
|
||||
"school": "skool",
|
||||
"um": "p...",
|
||||
"elizabeth": "ebears",
|
||||
"yeah": "yaya",
|
||||
"yea": "yaya",
|
||||
"uh-huh": "yaya",
|
||||
"vampire": "wampire",
|
||||
"tired": "*dies*",
|
||||
"exhausted": "*dies*",
|
||||
"bored": "*dies*",
|
||||
"annoyed": "*dies*",
|
||||
"irritated": "*dies*",
|
||||
"mad": "*dies*",
|
||||
"sleepy": "*dies*",
|
||||
"confused": "*dies*",
|
||||
"house": "tem villag",
|
||||
"home": "tem villag",
|
||||
"apartment": "tem villag",
|
||||
"world": "undergroun",
|
||||
"hotel": "mtt resort",
|
||||
"motel": "mtt resort",
|
||||
"inn": "mtt resort",
|
||||
"cash": "g",
|
||||
"gold": "g",
|
||||
"jewels": "g",
|
||||
"aaron": "not coot",
|
||||
"boy": "tim",
|
||||
"girl": "tem",
|
||||
"we": "tems",
|
||||
"you": "u",
|
||||
"your": "ur",
|
||||
"yours": "urs",
|
||||
"there": "dere",
|
||||
"proud": "prouds",
|
||||
"random": "rando",
|
||||
"see": "c",
|
||||
"this": "dis",
|
||||
"egg": "eg",
|
||||
"very": "very!",
|
||||
"excited": "excite",
|
||||
"doesn't": "don't",
|
||||
"sleep": "slep",
|
||||
"noodles": "alphys foob",
|
||||
"scream": "screems",
|
||||
"gonna": "gunna",
|
||||
"pasta": "papy foob",
|
||||
"spaghetti": "papy foob",
|
||||
"scary": "scaredy",
|
||||
"frightening": "scaredy",
|
||||
"worry": "worrys",
|
||||
"worries": "worrys",
|
||||
"sushi": "undyne foob",
|
||||
"banana": "bernerner",
|
||||
"bananas": "bernerners",
|
||||
"apple": "oppl",
|
||||
"apples": "oppls",
|
||||
"grape": "grep",
|
||||
"grapes": "greps",
|
||||
"wonder": "wunders",
|
||||
"wonders": "wunders",
|
||||
"wondering": "wunders",
|
||||
"wonderful": "wunderfull",
|
||||
"think": "finks",
|
||||
"thinks": "finks",
|
||||
"thought": "finked",
|
||||
"beat": "dunks",
|
||||
"defeat": "dunks",
|
||||
"defeated": "dunkd",
|
||||
"they're": "their",
|
||||
"their": "there",
|
||||
"you're": "ur",
|
||||
"because": "cuz",
|
||||
"bc": "cuz",
|
||||
"will": "wil",
|
||||
"things": "thins",
|
||||
"thing": "thin",
|
||||
"science": "scienc",
|
||||
"ice cream": "noice creem",
|
||||
"spear": "speer",
|
||||
"baby": "temini",
|
||||
"babies": "teminis",
|
||||
"child": "temini",
|
||||
"children": "teminis",
|
||||
"kid": "temini",
|
||||
"kids": "teminis",
|
||||
"bot": "xiao",
|
||||
"robot": "mettatun",
|
||||
"ghost": "bluuk",
|
||||
"nap": "slep",
|
||||
"boop": "blep",
|
||||
"beep": "blep",
|
||||
"bleep": "blep",
|
||||
"bop": "blep",
|
||||
"spider": "spoider",
|
||||
"spiders": "sploiders",
|
||||
"music": "moosics",
|
||||
"again": "agin",
|
||||
"the": "teh",
|
||||
"family": "fam",
|
||||
"smart": "smarts",
|
||||
"smartness": "smartiness",
|
||||
"intelligence": "smartiness",
|
||||
"typo": "tpyo",
|
||||
"typo'd": "tyop'd",
|
||||
"typos": "typoys",
|
||||
"yay": "yee",
|
||||
"potato": "tato",
|
||||
"potatoes": "tatos",
|
||||
"fry": "fri",
|
||||
"fries": "fri",
|
||||
"burger": "glamburg",
|
||||
"steak": "stek",
|
||||
"heart": "hart",
|
||||
"love": "lub",
|
||||
"hate": "h8",
|
||||
"like": "liek",
|
||||
"library": "librarby",
|
||||
"fire": "flemz",
|
||||
"flame": "flemz",
|
||||
"fires": "flemz",
|
||||
"flames": "flemz",
|
||||
"witchcraft": "magics",
|
||||
"witchcrafts": "magics",
|
||||
"magic": "magics",
|
||||
"sorcery": "magics",
|
||||
"superpower": "magics",
|
||||
"superpowers": "magics",
|
||||
"sorceries": "magics",
|
||||
"and": "n",
|
||||
"my": "tem's",
|
||||
"mine": "tem's",
|
||||
"everyone": "everytem",
|
||||
"anyone": "anytem",
|
||||
"someone": "sometem",
|
||||
"everbody": "everytemmie",
|
||||
"anybody": "anytemmie",
|
||||
"somebody": "sometemmie",
|
||||
"beautiful": "booftifull",
|
||||
"pretty": "prety",
|
||||
"so": "soooo",
|
||||
"help": "halp",
|
||||
"uh-uh": "nuh",
|
||||
"nope": "nuh",
|
||||
"nuh-uh": "nuh",
|
||||
"please": "pls"
|
||||
};
|
||||
|
||||
function translateWord(word) {
|
||||
let wordTranslate = dictionary[word.toLowerCase()];
|
||||
if (wordTranslate === undefined) return word;
|
||||
else return applyCase(word, wordTranslate);
|
||||
}
|
||||
|
||||
function applyCase(wordA, wordB) {
|
||||
if (wordA.length === 1 && wordB.length !== 1) return wordB;
|
||||
if (wordA === wordA.toUpperCase()) return wordB.toUpperCase();
|
||||
if (wordA === wordA.toLowerCase()) return wordB.toLowerCase();
|
||||
let firstChar = wordA.slice(0, 1);
|
||||
let otherChars = wordA.slice(1);
|
||||
if (firstChar === firstChar.toUpperCase() && otherChars === otherChars.toLowerCase()) {
|
||||
return wordB.slice(0, 1).toUpperCase() + wordB.slice(1).toLowerCase();
|
||||
}
|
||||
return wordB;
|
||||
}
|
||||
|
||||
function isLetter(character) {
|
||||
if (character.search(/[a-zA-Z'-]/) === -1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function translator(text) {
|
||||
let translatedText = "";
|
||||
let word = "";
|
||||
for (let i = 0; i < text.length; i += 1) {
|
||||
let character = text[i];
|
||||
if (isLetter(character)) {
|
||||
word += character;
|
||||
}
|
||||
else {
|
||||
if (word != "") {
|
||||
let wordTranslate = translateWord(word);
|
||||
translatedText += wordTranslate;
|
||||
word = "";
|
||||
}
|
||||
translatedText += character;
|
||||
}
|
||||
}
|
||||
|
||||
if (word !== "") translatedText += translateWord(word);
|
||||
|
||||
return translatedText;
|
||||
}
|
||||
|
||||
module.exports = function(text) {
|
||||
let currentTranslation = translator(text);
|
||||
let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join("");
|
||||
|
||||
return temmify;
|
||||
};
|
||||
Reference in New Issue
Block a user