emossage.js 16.7 KB
const wordToEmoji = new Map();

wordToEmoji.set("미소", String.fromCodePoint(0x1F600));
wordToEmoji.set("웃어", String.fromCodePoint(0x1F604));
wordToEmoji.set("머쓱", String.fromCodePoint(0x1F605));
wordToEmoji.set("ㅋㅋ", String.fromCodePoint(0x1F923));
wordToEmoji.set("씨익", String.fromCodePoint(0x1F642));
wordToEmoji.set("행복", String.fromCodePoint(0x1F60A));
wordToEmoji.set("뽀뽀", String.fromCodePoint(0x1F618));
wordToEmoji.set("존맛", String.fromCodePoint(0x1F60B));
wordToEmoji.set("메롱", String.fromCodePoint(0x1F61C));
wordToEmoji.set("돈무새", String.fromCodePoint(0x1F911));
wordToEmoji.set("흠", String.fromCodePoint(0x1F928));
wordToEmoji.set("-_-", String.fromCodePoint(0x1F611));
wordToEmoji.set("ㅡㅡ", String.fromCodePoint(0x1F611));
wordToEmoji.set("ㅡ_ㅡ", String.fromCodePoint(0x1F611));
wordToEmoji.set("쿨쿨", String.fromCodePoint(0x1F62A));
wordToEmoji.set("드르렁", String.fromCodePoint(0x1F634));
wordToEmoji.set("흥", String.fromCodePoint(0x2639));
wordToEmoji.set("ㅠㅠ", String.fromCodePoint(0x1F97A));
wordToEmoji.set("엉엉", String.fromCodePoint(0x1F62D));
wordToEmoji.set("울고", String.fromCodePoint(0x1F62D));
wordToEmoji.set("울어", String.fromCodePoint(0x1F62D));
wordToEmoji.set("하품", String.fromCodePoint(0x1F971));
wordToEmoji.set("빡쳐", String.fromCodePoint(0x1F621));
wordToEmoji.set("빡초", String.fromCodePoint(0x1F621));
wordToEmoji.set("빡친당", String.fromCodePoint(0x1F621));
wordToEmoji.set("빡친다", String.fromCodePoint(0x1F621));
wordToEmoji.set("빡치네", String.fromCodePoint(0x1F621));
wordToEmoji.set("개빡쳐", String.fromCodePoint(0x1F92C));
wordToEmoji.set("개빡초", String.fromCodePoint(0x1F92C));
wordToEmoji.set("개빡친당", String.fromCodePoint(0x1F92C));
wordToEmoji.set("개빡친다", String.fromCodePoint(0x1F92C));
wordToEmoji.set("개빡치네", String.fromCodePoint(0x1F92C));
wordToEmoji.set("짜증", String.fromCodePoint(0x1F620));
wordToEmoji.set("악마", String.fromCodePoint(0x1F608));
wordToEmoji.set("죽음", String.fromCodePoint(0x1F480));
wordToEmoji.set("죽어", String.fromCodePoint(0x1F480));
wordToEmoji.set("해골", String.fromCodePoint(0x1F480));
wordToEmoji.set("죽었", String.fromCodePoint(0x1F480));
wordToEmoji.set("똥", String.fromCodePoint(0x1F4A9));
wordToEmoji.set("자살하면그만이야", String.fromCodePoint(0x1F921));
wordToEmoji.set("삐에로", String.fromCodePoint(0x1F921));
wordToEmoji.set("광대", String.fromCodePoint(0x1F921));
wordToEmoji.set("귀신", String.fromCodePoint(0x1F47B));
wordToEmoji.set("외계인", String.fromCodePoint(0x1F47D));
wordToEmoji.set("고양이", String.fromCodePoint(0x1F63A));
wordToEmoji.set("냥이", String.fromCodePoint(0x1F63A));
wordToEmoji.set("괭이", String.fromCodePoint(0x1F63A));
wordToEmoji.set("사랑", String.fromCodePoint(0x2764));
wordToEmoji.set("아미", String.fromCodePoint(0x2763));
wordToEmoji.set("입술", String.fromCodePoint(0x1F48B));
wordToEmoji.set("백점", String.fromCodePoint(0x1F4AF));
wordToEmoji.set("100점", String.fromCodePoint(0x1F4AF));
wordToEmoji.set("짜중", String.fromCodePoint(0x1F4A2));
wordToEmoji.set("폭발", String.fromCodePoint(0x1F4A5));
wordToEmoji.set("펑", String.fromCodePoint(0x1F4A5));
wordToEmoji.set("쾅", String.fromCodePoint(0x1F4A5));
wordToEmoji.set("땀", String.fromCodePoint(0x1F4A6));
wordToEmoji.set("도망", String.fromCodePoint(0x1F4A8));
wordToEmoji.set("구멍", String.fromCodePoint(0x1F573));
wordToEmoji.set("말풍선", String.fromCodePoint(0x1F4AC));
wordToEmoji.set("zzz", String.fromCodePoint(0x1F4A4));
wordToEmoji.set("ZZZ", String.fromCodePoint(0x1F4A4));
wordToEmoji.set("ㅎㅇ", String.fromCodePoint(0x1F44B));
wordToEmoji.set("안녕", String.fromCodePoint(0x1F44B));
wordToEmoji.set("ㅇㅋ", String.fromCodePoint(0x1F44C));
wordToEmoji.set("오케이", String.fromCodePoint(0x1F44C));
wordToEmoji.set("브이", String.fromCodePoint(0x270C));
wordToEmoji.set("약속", String.fromCodePoint(0x270C));
wordToEmoji.set("록", String.fromCodePoint(0x1F91F));
wordToEmoji.set("락", String.fromCodePoint(0x1F91F));
wordToEmoji.set("로큰롤", String.fromCodePoint(0x1F91F));
wordToEmoji.set("약속", String.fromCodePoint(0x1F919));
wordToEmoji.set("왼쪽", String.fromCodePoint(0x1F448));
wordToEmoji.set("좌파", String.fromCodePoint(0x1F448));
wordToEmoji.set("오른쪽", String.fromCodePoint(0x1F449));
wordToEmoji.set("우파", String.fromCodePoint(0x1F449));
wordToEmoji.set("좆까", String.fromCodePoint(0x1F595));
wordToEmoji.set("ㅈ까", String.fromCodePoint(0x1F595));
wordToEmoji.set("ㅈㄲ", String.fromCodePoint(0x1F595));
wordToEmoji.set("ㄲㅈ", String.fromCodePoint(0x1F595));
wordToEmoji.set("꺼져", String.fromCodePoint(0x1F595));
wordToEmoji.set("따봉", String.fromCodePoint(0x1F44D));
wordToEmoji.set("엄지척", String.fromCodePoint(0x1F44D));
wordToEmoji.set("추천", String.fromCodePoint(0x1F44D));
wordToEmoji.set("좋아요", String.fromCodePoint(0x1F44D));
wordToEmoji.set("개추", String.fromCodePoint(0x1F44D));
wordToEmoji.set("따봉추", String.fromCodePoint(0x1F44D));
wordToEmoji.set("따봉도치야고마워", String.fromCodePoint(0x1F44D));
wordToEmoji.set("비추", String.fromCodePoint(0x1F44E));
wordToEmoji.set("야유", String.fromCodePoint(0x1F44E));
wordToEmoji.set("구려", String.fromCodePoint(0x1F44E));
wordToEmoji.set("주먹", String.fromCodePoint(0x1F44A));
wordToEmoji.set("박수", String.fromCodePoint(0x1F44F));
wordToEmoji.set("악수", String.fromCodePoint(0x1F91D));
wordToEmoji.set("문의", String.fromCodePoint(0x1F64F));
wordToEmoji.set("제발", String.fromCodePoint(0x1F64F));
wordToEmoji.set("부탁", String.fromCodePoint(0x1F64F));
wordToEmoji.set("^^", String.fromCodePoint(0x1F64F));
wordToEmoji.set("필기", String.fromCodePoint(0x270D));
wordToEmoji.set("글쓰기", String.fromCodePoint(0x270D));
wordToEmoji.set("셀카", String.fromCodePoint(0x1F933));
wordToEmoji.set("근육", String.fromCodePoint(0x1F4AA));
wordToEmoji.set("강력", String.fromCodePoint(0x1F4AA));
wordToEmoji.set("강해", String.fromCodePoint(0x1F4AA));
wordToEmoji.set("팔뚝", String.fromCodePoint(0x1F4AA));
wordToEmoji.set("다리", String.fromCodePoint(0x1F9B5));
wordToEmoji.set("발", String.fromCodePoint(0x1F9B6));
wordToEmoji.set("귀", String.fromCodePoint(0x1F442));
wordToEmoji.set("보청기", String.fromCodePoint(0x1F442));
wordToEmoji.set("코", String.fromCodePoint(0x1F443));
wordToEmoji.set("두뇌", String.fromCodePoint(0x1F9E0));
wordToEmoji.set("뇌", String.fromCodePoint(0x1F9E0));
wordToEmoji.set("이빨", String.fromCodePoint(0x1F987));
wordToEmoji.set("치아", String.fromCodePoint(0x1F987));
wordToEmoji.set("뼈다귀", String.fromCodePoint(0x1F9B4));
wordToEmoji.set("뼈다구", String.fromCodePoint(0x1F9B4));
wordToEmoji.set("뼈", String.fromCodePoint(0x1F9B4));
wordToEmoji.set("혀", String.fromCodePoint(0x1F445));
wordToEmoji.set("입술", String.fromCodePoint(0x1F444));
wordToEmoji.set("응애", String.fromCodePoint(0x1F476));
wordToEmoji.set("아기", String.fromCodePoint(0x1F476));
wordToEmoji.set("사람", String.fromCodePoint(0x1F9D1));
wordToEmoji.set("남자", String.fromCodePoint(0x1F468));
wordToEmoji.set("여자", String.fromCodePoint(0x1F469));
wordToEmoji.set("노인", String.fromCodePoint(0x1F9D3));
wordToEmoji.set("할아버지", String.fromCodePoint(0x1F474));
wordToEmoji.set("할부지", String.fromCodePoint(0x1F474));
wordToEmoji.set("할배", String.fromCodePoint(0x1F474));
wordToEmoji.set("할머니", String.fromCodePoint(0x1F475));
wordToEmoji.set("할무니", String.fromCodePoint(0x1F475));
wordToEmoji.set("할매", String.fromCodePoint(0x1F475));
wordToEmoji.set("싫어", String.fromCodePoint(0x1F64E));
wordToEmoji.set("NO", String.fromCodePoint(0x1F64E));
wordToEmoji.set("no", String.fromCodePoint(0x1F64E));
wordToEmoji.set("예스", String.fromCodePoint(0x1F64E));
wordToEmoji.set("yes", String.fromCodePoint(0x1F64E));
wordToEmoji.set("Yes", String.fromCodePoint(0x1F64E));
wordToEmoji.set("저요", String.fromCodePoint(0x1F64B));
wordToEmoji.set("나요", String.fromCodePoint(0x1F64B));
wordToEmoji.set("굽신", String.fromCodePoint(0x1F647));
wordToEmoji.set("도게자", String.fromCodePoint(0x1F647));
wordToEmoji.set("그랜절", String.fromCodePoint(0x1F647));
wordToEmoji.set("절", String.fromCodePoint(0x1F647));
wordToEmoji.set("넙죽", String.fromCodePoint(0x1F647));
wordToEmoji.set("하...", String.fromCodePoint(0x1F926));
wordToEmoji.set("하..", String.fromCodePoint(0x1F926));
wordToEmoji.set("아차", String.fromCodePoint(0x1F926));
wordToEmoji.set("어쩔티비", String.fromCodePoint(0x1F937));
wordToEmoji.set("저쩔티비", String.fromCodePoint(0x1F937));
wordToEmoji.set("우짤래미", String.fromCodePoint(0x1F937));
wordToEmoji.set("저짤래미", String.fromCodePoint(0x1F937));
wordToEmoji.set("의사", String.fromCodePoint(0x1F468));
wordToEmoji.set("학생", "👨‍🎓");
wordToEmoji.set("선생님", "👨‍🏫");
wordToEmoji.set("선생", "👨‍🏫");
wordToEmoji.set("쌤", "👨‍🏫");
wordToEmoji.set("판사", "👨‍⚖️");
wordToEmoji.set("농부", "👨‍🌾");
wordToEmoji.set("요리사", "👨‍🍳");
wordToEmoji.set("셰프", "👨‍🍳");
wordToEmoji.set("쉐프", "👨‍🍳");
wordToEmoji.set("직장인", "👨‍💼");
wordToEmoji.set("과학자", "👨‍🔬");
wordToEmoji.set("개발자", "👨‍💻");
wordToEmoji.set("프로그래머", "👨‍💻");
wordToEmoji.set("코더", "👨‍💻");
wordToEmoji.set("가수", "👨‍🎤");
wordToEmoji.set("아티스트", "👨‍🎤");
wordToEmoji.set("화가", "👨‍🎨");
wordToEmoji.set("파일럿", "👨‍✈️");
wordToEmoji.set("기장", "👨‍✈️");
wordToEmoji.set("우주인", "👨‍🚀");
wordToEmoji.set("소방관", "👨‍🚒");
wordToEmoji.set("경찰", "👮");
wordToEmoji.set("탐정", "🕵");
wordToEmoji.set("가드", "💂");
wordToEmoji.set("노동자", "👷");
wordToEmoji.set("왕자", "🤴");
wordToEmoji.set("공주", "👸");
wordToEmoji.set("무슬림", "👳");
wordToEmoji.set("젠틀맨", "🤵");
wordToEmoji.set("턱시도", "🤵");
wordToEmoji.set("신랑", "🤵");
wordToEmoji.set("신부", "👰");
wordToEmoji.set("임신", "🤰");
wordToEmoji.set("아기천사", "👼");
wordToEmoji.set("산타", "🎅");
wordToEmoji.set("산타클로스", "🎅");
wordToEmoji.set("히어로", "🦸");
wordToEmoji.set("영웅", "🦸");
wordToEmoji.set("슈퍼히어로", "🦸");
wordToEmoji.set("악당", "🦹");
wordToEmoji.set("나쁜놈", "🦹");
wordToEmoji.set("마법사", "🧙");
wordToEmoji.set("간달프", "🧙");
wordToEmoji.set("하인즈", "🧙");
wordToEmoji.set("덤블도어", "🧙");
wordToEmoji.set("요정", "🧚");
wordToEmoji.set("뱀파이어", "🧛");
wordToEmoji.set("흡혈귀", "🧛");
wordToEmoji.set("블라디미르", "🧛");
wordToEmoji.set("블라디", "🧛");
wordToEmoji.set("인어", "🧜");
wordToEmoji.set("엘프녀", "🧝‍♀️");
wordToEmoji.set("엘프", "🧝");
wordToEmoji.set("레골라스", "🧝");
wordToEmoji.set("지니", "🧞");
wordToEmoji.set("좀비", "🧟");
wordToEmoji.set("마사지", "💆");
wordToEmoji.set("미용", "💇");
wordToEmoji.set("걷", "🚶");
wordToEmoji.set("뛰", "🏃");
wordToEmoji.set("춤", "💃");
wordToEmoji.set("PPAP", "🕺");
wordToEmoji.set("ppap", "🕺");
wordToEmoji.set("펜싱", "🤺");
wordToEmoji.set("승마", "🏇");
wordToEmoji.set("말타기", "🏇");
wordToEmoji.set("스키", "⛷");
wordToEmoji.set("스노우보드", "🏂");
wordToEmoji.set("골프", "🏌");
wordToEmoji.set("서핑", "🏄");
wordToEmoji.set("수영", "🏊");
wordToEmoji.set("농구", "⛹");
wordToEmoji.set("웨이트", "🏋");
wordToEmoji.set("역기", "🏋");
wordToEmoji.set("쇠질", "🏋");
wordToEmoji.set("자전거", "🚴");
wordToEmoji.set("레슬링", "🤼");
wordToEmoji.set("명상", "🧘");
wordToEmoji.set("샤워", "🛀");
wordToEmoji.set("목욕", "🛀");
wordToEmoji.set("취침", "🛌");
wordToEmoji.set("수면", "🛌");
wordToEmoji.set("키스", "💏");
wordToEmoji.set("커플", "💑");
wordToEmoji.set("가족", "👪");
wordToEmoji.set("가정", "👪");
wordToEmoji.set("집안", "👪");
wordToEmoji.set("원숭이", "🐵");
wordToEmoji.set("우끼끼", "🐵");
wordToEmoji.set("몽키", "🐵");
wordToEmoji.set("고릴라", "🦍");
wordToEmoji.set("오랑우탄", "🦧");
wordToEmoji.set("개", "🐶");
wordToEmoji.set("멍멍", "🐶");
wordToEmoji.set("왈왈", "🐶");
wordToEmoji.set("늑대", "🐺");
wordToEmoji.set("여우", "🦊");
wordToEmoji.set("폭스", "🦊");
wordToEmoji.set("퐉스", "🦊");
wordToEmoji.set("라쿤", "🦝");
wordToEmoji.set("사자", "🦁");
wordToEmoji.set("호랑이", "🐯");
wordToEmoji.set("말", "🐴");
wordToEmoji.set("유니콘", "🦄");
wordToEmoji.set("얼룩말", "🦓");
wordToEmoji.set("시슴", "🦌");
wordToEmoji.set("사슴", "🦌");
wordToEmoji.set("고라니", "🦌");
wordToEmoji.set("음무", "🐮");
wordToEmoji.set("젖소", "🐮");
wordToEmoji.set("소", "🐮");
wordToEmoji.set("흑우", "🐃");
wordToEmoji.set("버팔로", "🐃");
wordToEmoji.set("꿀꿀", "🐷");
wordToEmoji.set("돼지", "🐷");
wordToEmoji.set("음메", "🐐");
wordToEmoji.set("염소", "🐐");
wordToEmoji.set("페이커", "🐐");
wordToEmoji.set("GOAT", "🐐");
wordToEmoji.set("goat", "🐐");
wordToEmoji.set("메시", "🐐");
wordToEmoji.set("낙타", "🐪");
wordToEmoji.set("데프트", "🦙");
wordToEmoji.set("라마", "🦙");
wordToEmoji.set("기린", "🦒");
wordToEmoji.set("코끼리", "🐘");
wordToEmoji.set("코뿔소", "🦏");
wordToEmoji.set("하마", "🦛");
wordToEmoji.set("쥐", "🐭");
wordToEmoji.set("찍찍", "🐭");
wordToEmoji.set("쥐새끼", "🐭");
wordToEmoji.set("햄스터", "🐹");
wordToEmoji.set("햄토리", "🐹");
wordToEmoji.set("토끼", "🐰");
wordToEmoji.set("조루", "🐰");
wordToEmoji.set("흑묘", "🐰");
wordToEmoji.set("고슴도치", "🦔");
wordToEmoji.set("박쥐", "🦇");
wordToEmoji.set("곰", "🐻");
wordToEmoji.set("코알라", "🐨");
wordToEmoji.set("판다", "🐼");
wordToEmoji.set("나무늘보", "🦥");
wordToEmoji.set("수달", "🦦");
wordToEmoji.set("스컹크", "🦨");
wordToEmoji.set("방구쟁이", "🦨");
wordToEmoji.set("방귀쟁이", "🦨");
wordToEmoji.set("캥거루", "🦘");
wordToEmoji.set("발자국", "🐾");
wordToEmoji.set("칠면조", "🦃");
wordToEmoji.set("닭대가리", "🐔");
wordToEmoji.set("닭", "🐔");
wordToEmoji.set("병아리", "🐤");
wordToEmoji.set("비둘기", "🕊");
wordToEmoji.set("구구", "🕊");
wordToEmoji.set("독수리", "🦅");
wordToEmoji.set("오리", "🦆");
wordToEmoji.set("꽥꽥", "🦆");
wordToEmoji.set("백조", "🦢");
wordToEmoji.set("부엉이", "🦉");
wordToEmoji.set("야행성", "🦉");
wordToEmoji.set("밤샘", "🦉");
wordToEmoji.set("플라밍고", "🦩");
wordToEmoji.set("앵무새", "🦜");
wordToEmoji.set("개구리", "🐸");
wordToEmoji.set("페페", "🐸");
wordToEmoji.set("악어", "🐊");
wordToEmoji.set("크로코다일", "🐊");
wordToEmoji.set("라코스테", "🐊");
wordToEmoji.set("거북이", "🐢");
wordToEmoji.set("도마뱀", "🦎");
wordToEmoji.set("뱀", "🐍");
wordToEmoji.set("용", "🐲");
wordToEmoji.set("드래곤", "🐲");
wordToEmoji.set("공룡", "🦕");
wordToEmoji.set("티라노", "🦖");
wordToEmoji.set("고래", "🐳");
wordToEmoji.set("돌고래", "🐬");
wordToEmoji.set("돌핀", "🐬");
wordToEmoji.set("물고기", "🐟");
wordToEmoji.set("생선", "🐟");
wordToEmoji.set("복어", "🐡");
wordToEmoji.set("독", "🐡");
wordToEmoji.set("상어", "🦈");
wordToEmoji.set("문어", "🐙");
wordToEmoji.set("타코", "🐙");
wordToEmoji.set("달팽이", "🐌");
wordToEmoji.set("나비", "🦋");
wordToEmoji.set("곤충", "🐛");
wordToEmoji.set("벌레", "🐛");
wordToEmoji.set("버그", "🐛");
wordToEmoji.set("개미", "🐜");
wordToEmoji.set("꿀벌", "🐝");

wordToEmoji.set("생일", "🎂");
wordToEmoji.set("축하", "🎉");

function convertToEmoji() {
	var words = document.getElementById("Field4").value.split(' ');

	console.log(words);
	var output = "";
	for (var wordIndex in words) {
		console.log(wordIndex, ": ", words[wordIndex]);
		var firstIndex = 0;
		while (firstIndex < words[wordIndex].length) {
			var foundEmoji = false;
			for (let secondIndex = firstIndex; secondIndex < words[wordIndex].length + 1; ++secondIndex) {
				var candidate = words[wordIndex].substring(firstIndex, secondIndex);
				console.log("candidate: ", candidate);
				if (wordToEmoji.has(candidate)) {
					output += wordToEmoji.get(candidate);
					console.log("candidate in map: ", wordToEmoji.get(candidate));
					firstIndex = secondIndex;
					foundEmoji = true;
					break;
				}
			}

			if (!foundEmoji) {
				output += words[wordIndex][firstIndex];
				firstIndex += 1;
			}
		}
		console.log("output: ", output);
		output += ' ';
	}

	document.getElementById("Field5").innerHTML = output;
}