From ed1ac2969eb585d3c1b5a63f23ae79f8c57db878 Mon Sep 17 00:00:00 2001 From: 4altinok Date: Sun, 11 Feb 2018 18:51:48 +0100 Subject: [PATCH] added new lexical feat to lexeme --- spacy/lexeme.pyx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spacy/lexeme.pyx b/spacy/lexeme.pyx index d136540f9..78d3bed6c 100644 --- a/spacy/lexeme.pyx +++ b/spacy/lexeme.pyx @@ -12,7 +12,7 @@ import numpy from .typedefs cimport attr_t, flags_t from .attrs cimport IS_ALPHA, IS_ASCII, IS_DIGIT, IS_LOWER, IS_PUNCT, IS_SPACE from .attrs cimport IS_TITLE, IS_UPPER, LIKE_URL, LIKE_NUM, LIKE_EMAIL, IS_STOP -from .attrs cimport IS_BRACKET, IS_QUOTE, IS_LEFT_PUNCT, IS_RIGHT_PUNCT, IS_OOV +from .attrs cimport IS_BRACKET, IS_QUOTE, IS_LEFT_PUNCT, IS_RIGHT_PUNCT, IS_CURRENCY, IS_OOV from .attrs cimport PROB from .attrs import intify_attrs from . import about @@ -474,6 +474,14 @@ cdef class Lexeme: def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) + property is_currency: + """RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, €.""" + def __get__(self): + return Lexeme.c_check_flag(self.c, IS_CURRENCY) + + def __set__(self, bint x): + Lexeme.c_set_flag(self.c, IS_CURRENCY, x) + property like_url: """RETURNS (bool): Whether the lexeme resembles a URL.""" def __get__(self):