mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +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 readonly Vocab vocab
|
||||
cdef readonly attr_t orth
|
||||
cdef public ndarray tensor
|
||||
|
||||
@staticmethod
|
||||
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_norm
|
||||
|
||||
cdef public np.ndarray tensor
|
||||
|
||||
cdef TokenC* c
|
||||
|
||||
cdef public bint is_tagged
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
cimport numpy as np
|
||||
|
||||
from .doc cimport Doc
|
||||
|
||||
|
||||
|
@ -9,6 +11,8 @@ cdef class Span:
|
|||
cdef readonly int end_char
|
||||
cdef readonly int label
|
||||
|
||||
cdef public np.ndarray tensor
|
||||
|
||||
cdef public _vector
|
||||
cdef public _vector_norm
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from numpy cimport ndarray
|
||||
from ..vocab cimport Vocab
|
||||
from ..structs cimport TokenC
|
||||
from ..attrs cimport attr_id_t
|
||||
|
@ -9,6 +10,7 @@ cdef class Token:
|
|||
cdef TokenC* c
|
||||
cdef readonly int i
|
||||
cdef readonly Doc doc
|
||||
cdef public ndarray tensor
|
||||
|
||||
@staticmethod
|
||||
cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc):
|
||||
|
|
Loading…
Reference in New Issue
Block a user