{"action":"closed","issue":{"url":"https://api.github.com/repos/honnibal/spaCy/issues/123","labels_url":"https://api.github.com/repos/honnibal/spaCy/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/honnibal/spaCy/issues/123/comments","events_url":"https://api.github.com/repos/honnibal/spaCy/issues/123/events","html_url":"https://github.com/honnibal/spaCy/issues/123","id":109520847,"number":123,"title":"Example missing _handler","user":{"login":"Zintinio","id":648208,"avatar_url":"https://avatars.githubusercontent.com/u/648208?v=3","gravatar_id":"","url":"https://api.github.com/users/Zintinio","html_url":"https://github.com/Zintinio","followers_url":"https://api.github.com/users/Zintinio/followers","following_url":"https://api.github.com/users/Zintinio/following{/other_user}","gists_url":"https://api.github.com/users/Zintinio/gists{/gist_id}","starred_url":"https://api.github.com/users/Zintinio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zintinio/subscriptions","organizations_url":"https://api.github.com/users/Zintinio/orgs","repos_url":"https://api.github.com/users/Zintinio/repos","events_url":"https://api.github.com/users/Zintinio/events{/privacy}","received_events_url":"https://api.github.com/users/Zintinio/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-02T16:01:14Z","updated_at":"2015-10-14T15:45:21Z","closed_at":"2015-10-14T15:45:21Z","body":"The tutorial I found via google includes _handler.py, but the example code in ```examples/``` does not. The twitter_filter script depends on it.\r\n\r\n```py\r\nfrom __future__ import unicode_literals, print_function\r\n \r\nfrom math import sqrt\r\nfrom numpy import dot\r\nfrom numpy.linalg import norm\r\n \r\n \r\ndef handle_tweet(spacy, tweet_data, query):\r\n    text = tweet_data.get('text', '')\r\n    match_tweet(spacy, text.decode('utf8'), query)\r\n \r\n \r\ndef match_tweet(spacy, text, query):\r\n    def get_vector(word):\r\n        return spacy.vocab[word].repvec\r\n \r\n    tweet = spacy(text)\r\n    tweet = [w.repvec for w in tweet if w.is_alpha and w.lower_ != query]\r\n    if tweet:\r\n        accept = map(get_vector, 'Jeb Cheney Republican 9/11h'.split())\r\n        reject = map(get_vector, 'garden Reggie hairy'.split())\r\n        y = sum(max(cos(w1, w2), 0) for w1 in tweet for w2 in accept)\r\n        n = sum(max(cos(w1, w2), 0) for w1 in tweet for w2 in reject)\r\n        \r\n        if (y / (y + n)) >= 0.5 or True:\r\n            print(text)\r\n \r\n \r\ndef cos(v1, v2):\r\n    return dot(v1, v2) / (norm(v1) * norm(v2))\r\n```"}}