mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
Add tensor field to Lexeme, Token, Doc and Span, so that users have a place to hang neural network outputs
This commit is contained in:
parent
afe20bd8fb
commit
f3be9d0a9a
|
@ -15,6 +15,7 @@ cdef class Lexeme:
|
||||||
cdef LexemeC* c
|
cdef LexemeC* c
|
||||||
cdef readonly Vocab vocab
|
cdef readonly Vocab vocab
|
||||||
cdef readonly attr_t orth
|
cdef readonly attr_t orth
|
||||||
|
cdef public ndarray tensor
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
|
cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
|
||||||
|
|
|
@ -32,6 +32,8 @@ cdef class Doc:
|
||||||
cdef public object _vector
|
cdef public object _vector
|
||||||
cdef public object _vector_norm
|
cdef public object _vector_norm
|
||||||
|
|
||||||
|
cdef public np.ndarray tensor
|
||||||
|
|
||||||
cdef TokenC* c
|
cdef TokenC* c
|
||||||
|
|
||||||
cdef public bint is_tagged
|
cdef public bint is_tagged
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
cimport numpy as np
|
||||||
|
|
||||||
from .doc cimport Doc
|
from .doc cimport Doc
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +11,8 @@ cdef class Span:
|
||||||
cdef readonly int end_char
|
cdef readonly int end_char
|
||||||
cdef readonly int label
|
cdef readonly int label
|
||||||
|
|
||||||
|
cdef public np.ndarray tensor
|
||||||
|
|
||||||
cdef public _vector
|
cdef public _vector
|
||||||
cdef public _vector_norm
|
cdef public _vector_norm
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from numpy cimport ndarray
|
||||||
from ..vocab cimport Vocab
|
from ..vocab cimport Vocab
|
||||||
from ..structs cimport TokenC
|
from ..structs cimport TokenC
|
||||||
from ..attrs cimport attr_id_t
|
from ..attrs cimport attr_id_t
|
||||||
|
@ -9,6 +10,7 @@ cdef class Token:
|
||||||
cdef TokenC* c
|
cdef TokenC* c
|
||||||
cdef readonly int i
|
cdef readonly int i
|
||||||
cdef readonly Doc doc
|
cdef readonly Doc doc
|
||||||
|
cdef public ndarray tensor
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc):
|
cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user