{"published":"2006-05-09 07:02:21","provider_url":"https://hatena.blog","blog_title":"\u8da3\u5473\u7684\u306b\u3063\u304d","version":"1.0","author_name":"ha-tan","description":"Hash\u30c6\u30fc\u30d6\u30eb\u3092\u4f7f\u3063\u3066\u30d5\u30a1\u30a4\u30eb\u306b\u542b\u307e\u308c\u308b\u5358\u8a9e\u306e\u51fa\u73fe\u983b\u5ea6\u3092\u6570\u3048\u3066\u307f\u307e\u3059\u3002 \u4eca\u307e\u3067\u306f\u3053\u3093\u306a\u98a8\u306b\u66f8\u3044\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001 class Hash def increment_counter(key) self[key] ||= 0 self[key] += 1 end end table = {} # word => count ARGF.read.scan(/\\w+/).each do |word| table.increment_counter(word) endRuby\u3067\u306fHash\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u3061\u3089\u306e\u65b9\u304c\u52b9\u7387\u7684\u3067\u3059\u3002 table = Ha\u2026","provider_name":"Hatena Blog","blog_url":"https://ha-tan.hatenadiary.org/","author_url":"https://blog.hatena.ne.jp/ha-tan/","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fha-tan.hatenadiary.org%2Fentry%2F20060509%2F1147125741\" title=\" Hash\u30c6\u30fc\u30d6\u30eb\u3067\u5358\u8a9e\u306e\u51fa\u73fe\u983b\u5ea6\u3092\u6570\u3048\u308b - \u8da3\u5473\u7684\u306b\u3063\u304d\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","type":"rich","url":"https://ha-tan.hatenadiary.org/entry/20060509/1147125741","height":"190","image_url":null,"title":" Hash\u30c6\u30fc\u30d6\u30eb\u3067\u5358\u8a9e\u306e\u51fa\u73fe\u983b\u5ea6\u3092\u6570\u3048\u308b","categories":["Ruby"]}