Upgrade to Pro — share decks privately, control downloads, hide ads and more …

1binary 自己完結型の 形態素解析器 kagome を 作ってみた話

ikawaha
June 21, 2015

1binary 自己完結型の 形態素解析器 kagome を 作ってみた話

GoCon2015 Summer

ikawaha

June 21, 2015
Tweet

More Decks by ikawaha

Other Decks in Programming

Transcript

  1. CJOBSZࣗݾ׬݁ܕͷ
    ܗଶૉղੳثLBHPNFΛ
    ࡞ͬͯΈͨ࿩
    !JLBXBIB

    View full-size slide

  2. w QVSFHPͳܗଶૉղੳث
    w LVSPNPKJͷݕࡧϞʔυ૬౰ͷղੳʹରԠ
    w ࣙॻಉࠝ
    w εϨουηʔϑ
    w CJOBSZ
    ໋໊͸ϥςΟε͕

    ᝷ͷ໨ͷΑ͏ʹ

    ݟ͑Δͱ͔͜Β
    LBHPNF<᝷໨>

    View full-size slide

  3. ࠓ೔ͷ͓࿩
    w ܗଶૉղੳʹ͍ͭͯ
    w ࣙॻσʔλΛόΠφϦʹຒΊࠐΉํ๏ʹ͍ͭͯ

    View full-size slide

  4. ܗଶૉղੳͱ͸

    View full-size slide

  5. )FMMP 8PSMEͱͯ͠ͷ

    ܗଶૉղੳث
    w ܗଶૉղੳͷղੳ෦෼͸ൺֱత؆୯ʹͭ͘ΕΔ
    w TUFQจதʹදΕΔࣙॻͷݟग़͠ޠΛ͢΂ͯྻڍ
    w TUFQ࠷΋Β͍͠ܗଶૉͷฒͼΛݟ͚ͭΔ
    w ࣙॻΛ࡞Δͷ͸େม
    w .F$BCͷࣙॻΛར༻͢Δ

    View full-size slide

  6. w ܗଶૉͷϦετͱ࿈઀ίετද͔ΒͳΔ
    ࣙॻ
    ද૚ܗ จ຺*% ίετ
    จ຺*%ɿ࿈઀ίετΛҾͨ͘ΊͷΩʔ

    View full-size slide


  7. จதʹදΕΔࣙॻͷݟग़
    ͠ޠΛ͢΂ͯྻڍ
    ͢ ΋ ΋ ΋ ΋ ΋ ΋ ΋ ΋ ͷ ͏ ͪ
    ͢
    ͢ ΋ ΋
    ΋
    ΋ ΋
    จ಄͔ΒจࣈͣͭͣΒ͠ͳ͕Βɼ
    ࣙॻͷݟग़͠ʹೖ͍ͬͯΔޠΛྻڍ͍ͯ͘͠

    View full-size slide


  8. จதʹදΕΔࣙॻͷݟग़
    ͠ޠΛ͢΂ͯྻڍ
    ઌ΄ͲͷදΛάϥϑʹ௚͢ͱ͜Μͳײ͡
    ஫άϥϑͷ಄ͱ৲ඌʹμϛʔͷϊʔυ͕௥Ճͯ͋͠Γ·͢

    View full-size slide


  9. จதʹදΕΔࣙॻͷݟग़
    ͠ޠΛ͢΂ͯྻڍ
    ઌ΄ͲͷදΛάϥϑʹ௚͢ͱ͜Μͳײ͡
    ஫άϥϑͷ಄ͱ৲ඌʹμϛʔͷϊʔυ͕௥Ճͯ͋͠Γ·͢
    ಉ͡ݟग़͠ޠͰ΋඼ࢺ͕ҧ͏΋ͷ͕͋Ε͹
    ௥Ճ͠·͢

    View full-size slide


  10. จதʹදΕΔࣙॻͷݟग़
    ͠ޠΛ͢΂ͯྻڍ
    ࣙॻʹ࿈઀ίετද͕͋ΔͷͰ

    ลͱϊʔυʹॏΈΛ͚ͭ·͢

    View full-size slide


  11. ࠷খίετͷύεΛݟ͚ͭΔ
    7JUFSCJ"MHPSJUIN
    ֤ϊʔυ͝ͱͷ࠷খίετύεΛϝϞ͍ͯ͘͠
    ຤ඌ͔Β࠷খίετύεΛͨͲ͍ͬͯ͘

    View full-size slide

  12. ΍Γ͍ͨ͜ͱ
    w HPHFU͙ͯ͢͠ʹ࢖͑Δܗଶૉղੳث
    w ࣙॻΛผʹ͢ΔͱHPHFUͰ͙͢ʹ࢖͑ͳ͍͠ɼ

    ໘౗ͩࠞ͠ཚ͢Δ

    View full-size slide

  13. Ͳ͏΍ͬͯࣙॻΛ
    όΠφϦʹؚΊΔ͔
    w ,VSPNPKJ KBWB࣮૷ͷܗଶૉղੳث

    w ࣙॻ͸KBSͷதʹؚΊͯ͋Δ
    w HPͰ΍Δʹ͸Ͳ͏ͨ͠Β͍͍͔ʁ
    w ࣙॻ͸Ͳ͏ͤಡΈࠐ·ΕͯσʔλʹͳΔΜ͔ͩΒɼ
    ͦͷσʔλΛ͋Β͔͡Ίίʔυʹ͓͚ͯ͠͹͍͍ͷ
    Ͱ͸ͳ͍͔ʁ

    View full-size slide

  14. UFYUUFNQMBUFΛ࢖ͬͯࣙॻϑΝΠ
    ϧΛHPͷιʔεϑΝΠϧʹม׵͢Δ
    w ͨͱ͑͹࿈઀ίετදɿºສ

    View full-size slide

  15. ͏ͧ͘͝ʂ
    w Ϗϧυʹʙ෼
    w Ϗϧυ͢ΔͷʹϝϞϦ͕݁ߏඞཁ
    w όΠφϦαΠζ.#ͪΐͬͱ
    w ಈ࡞͸໰୊ͳ͍͕ɼ͍Ζ͍Ζແཧ͕͋Δ

    View full-size slide

  16. HPCJOEBUBΛ࢖͏
    w ೚ҙͷϑΝΠϧΛɼͦͷσʔλΛόΠφϦσʔλͱ
    ͯ͠ຒΊࠐΜͩHPͷιʔείʔυΛੜ੒ͯ͘͠ΕΔ
    w ͜ΕΛར༻ͯ͠ɼࣙॻϑΝΠϧΛม׵ͯ͠૊ΈࠐΉ

    View full-size slide

  17. HPCJOEBUB
    ΞηοτΛ഑ஔ͢Δ

    σΟϨΫτϦΛܾΊΔ
    CJOEBUBHP

    View full-size slide

  18. HPCJOEBUB
    ϑΝΠϧ಺༰
    TUSJOH͸ VUGͱͯ͠ਖ਼͘͠ͳ͍
    ͲΜͳόΠτྻͰ΋

    อ࣋Ͱ͖Δ

    View full-size slide

  19. HPCJOEBUB
    w Ϗϧυ͕஗͘ͳΒͳ͍Α͏ʹ

    σʔλ෦෼͸TUSJOHʹม׵͞Ε͍ͯΔ
    w ͨͩ͠ɼ<>CZUF zIFMMPz
    ͸࣮ߦ࣌ʹςΩετ͔Βό
    ΠτͷεϥΠεʹ಺༰Λίϐʔ͠ͳ͚Ε͹ͳΒͳ͍
    w ͜ΕΛճආ͢ΔͨΊʹOPNFNDPQZͱ͍͏ςΫ
    χοΫ͕ΦϓγϣϯͰ༻ҙ͞Ε͍ͯΔ

    View full-size slide

  20. OPNFNDPQZ
    TUSJOH <>CZUF
    -FO
    %BUB %BUB
    -FO
    $BQ
    TUSJOHͷσʔλຊମΛόΠτεϥΠεͷσʔλʹྲྀ༻ͯ͠

    ίϐʔΛ๷͙ ཁSFqFDUVOTBGF

    View full-size slide

  21. QVMMSFRࡁΈ

    View full-size slide

  22. ·ͱΊ
    w ܗଶૉղੳثͷղੳ෦෼͸ׂͱ؆୯ʹͭ͘ΕΔ
    w HPCJOEBUBΛ࢖ͬͯɼ͍Ζ͍ΖͳσʔλΛຒΊࠐ
    ΜͰCJOBSZͰಈ͘πʔϧΛ࡞Ζ͏

    View full-size slide