Análise de sentimentos em texto financeiros

Home Fóruns Fórum Python para Finanças: Análise de Dados e Machine Learning Análise de sentimentos em texto financeiros

Visualizando 2 posts - 1 até 2 (de 2 do total)
  • Autor
    Posts
  • #39940
    Apollo
    Participante
    Ao execultar esse trecho:
    
    modelo = spacy.blank('en')
    categorias = modelo.create_pipe("textcat")
    categorias.add_label('POSITIVO')
    categorias.add_label('NEGATIVO')
    modelo.add_pipe(categorias)
    historico = []
    
    Recebo esse Erro:

    ValueError Traceback (most recent call last)
    <ipython-input-80-40ace644a210> in <module>
    3 categorias.add_label(‘POSITIVO’)
    4 categorias.add_label(‘NEGATIVO’)
    —-> 5 modelo.add_pipe(categorias)
    6 historico = []

    /usr/local/lib/python3.9/dist-packages/spacy/language.py in add_pipe(self, factory_name, name, before, after, first, last, source, config, raw_config, validate)
    746 bad_val = repr(factory_name)
    747 err = Errors.E966.format(component=bad_val, name=name)
    –> 748 raise ValueError(err)
    749 name = name if name is not None else factory_name
    750 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 0x7f6b92f0cd10> (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.

    #39949

    Olá Apollo, você esta utilizando essa versão do Spacy: !pip install spacy==2.2.4 ?

    Fabio

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