From ab5aac5b2fe4319ed76806ee6190d01bd5f2ffe6 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 8 Nov 2015 16:18:25 +0100 Subject: [PATCH] * Add .rank property to Token and Lexeme, for frequency rank --- spacy/lexeme.pyx | 4 ++++ spacy/tokens/token.pyx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/spacy/lexeme.pyx b/spacy/lexeme.pyx index 048fae1df..845b29314 100644 --- a/spacy/lexeme.pyx +++ b/spacy/lexeme.pyx @@ -83,6 +83,10 @@ cdef class Lexeme: for i, value in enumerate(vector): self.c.vector[i] = value + property rank: + def __get__(self): + return self.c.id + property repvec: def __get__(self): return self.vector diff --git a/spacy/tokens/token.pyx b/spacy/tokens/token.pyx index 3a76bf220..daf1044ba 100644 --- a/spacy/tokens/token.pyx +++ b/spacy/tokens/token.pyx @@ -67,6 +67,10 @@ cdef class Token: def __get__(self): return self.c.lex.id + property rank: + def __get__(self): + return self.c.lex.id + property string: def __get__(self): cdef unicode orth = self.vocab.strings[self.c.lex.orth]