Skip to content
Discussion options

You must be logged in to vote

The sample code I have for spacy transformers is for spacy v2.3 and works with vectors. It fits a model like this:

from sklearn import svm

nlp = spacy.load("en_trf_bertbaseuncased_lg")
[.....]
docs = [nlp(text) for text in train_x]
train_x_vectors = [doc.vector for doc in docs]
clf_svm = svm.SVC(kernel='linear')

clf_svm.fit(train_x_vectors, train_y) 

I spent hours Friday searching for the equivalent code for spacy v3.1 and haven't yet found it. (Maybe it was in front of me and I didin't recognize it.) Could you please post sample code here, or post a link to sample code?

Replies: 4 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@felipefoschiera
Comment options

@VikR1000
Comment options

@polm
Comment options

@VikR0001
Comment options

@polm
Comment options

Answer selected by svlandeg
Comment options

You must be logged in to vote
5 replies
@kadarakos
Comment options

@brabbit61
Comment options

@kadarakos
Comment options

@brabbit61
Comment options

@kadarakos
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / transformer Feature: Transformer
6 participants