{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "additional = \"\"\"\n",
    "mengkema\n",
    "kome\n",
    "kume=kami\n",
    "keme=saya (bacha dengan E tanda diatas)\n",
    "yeop = bagi memanggil lelaki yg kita tak tau namanya\n",
    "Opah = Nenek\n",
    "Enda = panggilan ibu yang biasa dipanggil oleh anak2 sadah di Perak.....tak semua\n",
    "Tok Enda = panggilan nenek\n",
    "biole = biar lah\n",
    "belontok = macamikan haruan berbintik cokelat\n",
    "bujuk = ikan haruan\n",
    "bolen = telanjang bulat\n",
    "tumpo = mati\n",
    "pegho = sampan\n",
    "cebok = alat mencedok air\n",
    "bebeno = sungguh/sangat cth budak ne jahat bebeno\n",
    "nyor = kelapa\n",
    "biut = degil\n",
    "begholoh = tidor\n",
    "tak sio = tak mahu\n",
    "teghoyak = menangis\n",
    "bedeah = tipu/menipu\n",
    "piat = pulas.....cth aku piat telinga tu karang.\n",
    "petia = perhati\n",
    "bedek(membedek) = belek (membelek)\n",
    "kayo = pergi buang air\n",
    "kayo beso =berak\n",
    "kayo kecik = kencing\n",
    "yangat = kopi atau teh panas.\n",
    "tepek = lempeng\n",
    "jamban = selain makna biasa.......nama bagi pelantar atau rakit tampat mandi di sungai Perak biasanya dibuat dari batang balak.\n",
    "kulu = kehulu\n",
    "kelio = kehilir\n",
    "kedarat = hala menjauhi sangai\n",
    "kebaroh = hala kesungai\n",
    "Tebin = tepi sungai\n",
    "telio = teringin\n",
    "buah kanto = buah enau\n",
    "koi = kueh\n",
    "kek = cake\n",
    "cekelat = gula gula\n",
    "kopek = tetek\n",
    "kutey = cubit halus\n",
    "kutei = dah lama\n",
    "nohen = buat dek jer...\n",
    "kodak/kekodak = lebihan/serbuk kueh.........umpama orang bertanya banyak ke lagi kueh raya\n",
    "jawabnya tinggei kekodak tong aje.......\n",
    "ngekek = ketawa terbahak bahak\n",
    "ngonyam = gatei (berkaitan lelaki/perempuan)\n",
    "seniat = pukul........dengan lidi umpamanya.\n",
    "sidang = berhenti.......pada hujan\n",
    "samo = warna merah jambu\n",
    "geduak = kerdas\n",
    "getik = benci\n",
    "amra = kedondong\n",
    "meghenin = berkilat\n",
    "nganto\n",
    "kueh deme\n",
    "melantak = kuat makan\n",
    "megholoh = kuat tidor\n",
    "hambo tebo = bersepah/berselerak\n",
    "20.CIK CIBOR = pepatung\n",
    "21.KALA LIPIT = kala jengkin (scorpions)\n",
    "22.CENCOGHOT = tikuih ketughi\n",
    "23.JELEBOR = labi²\n",
    "24.LABUN = cakap\n",
    "25.SEMUT GATEY = semut api\n",
    "26.MENGKIOK = besar sikit dari anai2 selalunya menjadi kalkatu..\n",
    "27.BEDAGHOH = berdarah\n",
    "28.CENANGOR = serangga yg berbau busuk selalu dijumpai berhampiran dgn lampu\n",
    "29.LECAH = Lumpur\n",
    "30.NGETIT = ngokak / gigit ketip\n",
    "31.CONONGGENG = b***** ayam- sample ayat:\"cube bak sini cenonggeng goren tu\" ENCONOT =..... .. atau tongken ayam\n",
    "32.LIBANG LIBU = perasaan resah gelisah....\n",
    "33.MEGHEDANG-GHEDANG = (meredang-redang) maksud dia membuta-tuli SENTEN = menarik kaki seluar ke atas.....ataupun singkat dlm bahasa pekan nya\n",
    "35. BENGKIN = garang\n",
    "36.GETAK =jatuh / luruh\n",
    "37.GEGHOTOK/GEROTOK = jambatan\n",
    "38.MENTELUN = seluar panjang (pantaloon)\n",
    "39.KAYU ROL = kayu pembaris\n",
    "40.SEPEROH = alas / lapik meja\n",
    "41.JEGHOLONG = tempat buang sampah kat tepi hutan\n",
    "42.PIOR = tulin asli\n",
    "43.ACEKEME = macamana kalau\n",
    "44.PENGGE = lontar, baling\n",
    "45.HAMBAT = kejar\n",
    "46.GHULU GHELO = hulu hilir NGELAT = menipu\n",
    "47.SELE'WIN = kira buat asal siap, comot\n",
    "48.HINCIT = Ketepi, ngeysot\n",
    "49.GETIK = nyampoh (menyampah)\n",
    "50.GANJEI = terkena / naya / terkejut\n",
    "51.Reber= sesak, beriya, gedik, poyo..\n",
    "52.SA-NGEIYR atau SANGEI = tudung saji SI-YAR* (sengorkan bunyi..yar.. tu..) = mangguk tingkat\n",
    "53. MENYENGKET - mengintai, mengendap\n",
    "54.GILA SEPEREGHE = separuh gile\n",
    "55.BEBEY = degil tahap batu gajah\n",
    "56.NIN = jernih... 'nin bebenor ayor sungei tu...terhinggin benor nak terojun..'\n",
    "57.GENYII = geli geleman MENYELEBIUR= terjuih bibir\n",
    "58.NYADIN = buat derk aje\n",
    "59.MELENGKO = membelit 'ater komer lekas nengok ulor beso melengko ataih pago rumoh pak bako.'\n",
    "60.MENEBEN MUKE = melangok kat kedai kopi\n",
    "61.TAK SIOR = tak ingin\n",
    "62.BERDANO = kotor sangat\n",
    "63.NYENDIN = tumpang sekaki\n",
    "64.SEMBAI = pasir halus yang basah...(pasir sungai) cher miker pegi kaup sembai kat sungei tu, elok bebeno mbuat bancuh simen\n",
    "65.LIMBAH = air kotor/Lumpur\n",
    "66.MENGEROGHNYOT = berdenyut-denyut\n",
    "67.MEMBANGAO BAU = busuk baunya\n",
    "68.BERDA'AH = bohong/menipu/ kelentong\n",
    "69.TERPEROGHONGO = berlubang besar\n",
    "70.PETIA = memang sudah direnung/ memang yakin\n",
    "71.NYIOR KUTEY = kelapa yang dah kering kat atas pokok kelapa BERONGGOK = berkumpul\n",
    "72.TAWO LEYSYUR = masakan terlalu tawar JENUH = lama sangat..\n",
    "73.BONYEH = berlendir/berlendio r MELANTUNG KOHONG = busuk sesangat\n",
    "74.BENGKEN - Garang, cengih\n",
    "75.TENEHOK - Terkilan\n",
    "76.TAKHSYIOR - Risau sebab ragu2 JELEPEK - Keadaan badan yg lemah longlai, tak terdaya buat apa2\n",
    "77.GOBOK - Almari\n",
    "78.PEJOH - Hal keadaan tidur yg terlalu lena sampai tak sedar apa (tido mampus)\n",
    "79.NYOGHOGAT - Perasaan menyampah terhadap sesuatu + sikit tak suka\n",
    "80.GETIK - Tak suka / Benci\n",
    "81. LANGGAT - Susun; biasa guna pada pinggan eg: \"Ce langgat pinggan tu Man...\"\n",
    "83.MENGHENTE-Merempat\n",
    "84.GOSTAN-Undur belakang.\n",
    "85.NOHEN-No hint Buat tak ambil peduli\n",
    "86.HEMPAH PIOR-Bertungkus lumus,bersungguh2. 87.NYEGHOLANG-Terang bernderang,bercahay a2.\n",
    "89.BERGHANSO-Mintak diri,nak balik.\n",
    "90.HAKAP = Tamak\n",
    "91.NGELER'WO = Ngelewor\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import malaya\n",
    "\n",
    "malays = malaya.texts._malay_words._malay_words"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "from unidecode import unidecode\n",
    "\n",
    "def cleaning(string):\n",
    "    string = unidecode(string).replace('.', '. ').replace(',', ' , ')\n",
    "    string = re.sub('[^\\'\"A-Za-z\\-/ ]+', ' ', string)\n",
    "    string = re.sub(r'[ ]+', ' ', string.lower()).strip()\n",
    "    return string"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "131"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "words = []\n",
    "for line in additional.split('\\n'):\n",
    "    cleaned = cleaning(line)\n",
    "    if len(cleaned) < 3:\n",
    "        continue\n",
    "    c = cleaning(unidecode(line).replace('=', '-').replace(':', '-').split('-')[0]).replace('atau', '/')\\\n",
    "    .replace('\\\\', '/').replace('@', '/').split('/')\n",
    "    \n",
    "    words.extend([cleaning(i) for i in c])\n",
    "    \n",
    "len(words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "additional = \"\"\"\n",
    "Kambing = kambin\n",
    "kuching = kucin\n",
    "lembing = lembin\n",
    "daching = dachin\n",
    "cacing = cacin\n",
    "guling = gulin\n",
    "pusing = pusin\n",
    "bising = bisin\n",
    "car = aco\n",
    "air = ayo\n",
    "Ajar = ajo\n",
    "akar = ako\n",
    "asar = aso\n",
    "fikir =pikio\n",
    "pasir =pashio\n",
    "putar = puto\n",
    "kikir=kikio\n",
    "cicir = cicio\n",
    "kafir=kapio\n",
    "lendir =lendio\n",
    "hanyir= hanyio\n",
    "bibir =bibio\n",
    "bakar=bako\n",
    "belukar=beluko\n",
    "tikar =tiko\n",
    "seluar=seluo\n",
    "ular =ulo\n",
    "sambar=sambo\n",
    "selimbar =selimbo\n",
    "takar=tako\n",
    "besar=beso\n",
    "zikrr = jikio\n",
    "rumah = ghumah\n",
    "orang = oghang\n",
    "kerja = keghoje\n",
    "memburu = menbughu\n",
    "resah = ghesah\n",
    "rosak =ghosak\n",
    "ribu = ghibu\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "170"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "for line in additional.split('\\n'):\n",
    "    cleaned = cleaning(line)\n",
    "    if len(cleaned) < 3:\n",
    "        continue\n",
    "    c = cleaning(unidecode(line).replace('=', '-').replace(':', '-').split('-')[1]).replace('atau', '/')\\\n",
    "    .replace('\\\\', '/').replace('@', '/').split('/')\n",
    "    \n",
    "    words.extend([cleaning(i) for i in c])\n",
    "    \n",
    "len(words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "133"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "words = [i for i in words if len(i) > 3]\n",
    "    \n",
    "words = set(words) - malays\n",
    "len(words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "\n",
    "with open('perak-words.json', 'w') as fopen:\n",
    "    json.dump(list(words), fopen)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
