Erro na aula – Classificação de sentimentos com spaCy 6

Home Fóruns Fórum Inteligência Artificial e Machine Learning: O Guia Completo Erro na aula – Classificação de sentimentos com spaCy 6

Visualizando 2 posts - 1 até 2 (de 2 do total)
  • Autor
    Posts
  • #38161
    André
    Participante

    Prezados, boa noite.

    Estou encontrando esse erro, e gostaria que pudesse me ajudar…

    # Etapa 5 : Criação do Classificador

    modelo = spacy.blank(‘pt’)
    categorias = modelo.create_pipe(“textcat”)
    categorias.add_label(“ALEGRIA”)
    categorias.add_label(“MEDO”)
    modelo.add_pipe(categorias) # Erro acontece aqui….
    historico = []

     

    #### Mensagem de erro abaixo  ####

    ValueError Traceback (most recent call last)

    <ipython-input-56-a854a45c4284> in <module>
    5 categorias.add_label(“ALEGRIA”)
    6 categorias.add_label(“MEDO”)
    —-> 7 modelo.add_pipe(categorias)
    8 historico = []

    /usr/local/lib/python3.7/dist-packages/spacy/language.py in add_pipe(self, factory_name, name, before, after, first, last, source, config, raw_config, validate)
    777 bad_val = repr(factory_name)
    778 err = Errors.E966.format(component=bad_val, name=name)
    –> 779 raise ValueError(err)
    780 name = name if name is not None else factory_name
    781 if name in self.component_names:

    ValueError: [E966] nlp.add_pipe now takes the string name of the registered component factory, not a callable component. Expected string, but got <spacy.pipeline.textcat.TextCategorizer object at 0x7f32332bc9f0> (name: ‘None’).

    – If you created your component with nlp.create_pipe('name'): remove nlp.create_pipe and call nlp.add_pipe('name') instead.

    – If you passed in a component like TextCategorizer(): call nlp.add_pipe with the string name instead, e.g. nlp.add_pipe('textcat').

    – If you’re using a custom component: Add the decorator @Language.component (for function components) or @Language.factory (for class components / factories) to your custom component and assign it a name, e.g. @Language.component('your_name'). You can then run nlp.add_pipe('your_name') to add it to the pipeline.

     

     

    #38166

    Olá André, você esta utilizando essa versão?

    !pip install -q spacy==2.2.3

    Fabio

Visualizando 2 posts - 1 até 2 (de 2 do total)
  • Você deve fazer login para responder a este tópico.