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
B3 コアタイム 第2回目 ( 2014年11月25日(火) )
Search
yoshii25
November 25, 2014
Education
0
66
B3 コアタイム 第2回目 ( 2014年11月25日(火) )
yoshii25
November 25, 2014
Tweet
Share
More Decks by yoshii25
See All by yoshii25
文献紹介 (05/13/2016)
yoshii25
0
92
文献紹介 ( 02/18/2016 )
yoshii25
0
180
文献紹介 ( 2015年7月8日(水) )
yoshii25
0
170
文献紹介 ( 2015年6月10日(水) )
yoshii25
0
180
文献紹介 ( 2015年5月12日(火) )
yoshii25
0
180
文献紹介 ( 2015年4月1日(水) )
yoshii25
0
210
B3 勉強会 第12回目 ( 2015年3月26日(木) )
yoshii25
0
180
B3 勉強会 第10回目 ( 2015年3月13日(金) )
yoshii25
0
170
B3 勉強会 第8回目 ( 2015年2月20日(金) )
yoshii25
0
200
Other Decks in Education
See All in Education
保育とふりかえりをコネクト! / connect childcare and retrospectives!
psj59129
1
150
インターアクトクラブについて:国際ロータリー第2720地区インターアクト委員会 委員長・大分東ロータリークラブ 阿部 克哉 氏
2720japanoke
0
670
Multimodal Interaction - Lecture 3 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
1.1k
20240319AJG
tosseto
0
300
情報Iの「縦糸」と「横糸」を意識したプログラム教育の実践
asial_edu
0
200
【滋賀大学データサイエンス学部】PropTech(不動産テック)における AI・データサイエンス活用
takehikohashimoto
0
4.1k
Railsチュートリアルの歩き方 (第7版)
yasslab
PRO
1
1M
Virtual and Augmented Reality - Lecture 8 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
1.2k
合理的配慮を知るワークショップ/Understanding Reasonable Accommodations (Workshop)
freee
1
1.4k
Sähköiset kyselyt, kokeet ja arviointi
matleenalaakso
1
16k
Project Sprint 学生版(入門編)
copilot
PRO
0
180
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4019538FNR)
signer
PRO
0
1.7k
Featured
See All Featured
Bash Introduction
62gerente
604
210k
RailsConf 2023
tenderlove
4
540
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Building Applications with DynamoDB
mza
88
5.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
2
3.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Practical Orchestrator
shlominoach
182
9.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
Transcript
B3ίΞλΠϜ (201411݄25(Ր)) ʰೖ ࣗવݴޠॲཧʱ ɹɹ1ষ ݴޠॲཧͱPython Ԭٕज़Պֶେֶ ࣗવݴޠॲཧݚڀࣨ B3 ழມ
ܚथ
ςʔϚ
ςʔϚ ❖ PythonͷπʔϧͱςΫχοΫ ❖ NLTKͷ༻ํ๏ ❖ ؆୯ͳ౷ܭॲཧ
Python
Python ❖ Pythonͷར ❖ ߏจҙຯͷཧղ͕ฏқ ❖ จࣈྻΛऔΓѻ͏͕ؔ๛ ❖ Pythonͷಛ ❖
มͷܕͷએݴ͕ෆཁ ❖ ߏจʹΠϯσϯτΛ༻͢Δ https://www.python.org/community/logos/
NLTK
NLTK ❖ ࢺͷλά͚, ߏจղੳ, ςΩε τͷྨͱ͍ͬͨॲཧΛߦ͏Πϯ λʔϑΣΠε ❖ ෳࡶͳΛղͨ͘ΊʹΈ߹Θ ͤΔ͜ͱ͕Ͱ͖Δ࣮
Natural Language Toolkit
༻͢Δલʹ ❖ NLTKͷΠϯϙʔτ ❖ >>> import nltk ❖ ςΩετͷΠϯϙʔτ ❖
>>> from nltk.book import *
NLTKͷػೳ ❖ ςΩετͷݕࡧ ❖ >>> text.concordance(“hoge1”) ❖ >>> text.concordance([“hoge1”, “hoge2”])
❖ ୯ޠΛ͑Δ ❖ >>> text.count(“hoge”)
NLTKͷػೳ ❖ ޠኮΛ͑Δ ❖ >>> len(text) ❖ ޠኮͷऔಘ ❖ >>>
set(text) ❖ ޠኮͷιʔτ ❖ >>> sorted(set(text))
NLTKͷػೳ ❖ ؔͷఆٛ ❖ ྫ) ςΩετͷޠኮͷ๛͞ ❖ >>> def function(text)
: ❖ . . . return len(text) / len(set(text))
Python ͖ͭͮ
Pythonͷػೳ ❖ Ϧετ ❖ ςΩετͳͲΛऩೲ͢ΔྻͷΑ͏ͳͷ. ❖ >>> sent[“hoge1”, “hoge2”, “hoge3”,
“hoge4”]
Ϧετ ❖ Ϧετͷ࿈݁ ❖ >>> sent1[“hoge1”, “hoge2”] + sent2[“hoge3”, “hoge4”]
❖ ϦετͷՃ ❖ >>> sent.append(“hoge”) ❖ εϥΠγϯά ❖ >>> sent[5 : 8]
Pythonͷػೳ ❖ จࣈྻ ❖ Ճࢉ, ࢉͳͲՄೳ. ࿈݁, ׂͷػೳΛ࣋ͭ. ❖ name
= ‘Hoge’
จࣈྻ ❖ จࣈྻͷ࿈݁ ❖ >>> ‘ ‘ .join([‘Hoge1’, ‘Hoge2’]) ❖
จࣈྻͷׂ ❖ >>> ‘Hoge1 Hoge2’.split()
Pythonͷػೳ ❖ ݅ࣜ ❖ ༻๏Cݴޠͱ΄΅ಉ༷. ൣғΛΠϯσϯτͰஅ. ❖ >>> if len(word)
< 5 ❖ . . . print ‘word length is less then 5’
݅ࣜ ❖ ୯ޠൺֱʹ͑Δԋࢉࢠ ❖ s.startswitch(t) s ͕ t Ͱ࢝·Δ͔Ͳ͏͔ ❖
s.endswitch(t) s ͕ t ͰऴΘΔ͔Ͳ͏͔ ❖ t in sɹɹɹɹɹ s ͷதʹ t ؚ͕·ΕΔ͔Ͳ͏͔ ❖ s.islower() s ͷதʹେจࣈؚ͕·Ε͍ͯͳ͍ ❖ s.isupper() s ͷதʹࢠจࣈؚ͕·Ε͍ͯͳ͍ ❖ s.isalpha() s ͷதͷจࣈ͕શͯΞϧϑΝϕοτ͔Ͳ͏͔ ❖ s.isalnum() s ͷதͷจࣈ͕શͯΞϧϑΝϕοτ͘͠ࣈ͔Ͳ͏͔
݅ࣜ ❖ ୯ޠൺֱʹ͑Δԋࢉࢠ ͖ͭͮ ❖ s.isdigit() s ͷதͷจࣈ͕શͯࣈ͔Ͳ͏͔ ❖ s.istitle()
s ͕λΠτϧέʔε͔Ͳ͏͔
Pythonͷػೳ ❖ ݅ذ ❖ ༻๏Cݴޠͱ΄΅ಉ༷. ಉ͘͡ൣғΛΠϯσϯτͰஅ. ❖ >>> for i
in range(10) ❖ . . . print i
؆୯ͳ౷ܭॲཧ
؆୯ͳ౷ܭॲཧ ❖ සग़͢Δ୯ޠΛऔΓग़͢ ❖ >>> fdist1 = FreqDist(text) ❖ ςΩετதͷҟͳΓޠΛऔΓग़͢
❖ >>> vocaburaly1 = fdist1.keys()
؆୯ͳ౷ܭॲཧ ❖ ςΩετͷ༰Λද͢୯ޠΛऔΓग़͍ͨ͠. ❖ → औΓग़ͨ͠୯ޠ͔ΒςΩετͷ༰͕ཧղͰ͖Δʂ
؆୯ͳ౷ܭॲཧ ❖ ‘,’ ‘the’, ‘.’, ‘and’ͳͲจࣈ͕͍୯ޠ͕සग़͢ΔͳΒ, 1ճ͠ ͔ొ͠ͳ͍୯ޠΛ୳ͤΑ͍ͷͰʁ ❖
15จࣈҎ্ͷ୯ޠΛऔΓग़͢ ❖ >>> V = set(text1) ❖ . . . long_words = [w for w in V if len(w) > 15]
؆୯ͳ౷ܭॲཧ ❖ 1ճ͔͠ొ͠ͳ͍୯ޠ,จ຺͔Βཧղ͠ͳ͚ΕͳΒͳ͍୯ޠ͕ ଟ͘, ςΩετͷ༰ཧղͰ͖ͳ͍. ❖ 7จࣈҎ্, 7ճҎ্ొͨ͠୯ޠΛऔΓग़͢ ❖ >>>
fdist5 = FreqDist(text5) ❖ >>> sorted([w for w in set(text5) if len > 7 and fdist5[w] > 7])