Home › Fóruns › Fórum Python para Finanças: Análise de Dados e Machine Learning › Análise de sentimentos em texto financeiros
- Este tópico contém 1 resposta, 2 vozes e foi atualizado pela última vez 1 ano, 10 meses atrás por Fábio Spak.
- AutorPosts
- 18 de março de 2023 às 21:27 #39940
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 callnlp.add_pipe('name')
instead.– If you passed in a component like
TextCategorizer()
: callnlp.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 runnlp.add_pipe('your_name')
to add it to the pipeline.20 de março de 2023 às 09:48 #39949Olá Apollo, você esta utilizando essa versão do Spacy: !pip install spacy==2.2.4 ?
Fabio
- AutorPosts
- Você deve fazer login para responder a este tópico.