Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
B3 コアタイム 第6回目 ( 2014年12月09日(火) )
Search
MIKAMI-YUKI
December 08, 2014
Education
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
B3 コアタイム 第6回目 ( 2014年12月09日(火) )
MIKAMI-YUKI
December 08, 2014
Transcript
19 slides
「入門 自然言語処理」 5章:単語の分類とタグ付け B3 三上侑城
もくじ •タガーの利用 •タグ付きコーパス •ディクショナリ(重要) •自動タグ付け •Nグラムタグ付け
タガーの利用 ・品詞タガー それぞれの単語に品詞のタグを付ける。 >>> text = nltk.word_tokenize(“And now for something
completely different") >>> nltk.pos_tag(text)
タガーの利用 ここで出てくる分類名の意味 詳細は以下のようにタグを指定する。 >>> nltk.help.upenn_tagset(’CC’) 分類名 意味 CC 等位接続詞 RB
副詞 IN 前置詞 NN 名詞 JJ 形容詞
タグ付きコーパス ・str2suple() タグ付きトークンに変換 >>> tagged_token = nltk.tag.str2tuple('fly/NN') >>> tagged_token >>>
tagged_token[0] >>> tagged_token[1]
タグ付きコーパス ・タグ付きコーパスを読み込む NLTKにはタグ付きのサンプルがある。 例 >>> nltk.corpus.brown.tagged_words() >>> nltk.corpus.nps_chat.tagged_words()
ディクショナリ(P204~) ・ディクショナリ型と呼ばれるデータ型 ・リストには整数の添字を使ってアクセス ・マップ、ハッシュ、ハッシュマップとも 呼ばれる
ディクショナリ >>> pos = {} >>> pos >>> pos['colorless'] =
'ADJ' >>> pos >>> pos['ideas'] = 'N' >>> pos['sleep'] = 'V' >>> pos['furiously'] = 'ADV' >>> pos
ディクショナリ ・キー指定で値を得る >>> pos['ideas'] >>>pos['colorless'] ・ないものはエラーが出る。 >>>pos['green']
ディクショナリ ・リストに変換 >>> list(pos) ・キーを整列させる >>> sorted(pos)
ディクショナリ ・最後にsがつくものを探す >>> [w for w in pos if w.endswith('s')]
・ディクショナリの中身を全て表示 >>> for word in sorted(pos): ... print word + ":", pos[word]
ディクショナリ ・キーの一覧メソッド >>> pos.keys() ・値の一覧メソッド >>> pos.values() ・ペアの一覧メソッド >>> pos.items()
ディクショナリ ・ディクショナリを定義 >>> pos = {'colorless':'ADJ','ideas':'N','sleep' :'V','furiously':'ADV'}
ディクショナリ ・デフォルトディクショナリ 存在しないものにアクセス 通常→エラー デフォルトディクショナリ→自動生成 nltk.defaultdict()を使用する
ディクショナリ ・デフォルトディクショナリ 整数型の場合 >>> freq1 = {} >>> freq1['colorless'] =
4 >>> freq1['ideas'] #エラーが出る >>> freq2 = nltk.defaultdict(int) >>> freq2['colorless'] = 4 >>> freq2[‘ideas’] #エラーは出ない
ディクショナリ ・デフォルトディクショナリ リスト型の場合 >>> pos1 = {} >>> pos1['sleep'] =
['N','V'] >>> pos1['ideas'] #エラーが出る >>> pos2 = nltk.defaultdict(list) >>> pos2['sleep'] = ['N','V'] >>> pos2[‘ideas’] #エラーは出ない
ディクショナリ ・デフォルトディクショナリ デフォルト値の設定 >>> pos = nltk.defaultdict(lambda:'N') >>> pos['colorless'] =
'ADJ' >>> pos['blog'] #Nが自動的に入る >>> pos.items()
自動タグ付け ・テキストに自動的に品詞タグを付け てくれる。 ・様々なタガーがあり、それぞれに 特徴がある。 ・必要となった時に参照してもらい たい(P214~)
Nグラムタグ付け ・文脈を考慮してタグを付けてくれる ・いくつかのタガーを組み合わせて 使い、精度を高められる。 ・必要となった時に参照してもらい たい(P219~)
More Decks by MIKAMI-YUKI
See All by MIKAMI-YUKI
2016年_年次大会_発表資料
mikamiy
0
140
文献紹介_10_意味的類似性と多義解消を用いた文書検索手法
mikamiy
0
360
文献紹介_9_コーパスに基づく動詞の多義解消
mikamiy
0
140
文献紹介_8_単語単位による日本語言語モデルの検討
mikamiy
0
110
文献紹介_7_自動獲得した未知語の読み・文脈情報による仮名漢字変換
mikamiy
0
130
文献紹介_6_複数の言語的特徴を用いた日本語述部の同義判定
mikamiy
0
120
文献紹介_5_マイクロブログにおける感情・コミュニケーション・動作タイプの推定に基づく顔文字の推薦
mikamiy
0
170
文献紹介_4_結合価パターンを用いた仮名漢字変換候補の選択
mikamiy
0
420
文献紹介_3_絵本のテキストを対象とした形態素解析
mikamiy
1
430
Other Decks in Education
See All in Education
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Five: Open Movements & Author Rights"
baltimoreniso
0
240
[2026後期火5] 論理学(京都大学文学部 後期 第4回)「∃ の規則と存在具体性」
yatabe
0
150
Unit 3: Computing Paradigms
sonakv
0
160
Semantic Web and Web 3.0 - Lecture 9 - Web Technologies (1019888BNR)
signer
PRO
2
3.6k
[2026後期火5] 論理学(京都大学文学部 後期 第2回)「量化子の導入」
yatabe
0
290
HTML5 and the Open Web Platform - Lecture 3 - Web Technologies (1019888BNR)
signer
PRO
3
3.6k
Session 7 - Teknik Lobby dan Negosiasi
adeputra13
0
300
Evaluation Methods - Lecture 6 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.7k
Unit 4: Corporate Restructuring
bvr7352
0
140
LP2627
cbtlibrary
0
220
2026年度秋学期 統計学 第4回 データを「分布」で見る (2026. 10. 20)
akiraasano
PRO
0
220
North Carolina Task Force on Child Care and Early Education
rashwhitman
0
1.6k
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
What's in a price? How to price your products and services
michaelherold
247
13k
Accessibility Awareness
sabderemane
1
320
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Evolving SEO for Evolving Search Engines
ryanjones
0
380
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.9k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
2
4k
Test your architecture with Archunit
thirion
2
2.5k