* Replace deprecated repvec reference in twitter-filter

This commit is contained in:
Matthew Honnibal 2015-11-03 03:21:26 +11:00
parent f56209ef2e
commit 36517516ef

View File

@ -80,10 +80,10 @@ include ./meta.jade
| |
| def match_tweet(spacy, text, query): | def match_tweet(spacy, text, query):
| def get_vector(word): | def get_vector(word):
| return spacy.vocab[word].repvec | return spacy.vocab[word].vector
| |
| tweet = spacy(text) | tweet = spacy(text)
| tweet = [w.repvec for w in tweet if w.is_alpha and w.lower_ != query] | tweet = [w.vector for w in tweet if w.is_alpha and w.lower_ != query]
| if tweet: | if tweet:
| accept = map(get_vector, 'Jeb Cheney Republican 9/11h'.split()) | accept = map(get_vector, 'Jeb Cheney Republican 9/11h'.split())
| reject = map(get_vector, 'garden Reggie hairy'.split()) | reject = map(get_vector, 'garden Reggie hairy'.split())
@ -147,11 +147,11 @@ include ./meta.jade
pre.language-python: code pre.language-python: code
| def handle_tweet(spacy, resp, query): | def handle_tweet(spacy, resp, query):
| def get_vector(word): | def get_vector(word):
| return spacy.vocab[word].repvec | return spacy.vocab[word].vector
| |
| text = resp.get('text', '').decode('utf8') | text = resp.get('text', '').decode('utf8')
| tweet = spacy(text) | tweet = spacy(text)
| tweet = [w.repvec for w in tweet if w.is_alpha and w.lower_ != query] | tweet = [w.vector for w in tweet if w.is_alpha and w.lower_ != query]
| if tweet: | if tweet:
| accept = map(get_vector, 'Jeb Cheney Republican 9/11h'.split()) | accept = map(get_vector, 'Jeb Cheney Republican 9/11h'.split())
| reject = map(get_vector, 'garden Reggie hairy'.split()) | reject = map(get_vector, 'garden Reggie hairy'.split())