2021-KPANG / AI-Online-Meeting-Solution

AI Online meeting solution developed by Team KPANG for 2021 KPMG Ideation Challenge
Apache License 2.0
5 stars 5 forks source link

app.py 실행시 에러 (summerizer 관련) #3

Closed SoYoungCho closed 3 years ago

SoYoungCho commented 3 years ago
Traceback (most recent call last):
  File "C:/Users/Soyoung Cho/Desktop/2021/KPMG 공모전/AI-Online-Meeting-Solution-main/app.py", line 5, in <module>
    from summarizer import Summarizer
  File "C:\ProgramData\Anaconda3\lib\site-packages\summarizer\__init__.py", line 1, in <module>
    from summarizer.model_processors import Summarizer, SingleModel, TransformerSummarizer
  File "C:\ProgramData\Anaconda3\lib\site-packages\summarizer\model_processors.py", line 10, in <module>
    class ModelProcessor(object):
  File "C:\ProgramData\Anaconda3\lib\site-packages\summarizer\model_processors.py", line 19, in ModelProcessor
    sentence_handler: SentenceHandler = SentenceHandler(),
  File "C:\ProgramData\Anaconda3\lib\site-packages\summarizer\sentence_handler.py", line 8, in __init__
    self.nlp.add_pipe(self.nlp.create_pipe('sentencizer'))
  File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\language.py", line 748, in add_pipe
    raise ValueError(err)
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.sentencizer.Sentencizer object at 0x000001D9FF2316C8> (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.

Process finished with exit code 1

app.py 실행시 위와 같은 에러가 발생합니다. 콘솔창에서 pip install bert-extractive-summarizer==0.4.2 를 통해 설치는 했는데 왜 이런지 아시는 분 계실까요?

LimSeJin9577 commented 3 years ago

Envirnoment에 희승님께서 올리셨습니다!

../site-packages/summarizer경로에서 sentence_handler.py 파일 수정

self.nlp.add_pipe(self.nlp.create_pipe('sentencizer')) ->

self.nlp.add_pipe("sentencizer")

return [c.string.strip() for c in doc.sents if max_length > len(c.string.strip()) > min_length] ->

return [c.text.strip() for c in doc.sents if max_length > len(c.text.strip()) > min_length]

SoYoungCho commented 3 years ago

감사합니다! Readme에도 일단 추가했습니다.