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

Introduction fasttext

Avatar for ckazu ckazu
July 06, 2017

Introduction fasttext

Avatar for ckazu

ckazu

July 06, 2017
Tweet

More Decks by ckazu

Other Decks in Technology

Transcript

  1. 事前準備 https://github.com/facebookresearch/fastText python3, numpy, scipy, cython が使えること => b r

    i e / d o c k e r ‐ n u m p y ‐ s c i p y とか使うのが楽 利用するテキスト( 日本語だったら分かち書きしてあること) ※ 分かち書きされた文書の準備 m e c a b ‐ O w a k a t i h o g e . t x t > h o g e . w a k a t i . t x t
  2. 使い方 $ ( p i p i n s t

    a l l c y t h o n ) $ ( p i p i n s t a l l f a s t t e x t ) $ p i p i n s t a l l g e n s i m i m p o r t g e n s i m f r o m g e n s i m . m o d e l s i m p o r t w o r d 2 v e c s e n t e n c e s = w o r d 2 v e c . T e x t 8 C o r p u s ( ' h o g e f u g a . w a k a t i . t x t ' ) m o d e l = w o r d 2 v e c . W o r d 2 V e c ( s e n t e n c e s , s i z e = 2 0 0 , w i n d o w = 5 , w o r k e r s = m o d e l . m o s t _ s i m i l a r ( p o s i t i v e = [ ' ほげー' , ' ふがー' ] , n e g a t i v e = [ ' ばず'