mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Remove whitespace
This commit is contained in:
parent
e71a1f4bd0
commit
3b667a24d4
|
@ -87,7 +87,7 @@ cdef class Lexeme:
|
||||||
value (bool): The new value of the flag.
|
value (bool): The new value of the flag.
|
||||||
"""
|
"""
|
||||||
Lexeme.c_set_flag(self.c, flag_id, value)
|
Lexeme.c_set_flag(self.c, flag_id, value)
|
||||||
|
|
||||||
def check_flag(self, attr_id_t flag_id):
|
def check_flag(self, attr_id_t flag_id):
|
||||||
"""Check the value of a boolean flag.
|
"""Check the value of a boolean flag.
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ cdef class Lexeme:
|
||||||
"\npython -m spacy download %s\n"
|
"\npython -m spacy download %s\n"
|
||||||
"to install the data." % self.vocab.lang
|
"to install the data." % self.vocab.lang
|
||||||
)
|
)
|
||||||
|
|
||||||
vector_view = <float[:length,]>self.c.vector
|
vector_view = <float[:length,]>self.c.vector
|
||||||
return numpy.asarray(vector_view)
|
return numpy.asarray(vector_view)
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ cdef class Lexeme:
|
||||||
return self.c.sentiment
|
return self.c.sentiment
|
||||||
def __set__(self, float sentiment):
|
def __set__(self, float sentiment):
|
||||||
self.c.sentiment = sentiment
|
self.c.sentiment = sentiment
|
||||||
|
|
||||||
property orth_:
|
property orth_:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.vocab.strings[self.c.orth]
|
return self.vocab.strings[self.c.orth]
|
||||||
|
@ -171,7 +171,7 @@ cdef class Lexeme:
|
||||||
property lower:
|
property lower:
|
||||||
def __get__(self): return self.c.lower
|
def __get__(self): return self.c.lower
|
||||||
def __set__(self, int x): self.c.lower = x
|
def __set__(self, int x): self.c.lower = x
|
||||||
|
|
||||||
property norm:
|
property norm:
|
||||||
def __get__(self): return self.c.norm
|
def __get__(self): return self.c.norm
|
||||||
def __set__(self, int x): self.c.norm = x
|
def __set__(self, int x): self.c.norm = x
|
||||||
|
@ -187,11 +187,11 @@ cdef class Lexeme:
|
||||||
property suffix:
|
property suffix:
|
||||||
def __get__(self): return self.c.suffix
|
def __get__(self): return self.c.suffix
|
||||||
def __set__(self, int x): self.c.suffix = x
|
def __set__(self, int x): self.c.suffix = x
|
||||||
|
|
||||||
property cluster:
|
property cluster:
|
||||||
def __get__(self): return self.c.cluster
|
def __get__(self): return self.c.cluster
|
||||||
def __set__(self, int x): self.c.cluster = x
|
def __set__(self, int x): self.c.cluster = x
|
||||||
|
|
||||||
property lang:
|
property lang:
|
||||||
def __get__(self): return self.c.lang
|
def __get__(self): return self.c.lang
|
||||||
def __set__(self, int x): self.c.lang = x
|
def __set__(self, int x): self.c.lang = x
|
||||||
|
@ -203,11 +203,11 @@ cdef class Lexeme:
|
||||||
property lower_:
|
property lower_:
|
||||||
def __get__(self): return self.vocab.strings[self.c.lower]
|
def __get__(self): return self.vocab.strings[self.c.lower]
|
||||||
def __set__(self, unicode x): self.c.lower = self.vocab.strings[x]
|
def __set__(self, unicode x): self.c.lower = self.vocab.strings[x]
|
||||||
|
|
||||||
property norm_:
|
property norm_:
|
||||||
def __get__(self): return self.vocab.strings[self.c.norm]
|
def __get__(self): return self.vocab.strings[self.c.norm]
|
||||||
def __set__(self, unicode x): self.c.norm = self.vocab.strings[x]
|
def __set__(self, unicode x): self.c.norm = self.vocab.strings[x]
|
||||||
|
|
||||||
property shape_:
|
property shape_:
|
||||||
def __get__(self): return self.vocab.strings[self.c.shape]
|
def __get__(self): return self.vocab.strings[self.c.shape]
|
||||||
def __set__(self, unicode x): self.c.shape = self.vocab.strings[x]
|
def __set__(self, unicode x): self.c.shape = self.vocab.strings[x]
|
||||||
|
@ -239,7 +239,7 @@ cdef class Lexeme:
|
||||||
property is_alpha:
|
property is_alpha:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_ALPHA)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_ALPHA)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_ALPHA, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_ALPHA, x)
|
||||||
|
|
||||||
property is_ascii:
|
property is_ascii:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_ASCII)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_ASCII)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_ASCII, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_ASCII, x)
|
||||||
|
@ -260,23 +260,23 @@ cdef class Lexeme:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_PUNCT)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_PUNCT)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_PUNCT, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_PUNCT, x)
|
||||||
|
|
||||||
property is_space:
|
property is_space:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_SPACE)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_SPACE)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_SPACE, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_SPACE, x)
|
||||||
|
|
||||||
property is_bracket:
|
property is_bracket:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_BRACKET)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_BRACKET)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_BRACKET, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_BRACKET, x)
|
||||||
|
|
||||||
property is_quote:
|
property is_quote:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_QUOTE)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_QUOTE)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_QUOTE, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_QUOTE, x)
|
||||||
|
|
||||||
property is_left_punct:
|
property is_left_punct:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x)
|
||||||
|
|
||||||
property is_right_punct:
|
property is_right_punct:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT)
|
def __get__(self): return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x)
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ cdef class Lexeme:
|
||||||
property like_url:
|
property like_url:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, LIKE_URL)
|
def __get__(self): return Lexeme.c_check_flag(self.c, LIKE_URL)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, LIKE_URL, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, LIKE_URL, x)
|
||||||
|
|
||||||
property like_num:
|
property like_num:
|
||||||
def __get__(self): return Lexeme.c_check_flag(self.c, LIKE_NUM)
|
def __get__(self): return Lexeme.c_check_flag(self.c, LIKE_NUM)
|
||||||
def __set__(self, bint x): Lexeme.c_set_flag(self.c, LIKE_NUM, x)
|
def __set__(self, bint x): Lexeme.c_set_flag(self.c, LIKE_NUM, x)
|
||||||
|
|
|
@ -128,13 +128,13 @@ cdef class Span:
|
||||||
end = token_by_end(self.doc.c, self.doc.length, self.end_char)
|
end = token_by_end(self.doc.c, self.doc.length, self.end_char)
|
||||||
if end == -1:
|
if end == -1:
|
||||||
raise IndexError("Error calculating span: Can't find end")
|
raise IndexError("Error calculating span: Can't find end")
|
||||||
|
|
||||||
self.start = start
|
self.start = start
|
||||||
self.end = end + 1
|
self.end = end + 1
|
||||||
|
|
||||||
property sent:
|
property sent:
|
||||||
'''The sentence span that this span is a part of.
|
'''The sentence span that this span is a part of.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Span The sentence this is part of.
|
Span The sentence this is part of.
|
||||||
'''
|
'''
|
||||||
|
@ -157,7 +157,7 @@ cdef class Span:
|
||||||
if 'has_vector' in self.doc.user_span_hooks:
|
if 'has_vector' in self.doc.user_span_hooks:
|
||||||
return self.doc.user_span_hooks['has_vector'](self)
|
return self.doc.user_span_hooks['has_vector'](self)
|
||||||
return any(token.has_vector for token in self)
|
return any(token.has_vector for token in self)
|
||||||
|
|
||||||
property vector:
|
property vector:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
if 'vector' in self.doc.user_span_hooks:
|
if 'vector' in self.doc.user_span_hooks:
|
||||||
|
@ -200,9 +200,9 @@ cdef class Span:
|
||||||
property noun_chunks:
|
property noun_chunks:
|
||||||
'''
|
'''
|
||||||
Yields base noun-phrase #[code Span] objects, if the document
|
Yields base noun-phrase #[code Span] objects, if the document
|
||||||
has been syntactically parsed. A base noun phrase, or
|
has been syntactically parsed. A base noun phrase, or
|
||||||
'NP chunk', is a noun phrase that does not permit other NPs to
|
'NP chunk', is a noun phrase that does not permit other NPs to
|
||||||
be nested within it – so no NP-level coordination, no prepositional
|
be nested within it – so no NP-level coordination, no prepositional
|
||||||
phrases, and no relative clauses. For example:
|
phrases, and no relative clauses. For example:
|
||||||
'''
|
'''
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
|
@ -227,19 +227,19 @@ cdef class Span:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Token: The root token.
|
Token: The root token.
|
||||||
|
|
||||||
i.e. has the
|
i.e. has the
|
||||||
shortest path to the root of the sentence (or is the root itself).
|
shortest path to the root of the sentence (or is the root itself).
|
||||||
|
|
||||||
If multiple words are equally high in the tree, the first word is taken.
|
If multiple words are equally high in the tree, the first word is taken.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
>>> toks = nlp(u'I like New York in Autumn.')
|
>>> toks = nlp(u'I like New York in Autumn.')
|
||||||
|
|
||||||
Let's name the indices --- easier than writing "toks[4]" etc.
|
Let's name the indices --- easier than writing "toks[4]" etc.
|
||||||
|
|
||||||
>>> i, like, new, york, in_, autumn, dot = range(len(toks))
|
>>> i, like, new, york, in_, autumn, dot = range(len(toks))
|
||||||
|
|
||||||
The head of 'new' is 'York', and the head of 'York' is 'like'
|
The head of 'new' is 'York', and the head of 'York' is 'like'
|
||||||
|
|
||||||
|
@ -301,10 +301,10 @@ cdef class Span:
|
||||||
return self.doc[self.start]
|
return self.doc[self.start]
|
||||||
else:
|
else:
|
||||||
return self.doc[root]
|
return self.doc[root]
|
||||||
|
|
||||||
property lefts:
|
property lefts:
|
||||||
"""Tokens that are to the left of the span, whose head is within the Span.
|
"""Tokens that are to the left of the span, whose head is within the Span.
|
||||||
|
|
||||||
Yields: Token A left-child of a token of the span.
|
Yields: Token A left-child of a token of the span.
|
||||||
"""
|
"""
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
|
@ -315,7 +315,7 @@ cdef class Span:
|
||||||
|
|
||||||
property rights:
|
property rights:
|
||||||
"""Tokens that are to the right of the Span, whose head is within the Span.
|
"""Tokens that are to the right of the Span, whose head is within the Span.
|
||||||
|
|
||||||
Yields: Token A right-child of a token of the span.
|
Yields: Token A right-child of a token of the span.
|
||||||
"""
|
"""
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user