{"id":2257,"date":"2020-12-03T07:46:50","date_gmt":"2020-12-02T22:46:50","guid":{"rendered":"http:\/\/141.164.34.82\/?p=2257"},"modified":"2020-12-03T07:49:20","modified_gmt":"2020-12-02T22:49:20","slug":"%ed%85%94%eb%a0%88%ea%b7%b8%eb%9e%a8%ec%9c%bc%eb%a1%9c-%ec%a0%84%eb%8b%ac-%eb%b0%9b%ec%95%98%eb%8b%a4-%ec%9e%91%ec%97%85%eb%81%9d-2","status":"publish","type":"post","link":"http:\/\/ds.sumeun.org\/?p=2257","title":{"rendered":"\ud154\ub808\uadf8\ub7a8\uc73c\ub85c \uc804\ub2ec \ubc1b\uc558\ub2e4. &#8216;\uc791\uc5c5\ub05d!&#8217;"},"content":{"rendered":"<h1>Telegram\uc73c\ub85c \uc791\uc5c5 \uc885\ub8cc\uc640 \uacb0\ub860 \uc804\uc1a1 \ubc1b\uae30<\/h1>\n<p>ML(<strong>M<\/strong>achine <strong>L<\/strong>earning) \ub610\ub294 DL(<strong>D<\/strong>eep <strong>L<\/strong>earning)\ub97c \ud558\ub2e4\ubcf4\uba74 \ubd84\uc11d\uc774 \uc624\ub798 \uac78\ub9ac\ub294 \uacbd\uc6b0\uac00 \ub9ce\ub2e4. \ud55c \ubc88 \ubd84\uc11d\ud558\ub294\ub370 10-20\ubd84\uc529 \ub118\uc5b4\uac00\uba74, \uc774\ub7f0 \uc791\uc5c5\ub4e4\uc744 \ubaa8\uc544\uc11c \ud55c\uaebc\ubc88\uc5d0 \ubd84\uc11d\uc744 \ub3cc\ub9ac\ub294 \uac8c \ub0ab\ub2e4. \uc804\uccb4 \uc791\uc5c5\uc758 \uc608\uc0c1 \uc18c\uc694 \uc2dc\uac04\uc774 \uc801\uac8c\ub294 1-2\uc2dc\uac04 \ub9ce\uac8c\ub294 \uc77c\uc8fc\uc77c \uc774\uc0c1\uc774 \ub418\uae30\ub3c4 \ud55c\ub2e4(\ubcf5\uc7a1\ud55c \ubaa8\ud615\uc758 \ubca0\uc774\uc9c0\uc5b8 \ubd84\uc11d\uc774\ub098 BERT \uac19\uc740 NLP \ubaa8\ud615\uc744 \uc0dd\uac01\ud574\ubcf4\uc790). \ubb38\uc81c\ub294 \uc911\uac04\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud558\uac70\ub098, \ubb54\uac00 \uc798\ubabb\ub418\uc5b4 \uc6d0\ud558\ub358 \uc791\uc5c5\uc774 \uc81c\ub300\ub85c \uc774\ub8e8\uc5b4\uc9c0\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uc774\ub2e4.<\/p>\n<p>\uba87 \uc77c \uc9c0\ub098\uace0 \ubd24\ub354\ub2c8 \ucd1d 20\uac1c\uc758 \uc791\uc5c5 \uc911\uc5d0\uc11c 3\ubc88\uc9f8\uc5d0\uc11c Error\uac00 \ubc1c\uc0dd\ud558\uc5ec \uc791\uc5c5\uc774 \uc911\ub2e8\ub418\uac70\ub098, 3\ubc88\uc9f8 \ubc1c\uc0dd\ud55c \ub17c\ub9ac\uc801 \uc624\ub958\uac00 4-20\ubc88\uc9f8 \uc791\uc5c5\uc5d0\ub3c4 \ub3d9\uc77c\ud558\uac8c \uc801\uc6a9\ub418\uc5c8\ub2e4\uba74?<\/p>\n<p>\ud55c \uac00\uc9c0 \ubc29\ubc95\uc740 \uc791\uc5c5\uc758 \uc911\uac04 \uacb0\uacfc\uc640 \ucd5c\uc885 \uacb0\uacfc\ub97c Telegram\uc73c\ub85c \ubcf4\uace0 \ubc1b\ub294 \uac83\uc774\ub2e4.<\/p>\n<h2>Telegram bot<\/h2>\n<p>Telegram bot\uc758 token\uacfc chat id\ub97c \uc5bb\ub294 \ubc29\ubc95\uc740 \ub2e4\uc74c\uc758 \ub9c1\ud06c\uc5d0 \uc790\uc138\ud788 \uc124\uba85\ub418\uc5b4 \uc788\ub2e4.<\/p>\n<p><a href=\"https:\/\/gabrielkim.tistory.com\/entry\/Telegram-Bot-Token-%EB%B0%8F-Chat-Id-%EC%96%BB%EA%B8%B0\">\ub9c1\ud06c: Telegram Bot Token \ubc0f Chat Id \uc5bb\uae30<\/a><\/p>\n<p>\ubb54\uac00 \ubd80\uc871\ud55c \uc810\uc774 \uc788\ub2e4\uace0 \ud574\ub3c4 \uad6c\uae00\uc744 \ud1b5\ud574 \uc27d\uac8c \ud574\uacb0\ud560 \uc218 \uc788\uc744 \uac83\uc774\ub2e4.<\/p>\n<h2>R package <code>telegram.bot<\/code><\/h2>\n<p>R\uc5d0\uc11c \ud154\ub808\uadf8\ub7a8 \ubd07\uc73c\ub85c \uba54\uc2dc\uc9c0 \ub610\ub294 \uadf8\ub9bc\uc744 \uc804\ub2ec\ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"r\">install.packages('telegram.bot')\r\n<\/code><\/pre>\n<h2>token &amp; chat_id<\/h2>\n<p>\uba3c\uc800 token\uacfc chat_id\ub97c \uc124\uc815\ud574\uc900\ub2e4.<\/p>\n<pre><code class=\"r\">library(telegram.bot)\r\nbot = Bot(token='843244212:AEEZv3tmARKNUvDDySnAyFdEsF8M1geZewx')\r\nupdates = bot$getUpdates()\r\n\r\nchat_id = 382059121\r\n<\/code><\/pre>\n<h2>\uba54\uc2dc\uc9c0<\/h2>\n<pre><code class=\"r\">bot$sendMessage(chat_id = chat_id, text = 'I want to say...')\r\n<\/code><\/pre>\n<h2>\uadf8\ub9bc \ud654\uc77c<\/h2>\n<pre><code class=\"r\">bot$sendPhoto(chat_id = chat_id, photo = 'telegram.png')\r\n<\/code><\/pre>\n<h2>\uacb0\uacfc<\/h2>\n<p><img src=\"http:\/\/141.164.34.82\/wp-content\/uploads\/2020\/12\/telegram.png\" alt=\"telegram \uc804\uc1a1 \uacb0\uacfc\" \/><\/p>\n<h2>\uc885\ud569<\/h2>\n<p>\uc5b4\ub5a4 \uc791\uc5c5\uc774 \ub05d\ub09c \ud6c4\uc5d0\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \ub8e8\ud2f4\uc744 \uc2e4\ud589\ud558\uba74 \ub420 \uac83\uc774\ub2e4. \uc791\uc5c5\uc774 \ub05d\ub098\uba74 \uadf8 \uacb0\uacfc\uc640 \uacb0\uacfc \uadf8\ub9bc\uc744 \ud154\ub808\uadf8\ub7a8\uc73c\ub85c \ubcf4\ub0b4\uc900\ub2e4. \uadf8\ub9ac\uace0 \ub85c\uceec \ucef4\uc5d0\uc11c\uc758 <code>beep<\/code> \uc18c\ub9ac\ub85c \ubaa8\ub4e0 \uc791\uc5c5\uc740 \uc885\ub8cc\ub41c\ub2e4. \ub9cc\uc57d \uc5ec\ub7ec \uac1c\uc758 \uc138\ubd80 \uc791\uc5c5\uc73c\ub85c \uc774\ub8e8\uc5b4\uc9c4 \ud070 \uc791\uc5c5\uc744 \uc9c4\ud589\ud55c\ub2e4\uba74, \uc138\ubd80 \uc791\uc5c5\uc758 \uacb0\uacfc\ub294 \uc54c\ub78c \uc124\uc815\uc774 OFF \ub418\uc5b4 \uc788\ub294 \ucc44\ud305 \ubc29\uc73c\ub85c \ubcf4\ub0b4\uace0, \ubaa8\ub4e0 \uc791\uc5c5\uc774 \ub05d\ub0ac\ub2e4\ub294 \uac83\uc740 \uc54c\ub78c \uc124\uc815\uc774 ON \ub418\uc5b4 \uc788\ub294 \ucc44\ud305\ubc29\uc73c\ub85c \ubcf4\ub0b8\ub2e4\uba74, \uc138\ubd80 \uc791\uc5c5\uc774 \ub05d\ub0a0 \ub54c\ub9c8\ub2e4 \ud578\ub4dc\ud3f0\uc5d0\uc11c \uc54c\ub78c\uc774 \uc6b8\ub9ac\ub294 \uac83\uc744 \ub9c9\uc744 \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"r\">library(telegram.bot)\r\nlibrary(ggplot2)\r\n\r\n# !!! use your own token here\r\nbot = Bot(token='732212345:BAEYv3qrAQNNDvJEqHacbdeFAE8M0fhVrrz')\r\nupdates = bot$getUpdates()\r\nupdates\r\n\r\nchat_id = 382112342 # !!! use your own chat_id here\r\n\r\n## Work or analysis that takes long\r\nsys.sleep(10)\r\n\r\n## send message\r\nmsg_to_bot = sprintf('Work Finished - Accuracy: %5.2f%%', 0.99*100)\r\nbot$sendMessage(chat_id = chat_id, text = msg_to_bot)\r\n\r\n## send picture\r\nmy_plot=ggplot(mtcars, aes(x=mpg)) + geom_histogram(bins=5)\r\nggplot2::ggsave('telegram_result.png', my_plot)\r\nbot$sendPhoto(chat_id = chat_id, photo = 'telegram_result.png')\r\n\r\nlibrary(beepr) # install.packages('beepr')\r\nbeep()\r\n<\/code><\/pre>\n<h2>\ub367\ubd99\uc5ec<\/h2>\n<p>\uc870\uae08 \ub354 \uac04\ud3b8\ud558\uac8c \ud568\uc218\ub85c \ub9cc\ub4e4\uc5b4\ubcf8\ub2e4\uba74.<\/p>\n<ul>\n<li><code>tele_msg('Work 1 done')<\/code><\/li>\n<li><code>tele_pic('result.png')<\/code><\/li>\n<li><code>tele_done()<\/code>!<\/li>\n<\/ul>\n<pre><code class=\"r\"># !!! use your own token here\r\nbot = Bot(token='732212345:BAEYv3qrAQNNDvJEqHacbdeFAE8M0fhVrrz')\r\nupdates = bot$getUpdates()\r\nupdates\r\n\r\nchat1_id = 382112342 # !!! use your own chat_id here\r\nchat2_id = 382112451 # !!! use your own chat_id here\r\n\r\ntele_msg = function(msg_to_bot, chat_id = chat_id1) {\r\n  bot$sendMessage(chat_id = chat_id, text = msg_to_bot)  \r\n}\r\ntele_pic = function(fn_photo, chat_id = chat_id1) {\r\n  bot$sendPhoto(chat_id = chat_id, photo = fn_photo)  \r\n}\r\ntele_done = function(msg_to_bot = 'All is done') {\r\n  tele_msg(msg_to_bot, chat_id2)\r\n  tele_pic('\uc5ec\uc790(\ub0a8\uc790) \uce5c\uad6c \uc0ac\uc9c4\uc774\ub098, \uc88b\uc544\ud558\ub294 \uc5f0\uc560\uc778 \uc0ac\uc9c4?.png', chat_id2)\r\n  library(beepr)\r\n  beep()\r\n}\r\n\r\n## Work or analysis that takes long\r\nsys.sleep(10)\r\n\r\n## send message\r\nmsg_to_bot = sprintf('Work 1 Finished - Accuracy: %5.2f%%', 0.99*100)\r\n\r\n## send picture\r\nmy_plot=ggplot(mtcars, aes(x=mpg)) + geom_histogram(bins=5)\r\nggplot2::ggsave('telegram_result.png', my_plot)\r\ntele_pic('telegram_result.png')\r\n\r\ntele_done()\r\n<\/code><\/pre>\n<ul>\n<li>\ucc38\uace0\ub85c \uc704\uc758 <code>token<\/code>\uacfc <code>chat_id<\/code>\ub294 \ubaa8\ub450 \uc608\uc2dc\uc77c \ubfd0, \uc2e4\uc81c \uc791\ub3d9\ud558\uc9c0 \uc54a\ub294\ub2e4.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Telegram\uc73c\ub85c \uc791\uc5c5 \uc885\ub8cc\uc640 \uacb0\ub860 \uc804\uc1a1 \ubc1b\uae30 ML(Machine Learning) \ub610\ub294 DL(Deep Learning)\ub97c \ud558\ub2e4\ubcf4\uba74 \ubd84\uc11d\uc774 \uc624\ub798 \uac78\ub9ac\ub294 \uacbd\uc6b0\uac00 \ub9ce\ub2e4. \ud55c \ubc88 \ubd84\uc11d\ud558\ub294\ub370 10-20\ubd84\uc529 \ub118\uc5b4\uac00\uba74, \uc774\ub7f0 \uc791\uc5c5\ub4e4\uc744 \ubaa8\uc544\uc11c \ud55c\uaebc\ubc88\uc5d0 \ubd84\uc11d\uc744 \ub3cc\ub9ac\ub294 \uac8c \ub0ab\ub2e4. \uc804\uccb4 \uc791\uc5c5\uc758 \uc608\uc0c1 \uc18c\uc694 \uc2dc\uac04\uc774 \uc801\uac8c\ub294 1-2\uc2dc\uac04 \ub9ce\uac8c\ub294 \uc77c\uc8fc\uc77c \uc774\uc0c1\uc774 \ub418\uae30\ub3c4 \ud55c\ub2e4(\ubcf5\uc7a1\ud55c \ubaa8\ud615\uc758 \ubca0\uc774\uc9c0\uc5b8 \ubd84\uc11d\uc774\ub098 BERT \uac19\uc740 NLP \ubaa8\ud615\uc744 \uc0dd\uac01\ud574\ubcf4\uc790). \ubb38\uc81c\ub294 \uc911\uac04\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud558\uac70\ub098, \ubb54\uac00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2254,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28],"tags":[474],"jetpack_featured_media_url":"http:\/\/ds.sumeun.org\/wp-content\/uploads\/2020\/12\/telegram.png","_links":{"self":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2257"}],"collection":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2257"}],"version-history":[{"count":2,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2257\/revisions"}],"predecessor-version":[{"id":2259,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2257\/revisions\/2259"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/media\/2254"}],"wp:attachment":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2257"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}