Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
懐かしきCaboChaのレシピをもう一度
Search
log5
September 12, 2024
0
45
懐かしきCaboChaのレシピをもう一度
at
https://tw-meetup.connpass.com/event/330008/
log5
September 12, 2024
Tweet
Share
More Decks by log5
See All by log5
App Clipの魔法: iOSデザイン開発の新時代
judau
3
6.2k
AppCodeのサ終から半年後
judau
1
180
"Meet Swift Testing" & "Go further with Swift Testing" in 5 min
judau
0
210
Aquaの波紋によせて
judau
0
120
iOSは自動作曲の夢を見るか
judau
0
1.3k
What's New in App Clips after WWDC23
judau
1
120
「そういえば何でテストエンジニアやめたん?」〜5年前の振り返りなの
judau
0
160
App Clips はどこから来たのか&何者か&どこへ行くのか
judau
1
950
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
31
1.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
249
21k
Optimizing for Happiness
mojombo
375
69k
Code Reviewing Like a Champion
maltzj
519
39k
How To Stay Up To Date on Web Technology
chriscoyier
787
250k
How to name files
jennybc
77
99k
The Cost Of JavaScript in 2023
addyosmani
43
5.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
Become a Pro
speakerdeck
PRO
24
4.9k
Mobile First: as difficult as doing things right
swwweet
222
8.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.1k
Transcript
ջ͔͖͠CaboChaͷϨγϐΛ͏Ұ Pr es ented by log5
About “log 5 ” ͨͿΜιϑτΣΞΤϯδχΞ ొஃͱ͔ࠪಡͱ͔࡞ۂ͠·͢ ը૾X(ID: log 5 )ͷΞΠίϯ
͓ॻ͖ CaboChaͱʁ Πϯετʔϧͯ͠ΈΑ͏ ͬͯΈΑ͏ ׆༻ͯ͠ΈΑ͏
CaboChaͱʁ ຊޠΓड͚ղੳث จষͷΓड͚ߏΛੳͯ͘͠ΕΔ Ͳͷ୯ޠ͕Ͳͷ୯ޠʹ͍ͬͯΔ͔͕Θ͔Δ
“ଠՖࢠ͕ಡΜͰ͍ΔຊΛ ࣍ʹͨ͠”
None
ͱ͜ΖͰɺΈͳ͞Μ ৗͰ͜ΜͳจষΛॻ͍ͯ͠·ͬͨ͜ͱɺͳ͍Ͱ͔͢ʁ
“ࢲܑͱΛܴ͑ʹۭߓʹ͔ͬͨɻ”
“ࢲܑͱΛܴ͑ʹۭߓʹ͔ͬͨɻ” ʮࢲܑͱʯΛܴ͑ʹۭߓʹ͔ͬͨʁ ࢲʮܑͱΛʯܴ͑ʹۭߓʹ͔ͬͨʁ
None
CaboChaͱʁ ຊޠΓड͚ղੳث จষͷΓड͚ߏΛੳͯ͘͠ΕΔ Ͳͷ୯ޠ͕Ͳͷ୯ޠʹ͍ͬͯΔ͔͕Θ͔Δ ޡղ͕ੜ·ΕΔ༨Λݕग़Ͱ͖Δ…͔͠Εͳ͍ Cabochaࣗମʹᐆດੑݕग़ͷػೳͳ͍͕ɺͦͷ͕͔ΓʹͳΔ
CaboChaͱʁ Cabochaࣗମʹᐆດੑݕग़ͷػೳͳ͍͕ɺͦͷ͕͔ΓʹͳΔ ࠷ऴతʹ͜͏͍͏άϥϑΛ࡞ΕΔͱ͍͏͕͏͍͢͝
Πϯετʔϧͯ͠ΈΑ͏ ެࣜαΠτΛಡ͏(ಛʹWindowsڥͷํ) https: // taku910.github.io/cabocha/ ࣄલʹ CRF ++ ͱ MeCab
ΛΠϯετʔϧ͢Δ Chasen Ͱಈ࡞͠·ͤΜ macOSͳΒ brew install cabocha ͰҰൃ
※͔͜͜ΒઌmacOSΛϕʔεʹઆ໌͕ਐΈ·͕͢ɺ ଞͷOSͰ֓Ͷಉ͡Α͏ʹૢ࡞Ͱ͖Δͱࢥ͍·͢
ͬͯΈΑ͏ ࢼ͠ʹ͏ͳΒλʔϛφϧ͔Βར༻Մೳ λʔϛφϧͰ cabocha ͱೖྗ͢Δͱىಈ จষೖྗػঢ়ଶʹͳΔͷͰɺ͖ͳจষΛೖྗ͢Δ
None
“ࢲܑͱΛܴ͑ʹۭߓʹ͔ͬͨɻ”
None
None
None
“͕ւ֎ग़ுͰखʹೖΕͨ࣌ܭΛɺ ͕ݟͨΛؾʹೖΓɺࢲʹৡͬͯ͘Εͨɻ”
None
None
None
“͕ҎલۙॴͷΧϑΣͰΓ߹ͬͨళओ͕։࠵͍ͯͨ͠Ξʔτ లͰߪೖͨ͠ֆը͕ɺࢲ͕ඒज़ؗͰݟͨ͜ͱ͕͋ΔըՈͷ࡞ ͩͬͨͱޙ͔ΒΓɺ࡞ूΛਤॻؗͰआΓ͖ͯͯ༑ਓʹקΊ Α͏ͱҰߟ͑ͨͷͷɺ͢Ͱʹ༑ਓ͕ಉ͡ըՈʹ͍ͭͯݚڀ ͍ͯͨ͜͠ͱΛࠓͬͨɻ”
None
None
None
ͬͯΈΑ͏ ࢼ͠ʹ͏ͳΒλʔϛφϧ͔Βར༻Մೳ λʔϛφϧͰ cabocha ͱೖྗ͢Δͱىಈ จষೖྗػঢ়ଶʹͳΔͷͰɺ͖ͳจষΛೖྗ͢Δ Ҿͱͯ͠ -f1 Λࢦఆ͢Δͱɺৄࡉใ͕ಘΒΕΔ
None
None
None
None
None
None
͜ͷग़ྗΛͦͷ··ղ͍͍ͯ͠Ͱ͕͢…໘ ϓϩάϥϛϯάݴޠͰαοͱ͍͍ͨ Python༻ͷWrapper: cabocha-python ΛͬͯΈΑ͏ ଞͷݴޠΑΓಋೖɾֶशίετͦ͏ʢθϩͰͳ͍ʣ ωοτ্ʹؔ࿈هࣄଟ͍ҹ
“cabocha-python” Python Ͱ CaboCha ͕ར༻Ͱ͖Δ ίϚϯυͷग़ྗΛղ͢ΔͨΊͷॲཧΛࣗͰॻ͔ͣʹࡁΉ Γ݁ͼͷؔΛൺֱతָʹऔΓग़ͤΔ ॳ৺ऀτϥοϓ͋Γ
“cabocha-python” ΛΠϯετʔϧ ॳ৺ऀτϥοϓ͋Γ جຊతʹ pip install ͰΠϯετʔϧ͢Δ͜ͱʹͳΔ͕…
None
None
“cabocha-python” ΛΠϯετʔϧ ॳ৺ऀτϥοϓ͋Γ جຊతʹ pip install ͰΠϯετʔϧ͢Δ͜ͱʹͳΔ͕… 2024 ݱࡏɺͨΒʑ͍͠Τϥʔ͕ग़Δ
“cabocha-python” ΛΠϯετʔϧ ॳ৺ऀτϥοϓ͋Γ ֤छPathใΛڭ͑ͯ͋͛Δͱղܾ͢Δ…߹͕͋Δ
“cabocha-python” ΛͬͯΈΑ͏ Πϯετʔϧ͕ऴΘΕɺ͋ͱ͏͚ͩʂ ͳΜͰ͕͢…
“cabocha-python” ΛͬͯΈΑ͏ Πϯετʔϧ͕ऴΘΕɺ͋ͱ͏͚ͩʂ macOSͷ߹ɺApple Silicon Λࡌ͍ͯ͠Δͱߋʹ᠘͕
“cabocha-python” ΛͬͯΈΑ͏ Πϯετʔϧ͕ऴΘΕɺ͋ͱ͏͚ͩʂ macOSͷ߹ɺApple Silicon Λࡌ͍ͯ͠Δͱߋʹ᠘͕ ↓ͷίʔυ͕࣮ߦ࣌ΤϥʔʹͳΓ·͢
࣮ߦ࣌Τϥʔ (Symbol not found) ੩తղੳͰΤϥʔ͕ग़ͳ͍ͷͰɺૺ۰͢Δͱμϝʔδ͕େ͖͍… ଟɺΠϯετʔϧ࣌ʹམͱ͖ͯͨ͠ϑΝΠϧ͕ Apple Silicon ͱ͕ѱ͍ͷ͕ݪҼ
࣮ߦ࣌Τϥʔ (Symbol not found) ੩తղੳͰΤϥʔ͕ग़ͳ͍ͷͰɺૺ۰͢Δͱμϝʔδ͕େ͖͍… ଟɺΠϯετʔϧ࣌ʹམͱ͖ͯͨ͠ϑΝΠϧ͕ Apple Silicon ͱ͕ѱ͍ͷ͕ݪҼ ιʔείʔυ͔ΒϏϧυ͢Εղܾ͢Δ…߹͕͋Γ·͢
↓ͷΑ͏ͳखॱͰ࠶Πϯετʔϧ
࠷ॳʹ cabocha Λ࠶Πϯετʔϧ ͨͩ͠ɺιʔείʔυ͔ΒϏϧυ͢Δ ͦͷͨΊ -s (·ͨ -- build-from-source) Λࢦఆ͢Δ
࠷ॳʹ cabocha Λ࠶Πϯετʔϧ ͳͲͱ͍͏ͪΐͬͱා͍͜ͱݴΘΕ·͕͢ɺແࢹɻʢଞʹํ๏ͳ͍Μ…ʣ Warning: building from source is not
supported! You're on your own. Failures are expected so don't create any issues, please!
࠷ॳʹ cabocha Λ࠶Πϯετʔϧ ࣍ʹ cabocha-python Λ࠶Πϯετʔϧ Apple Silicon Mac ʹద߹͢ΔͨΊ
ARCHFLAGS='-arch arm64’ ιʔείʔυ͔ΒόΠφϦΛίϯύΠϧ͢ΔͷͰ -- compile Λ͚ͭΔ
“cabocha-python” ΛͬͯΈΑ͏ ৭ʑ͚͋ͬͨͲɺΠϯετʔϧ͕ऴΘΕɺ͋ͱ͏͚ͩʂ import CaboCha
“cabocha-python” ΛͬͯΈΑ͏ ParserΛ࡞Γɺղ͢Δ import CaboCha cabocha_parser = CaboCha.Parser() # ղੳثΛ࡞Δ
results = cabocha_parser.parse("͜͜ʹ͖ͳจষ") # ղੳ͢Δ
“cabocha-python” ΛͬͯΈΑ͏ ParserΛ࡞Γɺղ͢Δ ͨͩ͠ɺੳ݁Ռ(͜͜Ͱ results)গ͠ѻ͍ͮΒ͍ import CaboCha cabocha_parser = CaboCha.Parser()
# ղੳثΛ࡞Δ results = cabocha_parser.parse("͜͜ʹ͖ͳจষ") # ղੳ͢Δ
“cabocha-python” ΛͬͯΈΑ͏ ParserΛ࡞Γɺղ͢Δ ͨͩ͠ɺੳ݁Ռ(͜͜Ͱ results)গ͠ѻ͍ͮΒ͍ [ৄ͍͠ਓ͚] Swig ObjectͳͷͰIDEͷิ͕͖͔ͳ͍ import CaboCha
cabocha_parser = CaboCha.Parser() # ղੳثΛ࡞Δ results = cabocha_parser.parse("͜͜ʹ͖ͳจষ") # ղੳ͢Δ
“cabocha-python” ΛͬͯΈΑ͏ [ৄ͍͠ਓ͚] Swig ObjectͳͷͰIDEͷิ͕͖͔ͳ͍ C++ଆͷϔομΛݟʹߦ͔ͳ͍ͱԿ͕͑Δͷ͔Θ͔Βͳ͍
“cabocha-python” ΛͬͯΈΑ͏ ParserΛ࡞Γɺղ͢Δ ͨͩ͠ɺੳ݁Ռ(͜͜Ͱ results)গ͠ѻ͍ͮΒ͍ ʮ͜ͷΑ͏ʹॻ͘ͷͩʯͱ͍͏આ໌͕ͦͧϜζ͍ import CaboCha cabocha_parser =
CaboCha.Parser() # ղੳثΛ࡞Δ results = cabocha_parser.parse("͜͜ʹ͖ͳจষ") # ղੳ͢Δ ԿΛॻ͚͍͍ʁʁʁʁʁʁʁʁʁʁʁʁ
“cabocha-python” ΛͬͯΈΑ͏ ParserΛ࡞Γɺղ͢Δ ͨͩ͠ɺੳ݁Ռ(͜͜Ͱ results)গ͠ѻ͍ͮΒ͍ ʮ͜ͷΑ͏ʹॻ͘ͷͩʯͱ͍͏આ໌͕ͦͧϜζ͍ ͜ͷྲྀΕͰ͍͖ͳΓC++Ӡʑͷઆ໌Λԡ͚͠Δͷແཧ͕͋Ζ͏͔ͱ
શ෦טΈࡅ͍ͯઆ໌͢Δ࣌ؒͳ͍ͷͰ…
ௐཧࡁΈͷͷΛ༻ҙ͠·ͨ͠ https: // github.com/log5r/sample-mecabocha
ௐཧࡁΈͷͷΛ༻ҙ͠·ͨ͠ https: // github.com/log5r/sample-mecabocha main.pyΛ࣮ߦͯ͠ɺจষΛ͍ΕΔ͚ͩ άϥϑ͕ ./out/graph/ ʹग़དྷ·͢
None
None
ௐཧࡁΈͷͷΛ༻ҙ͠·ͨ͠ https: // github.com/log5r/sample-mecabocha ΑΖ͚͠Εࢼͯ͠Έ͍ͯͩ͘͞
ௐཧࡁΈͷͷΛ༻ҙ͠·ͨ͠ https: // github.com/log5r/sample-mecabocha ΑΖ͚͠Εࢼͯ͠Έ͍ͯͩ͘͞ ϒϨʔΫϙΠϯτషͬͯ؍͢ΔΑ͠
·ͩ·ͩਚ͖ͳ͍CaboChaͷັྗ ຊհͰ͖ͳ͔ͬͨͷ ղੳϨΠϠͷ ݻ༗දݱղੳ σʔλʹΑΔֶश ͳͲͳͲ
·ͩ·ͩਚ͖ͳ͍cabochaͷັྗ ຊհͰ͖ͳ͔ͬͨͷ ղੳϨΠϠͷ ݻ༗දݱղੳ σʔλʹΑΔֶश ͳͲͳͲ ͥͻެࣜαΠτͰʂ https: // taku910.github.io/cabocha/
৯ޙͷײ(ؾʹͳΔ)
CaboChaͷཪଆ Support Vector Machines ʹجͮ͘ຊޠΓड͚ղੳث Support Vector Machines ػցֶशΞϧΰϦζϜͷҰͭ ຊޠͷจʹ͓͚Δ୯ޠಉ࢜ͷΓड͚ؔΛྨɾ༧ଌ
CaboChaͷཪଆ ຊޠͷจʹ͓͚Δ୯ޠಉ࢜ͷΓड͚ؔΛྨɾ༧ଌ ژେֶςΩετίʔύε 4 . 0 Λ༻ֶ͍ͯश
CaboChaͷཪଆ ژେֶςΩετίʔύε 4 . 0 ຖ৽ฉͷهࣄʹ֤छݴޠใΛਓखͰ༩ 1995 1 ݄
1 ͔Β 17 ·Ͱͷશهࣄɺ 2 ສจɺ 1 ݄͔Β 12 ݄ ·Ͱͷࣾઆهࣄɺ 2 ສจɺܭ 4 ສจʹରͯ͠ɺܗଶૉɾߏจ ใΛ༩
CaboChaͷཪଆ ຊޠͷจʹ͓͚Δ୯ޠಉ࢜ͷΓड͚ؔΛྨɾ༧ଌ ژେֶςΩετίʔύε 4 . 0 Λ༻ֶ͍ͯश ιʔε: “ 1995
1 ݄ 1 ͔Β 17 ·Ͱͷશهࣄ”
ؾʹͳΔ͜ͱ ޠኮྗ େৎʁ
ؾʹͳΔ͜ͱ ޠኮྗ ͱͱݹ͍πʔϧͳͷͰɺ৽ޠͷղੳ͕ෆ҆ఆͳ͜ͱ…?
“ྩ̒ʹೣϛʔϜ͕όζͬͨ͜ͱ͕͋Δɻ”
None
None
None
ؾʹͳΔ͜ͱ ޠኮྗ ͦͦݹ͍πʔϧͳͷͰɺ৽ޠͷղੳ͕ෆ҆ఆͳ͜ͱ…? ͦ͏͍͑ɺCaboChaMeCabʹґଘ
MeCabͷޠኮྗ దͳࣙॻΛબͿͱޠኮྗ্͕͕Δ༷ JumanDic IPADic NAIST-jdic UniDic Neologd
MeCabͷޠኮྗ దͳࣙॻΛબͿͱޠኮྗ্͕͕Δ༷ JumanDic IPADic NAIST-jdic UniDic ←།Ұϝϯςφϯε͞ΕͯΔͬΆ͍ (2023൛͕͋Δ) Neologd
ؾʹͳΔ͜ͱ MeCabͷࣙॻΛڧԽ͢ΕɺCaboChaͷੳਫ਼্͕Δʁ Θ͔Βͳ͍ CaboChaࣗମ܇࿅ࡁΈͷϞσϧʹґଘ͢Δͣ ͨͱ͑ɺMeCabͰ৽͍ࣙ͠ॻΛ༻ͯ͠ɺCaboChaଆͰܴ߹͢Δ Α͏ʹ࠶܇࿅͢ΔͳΒΞϦ…? ৄ͍͠ํͷҙݟΛืूதͰ͢
·ͱΊ CaboChaʢ 2024 Ͱʣ͍͍ͧ ҰΠϯετʔϧ͢Εා͘ͳ͍ Γड͚ղੳ࣮༻తָ͍ͩ͠͠
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ ຊհͰ͖ͳ͔ͬͨͷ ղੳϨΠϠͷ ݻ༗දݱղੳ σʔλʹΑΔֶश ͳͲͳͲ ͥͻެࣜαΠτͰʂ https: // taku910.github.io/cabocha/