我正在尝试进行多类分类并使用crowdflower 文本分类数据集。以下是我的代码:
from __future__ import unicode_literals, print_function
from __future__ import unicode_literals
from pathlib import Path
import pandas as pd
import spacy
from spacy.util import minibatch, compounding
def main(model=None, output_dir=None, n_iter=20):
if model is not None:
nlp = spacy.load(model) # load existing spaCy model
print("Loaded model '%s'" % model)
else:
nlp = spacy.blank('en') # create blank Language class
print("Created blank 'en' model")
# add the text classifier to the pipeline if it doesn't exist
# nlp.create_pipe works for built-ins …
Run Code Online (Sandbox Code Playgroud)