2023-04-01ãã1ã¶æéã®è¨äºä¸è¦§
ã¯ããã« ãªã³ã¯ã¹ã¿ã¼ãï¼ nikkieã§ãã ã²ã¼ã ãéãã§ãã ããªã®ã«è¨è¨ã«ã¤ãã¦å¦ã¹ããæé«ã§ãããã ãããªã²ã¼ã ãå®å¨ãããã§ãããã®åãããã°ãã³ã¿ã¼2 REBOOTãï¼ éãã§ã¿ããã°ã®ã¢ã¦ããããã§ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ããé§åæ¬å¯ææ ãâ¦
ã¯ããã« å°ããªæã®ãã⪠ãªãã¬å°ããªæ°ã¥ãã®è¨äºãnikkieã§ãã Pythonã®csvã¢ã¸ã¥ã¼ã«ã«é¢ããå°ããªæ°ã¥ãï¼ãã ãããæè¿ã®ã¨ã³ããªãã¤ãªããã®ï¼ã®å ±æã§ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ çµè« 解説ãã¼ãï¼éå»ã¨ã³ããªã¨ã®ã¤ãªãããæãããã ã è£è©±ï¼â¦
ã¯ããã« ã©ããã nikkieã§ãã æ¨æ¥4/27(æ¨)ã«ãªã³ã©ã¤ã³éå¬ãããLLMæ´»ç¨äºä¾ã®LTä¼ã®ã¬ãã¼ãã§ãã æ¬å½ã«åºæ¿çã§ããã¡ããã¡ããã³ã·ã§ã³ä¸ããã¾ããï¼ï¼ç¥åï¼ï¼ ç®æ¬¡ ã¯ããã« ç®æ¬¡ åå¼·ä¼ã®æ¦è¦ ã¢ã¼ã«ã¤ãå ¬éããã¦ã¾ãï¼ï¼ã¿ããªãã²è¦ã¦ï¼ â¦
ã¯ããã« æ ç»ãè²ã®å½¢ããä¹ ãã¶ãã«è¦³ã¾ãããnikkieã§ãã Pythonã®csvã¢ã¸ã¥ã¼ã«ã®ããã¥ã¡ã³ãã§ãé·ããã¨ããåãããªãã£ãã®ã§ãããããããæå³ãåããç®æãããã¾ãã ãã®ç¹ã«ã¤ãã¦å ±æãã¾ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ãã£ã¨åãããªãã£ããoâ¦
ã¯ããã« ããããChatGPTã¨ã®ãã¢ãã...ï¼ nikkieã§ã Webãã¼ã¸ã®æ¬æãåå¾ããã¨ãããã¡ããã¡ãã¹ããâ¨ãªé¢æ°ã®å®è£ ãè¦ããã¾ããã ããªã«ããããã£ã¡ã便å©ï¼ç§ã使ãããï¼ï¼ã ãã®å®è£ ã¯JavaScriptã§ãã ãPythonã§ãããªããã¨ã§ããªãããªâ¦
ã¯ããã« ãã¼ãããããã³ããªããã¼ãï¼1 nikkieã§ãã åºæ表ç¾æ½åºï¼NERï¼ã¿ã¹ã¯ãCRFï¼Conditional Random Fields2ï¼ã§è§£ãå®è£ ã®ç解ãæ·±ãããããã¥ã¼ããªã¢ã«ã§ç´ æ¯ããã¾ããã ç®æ¬¡ ã¯ããã« ç®æ¬¡ Hironsanã«ãããã¥ã¼ããªã¢ã« ç´ æ¯ãææç© ãâ¦
ã¯ããã« ãã«ããï¼ãªãã¬ããã«ãã¼ã©ï¼ nikkieã§ãã å æ¥ChatGPTãã©ã®ããã«æ¥æ¬èªããã¹ãããã¼ã¯ã³åããã®ãè¦ãã¾ããã ãã¼ã¯ã³ã®IDãã対å¿ããããã¹ããè¦ããã¨Pythonã®bytesãæ±ã£ãããã§ããããã®ä¸ã§æããçåã«ã¤ãã¦ã¢ã¦ããããã§â¦
ã¯ããã« ããã1ã¤ã®é¡ãã®éµæ¢ã1ãnikkieã§ãã å æ¥tiktokenããã¥ã¼ããChatGPTã®APIãå¼ã³åºããã«å ¥åãã¼ã¯ã³é·ãåããããã«ãªãã¾ããã ãã®ä¸ã§ãASCII以å¤ã®æåï¼ä¾ï¼æ¥æ¬èªï¼ã«ã¤ãã¦ã¯ããã¼ã¯ã³ï¼bytesãªãã¸ã§ã¯ãï¼ããã®ã¾ã¾ã§ã¯èªã¿è§£â¦
ã¯ããã« TikTokerãããªãã¦ããã¬ããã´ã¼ã1ãªnikkieã§ãã ä¹ ãã¶ãã®ChatGPTãã¿ã§ã2ã ChatGPTï¼ãLLMï¼ã§ã¯ãã¼ã¯ã³ã®é·ãã«é¢å¿ãåããã¨ãããã¾ãã ãã®ãã¼ã¯ã³ã«ã¤ãã¦ãOpenAI製ã®ã©ã¤ãã©ãªtiktokenã®åå¨ãç¥ãã¾ãã3ã ç´ æ¯ããã¦åãã£â¦
ã¯ããã« ããã£ãâï¸ nikkieã§ãã å æ¥ãCSVãã¡ã¤ã«ã®è¡ã種ã ã®ãã¼ã¿åã«å¤æããå®è£ ãä¸è¦§ã«ãã¾ããã ãã®ä¸ã§ãã¼ã¿ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã¸ã®å¤æã«ã¤ãã¦ãããããªããæ¹ãããã¨æ°ã¥ããã®ã§ä¸è¦§ã«ãã¾ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ åæ csv.readerâ¦
ã¯ããã« ãããããããæ»ãã ãnikkieã§ã1ã CSVå½¢å¼ã®ãã¡ã¤ã«ãèªã¿è¾¼ãã§ãè¡ãå種ãã¼ã¿åã«å¤æããæ¹æ³ãä¸è¦§ã«ãã¦ããã¾ãï¼ ããã¥ã¡ã³ããè¦ã¦ãããããããã©ããªãã¼ã¿åã«ãå¤ããããããããªãããã¨çæ³ãå¾ããã§ãã ç®æ¬¡ ã¯ããã« â¦
ã¯ãã㫠サァï¾!!! nikkieã§ãã Pythonã®ããã±ã¼ã¸ã«.py以å¤ã®ãã¡ã¤ã«ãå«ããè¨å®ã«ã¤ãã¦å æ¥ã¢ã¦ãããããã¾ããã ç¥ã£ããã¨ãèªä½ããã±ã¼ã¸ã«é©ç¨ãããã¨ããã¨ãããã»ãã®è¨å®æ¹æ³ããããã¨ãåããã¾ããã æ·±ã¾ã£ãç解ãå ã«ã¢ã¦ãããããâ¦
ã¯ããã« ã¿ããªã®ä¸ã«ç§ã¯ããªã1 nikkieã§ãã Pythonã®ããã±ã¼ã¸ã«.py以å¤ã®ãã¡ã¤ã«ãå«ããããã¨ã£ã¦ããã¾ãããã ããã«å¿ è¦ãªè¨å®ã«ã¤ãã¦ã®ã¢ã¦ããããã§ãã ãªãã.py以å¤ã®ãã¡ã¤ã«ãæãã¦ãã¿ã¤ãã«ã§ããªã½ã¼ã¹ãã¡ã¤ã«ãã¨æ¸ãã¾ããã â¦
ã¯ããã« ã¨ã¼ã½ãã¼ï¼1 nikkieã§ãã ããæ°æ¥ã¯csvã¢ã¸ã¥ã¼ã«ã§ç¥ã£ããã¨ãã¢ã¦ãããããã¦ãã¾ãã ä»åã¯csv.DictReaderã®ã½ã¼ã¹ã³ã¼ããªã¼ãã£ã³ã°ã§ç¥ã£ããã¨ã§ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ csv.DictReaderã¨ã¯ csv.DictReaderã®ã½ã¼ã¹ã³ã¼ããªã¼ãã£ã³â¦
Pythonã®csv.readerã§CSVã®ä¸ã®ããã«ã¯ã©ã¼ããã©ãæ±ããããç解ãã第ä¸æ©
ã¯ããã« ç§çæå¼·æ¦å¿µ ããããããã¡ãã nikkieã§ãã æã¨ãã¦åä»ãªå½¢å¼ã®CSVãã¡ã¤ã«ãæ±ããªããã°ãªããªããã¨ã£ã¦ããã¾ãããã csvã¢ã¸ã¥ã¼ã«ã使ã£ã¦æãã§ãã£ãã®ã§ãããèªã¿è¾¼ãã CSVã§ã¯ãããã«ã¯ã©ã¼ããéããã¾ã§ã¯åºåãæåã§åå²ãâ¦
ã¯ããã« ãã«ãªããããã©ãã·ã¥ããèªçæ¥ããã§ã¨ããããã¾ãï¼ nikkieã§ã1 Pythonæ¨æºã©ã¤ãã©ãªã®csvã¢ã¸ã¥ã¼ã«ã¨ã®ä»ãåããé·ãã®ã§ããããã®ãã³readerï¼ãwriterï¼ã®dialectå¼æ°ã®æå³ãããããå®å ¨ç解ãã¾ããï¼ ããã«ã¢ã¦ãããããã¾ããâ¦
ã¯ããã« ãã¥ã¼ã¸ã§ãã¬ã¼ã·ã§ã³ãºï¼ nikkieã§ãã Python使ãã®ã¿ãªãããã¸ã§ãã¬ã¼ã¿ä½¿ã£ã¦ã¾ããï¼ ç§ã¯å¤ç¨ãã¦ãã¾ããããææ¾ãã¾ããï¼ ãããªã¸ã§ãã¬ã¼ã¿ï¼ãè¿ãé¢æ°ï¼ã®åãã³ãã«ã¤ãã¦ã¢ã¦ãããããã¾ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ã¸ã§ãã¬ã¼ã¿â¦
ã¯ããã« TDKKï¼ã¨ã£ã¦ã大好ããããã¿ã®å¤åï¼ nikkieã§ãã å ¬é以æ¥ç¹°ãè¿ãåå ´ã«éã1ãå æ¥åä½å°èª¬ãèªç ´2ãããããã¿ã®å¤åãã æ ç»ã ãã§ãªãåä½ãèªãã ãã¨ã§ç§ã®ä¸ã§ã¯é常ã«æ·±ã¿ãå¢ãã¦ãã¾ãã¦ãèªãããã¨ããããã¿ãã¬ããã§èªã£ã¦ãâ¦
ã¯ããã« éå±ãªãã¨ã¯Pythonã«ããããã1ãnikkieã§ãã Pythonã®ã¦ããããã¹ããã¬ã¼ã ã¯ã¼ã¯ã®1ã¤ãpytestã pytestã¯ãã©ã¡ã¿åãããã¹ããå¯è½ã«ãã¦ãããã®ã§ããããã©ã¡ã¿åãããã¹ãã«ã¤ãã¦æè¿ç¥ã£ãå°ããtipsãã¢ã¦ãããããã¾ãï¼ ç®æ¬¡ â¦
ã¯ããã« ç§ãã¡ãéãããæéã®å ¨ã¦ãããããè¼ãã ã£ããã 1ãnikkieã§ãã 2022å¹´ããããé§åæ¬ã®èªæ¸ä¼ãéå¬ãã¦ãã¾ããã å æ¥ãæçµåãçµãã¾ãã¦ï¼ç¥ã»éåï¼ï¼ãä»åã¯ããã¾ã§ã®èªæ¸ä¼ãã¾ã¨ãã¾ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ããé§åæ¬_èªæ¸pyã¨â¦
ã¯ããã« ãã£ãã ãã£ãã ãã¼1ãnikkieã§ãã ãããã¹ãPythonããã£ããã§èãããã¨ãã¢ã¦ããããã§ãã ç§ã¯ããã¾ã§ãåãåã®è¦ç´ ãå ¥ããè¾æ¸ããéãåã®è¦ç´ ãå ¥ããè¾æ¸ãã©ã¡ãããã使ã£ã¦ããã®ã§ãããå¾è ã«ã¯ããåãæ¹æ³ãããã¨ç¥ã£â¦
ã¯ããã« ã¨ããããããããããããã°ãããããããããnikkieã§ãã æ¨å¹´12æã«è¦³ã¦1以æ¥ãã¨ã£ã¦ã大好ã2ãªãããã¿ã®å¤åãã ãã®ãã³åä½ãæå¾ã¾ã§èªã¿ã¾ããï¼ æ·±å ããããç¹ã¯ãã£ã±ãããã®ã§ããããã®ã¨ã³ããªã¯ãã¿ãã¬ãªãã§ãéããã¾ã â¦
ã¯ããã« ãã«ã»ãã«ã»ã¢ãªã»ã¢ãª!1 nikkieã§ãã æ©æ¢°å¦ç¿é¢ä¿ã®èªæ¸ãã°ãæ®ãã¾ãã åãçµããã¨ã®å¤ããã«ãã©ãã«åé¡ã«ã¤ãã¦ãã¾ã¨ã¾ã£ãè¨è¿°ã®ããæ¸ç±ãç¥ã£ãã®ã§ãèªã¿ã¾ããã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ãæ©æ¢°å¦ç¿ãã¶ã¤ã³ãã¿ã¼ã³ã ã·ã³ã°ã«ã©ãã«â¦
ã¯ããã« å¤æ´ããããã³ã¼ããæ¸ããªãã®ã«ã½ããã¦ã§ã¢éçºã¨ãèãã¦ããã®ã§ãã1 ããããªããããnikkieã§ã ã¢ãã¡ã大好ããªç§ãä½åé¸ã³ã®è»¸ã¯ããããããã§ãã ãããªè²ããªããã¤ã³ãããããããã¨æè¡æ¸ãã¾ããã®åä½ãããããæ§ããã«è¨ã£â¦
ã¯ããã« ããã¯ãããã®ã¹ãã¼ãªã¼1 nikkieã§ãã ããé§åæ¬ 12ç« ãã¡ã½ããï¼é¢æ°ï¼ããæ©ã«æãåºããæ¬ãããã£ã¦ãã¾ãã ãClean Codeãã®ç¬¬3ç« ãé¢æ°ãã®èªæ¸ãã°ãæ®ãã¾ãã ç®æ¬¡ ã¯ããã« ç®æ¬¡ ãClean Codeã第3ç« ãé¢æ°ã é¢æ°ã«ã·ã¹ãã ãèªãâ¦
ã¯ããã« ããããããå®è¥¿ãããããï¼ãå¾ ã¡ãã¦ã¾ããã1ããnikkieã§ãã ãã¾ã«ã¯ã¢ãã¡ãã¿ãã ãã®ããã°ã§å®æçã«åãä¸ãã¦ããæ ç»ãããã¿ã®å¤åãã å é±ã¯ä½ä¸ã¨æé軸ãéãªããã¤ãã³ãããã£ããã§ãï¼ ç®æ¬¡ ã¯ããã« ç®æ¬¡ 2023/03/30 ãâ¦
ã¯ããã« ç°è°ããï¼ nikkieã§ãã ãããã¹ãPythonããèªã¿å§ãã¾ããã å°æ¥ã®éçºè ã«æå³ãä¼ããPythonã®æ¸ãæ¹ãæåãããï¼è°è«ã®ããã®ï¼æ¬ã§ãã 10ç« ã¯ã©ã¹ã¯èè ï¼Patrickããï¼ã®æ³ããè¾¼ããããç« ã¨ãè¦åããã¾ãããç§ã¨ãã¦ãè°è«ãããâ¦
ã¯ãã㫠天海æ¥é¦ãããæ¡åããããããå浦康è£ç£ç£ãèªçæ¥ããã§ã¨ããããã¾ã nikkieã§ãã ãè¯ãã³ã¼ãï¼æªãã³ã¼ãã§å¦ã¶è¨è¨å ¥éãï¼é称ããé§åæ¬ï¼ã®èªæ¸ãã°ã§ãã 次åã®ããé§åæ¬_èªæ¸pyã«åãã12ç« ãã¡ã½ããï¼é¢æ°ï¼ãã®äºç¿ã«çæãã¾â¦
ã¯ããã« ãã¾ããããããã¡ãããããããã¾ãããèã¡ããã nikkieã§ã1 2022å¹´12æãããªãªã¼ã¹ãã¼ãã«è¦ç«ã¦ãæã®ãµããããããã¦ãã¾ãã 2æã®ãµããããã¯ãã¡ãï¼ ããã§ã¯3æã®ãµããããããã£ã¦ã¿ã¾ããã¼ï¼ ç®æ¬¡ ã¯ããã« ç®æ¬¡ æè¡ã¾ãã â¦
ä»æ¥ã¿ããªãã¯ã¦ãªã«å ¥ç¤¾ããããããªãï¼ï¼ ã©ããããã®ããç¥ããç§ãä¹ã£ãããã¨ã«ãã¾ãã1ã å ¥ç¤¾ããããï¼ã¤ããã»ã¨ã¤ããªã«ããããããã« (â ÕਠÕ)âï½³ï½ªï½°ï½²ï¼ 3æã®ãµããããã¾ã¨ã -> Togetterã«ããããã¾ã¨ããã ã¨ãã£ã¦ãããé ããªã£ãã®â¦