自然言語処理でお馴染みの作業.
Pythonではもっと簡単らしい
words = ['apple', 'banana', 'cat']
Hash[words.each_with_index.map{|e, i|[e, i]}]
#=> {"apple"=>0, "banana"=>1, "cat"=>2}
Go to list of users who liked
More than 5 years have passed since last update.
自然言語処理でお馴染みの作業.
Pythonではもっと簡単らしい
words = ['apple', 'banana', 'cat']
Hash[words.each_with_index.map{|e, i|[e, i]}]
#=> {"apple"=>0, "banana"=>1, "cat"=>2}
Register as a new user and use Qiita more conveniently
Go to list of users who liked