尝试在Python中运行 isanlp 库时,出现 ConnectionRefusedError:[WinError 10061] 。
所以我正在使用 sockets 保留端口名称。
这是我的代码
from isanlp.pipeline_common import PipelineCommon
from isanlp.ru.processor_tokenizer_ru import ProcessorTokenizerRu
from isanlp.processor_sentence_splitter import ProcessorSentenceSplitter
from isanlp.ru.processor_mystem import ProcessorMystem
from isanlp.processor_polyglot import ProcessorPolyglot
from isanlp.processor_syntaxnet_remote import ProcessorSyntaxNetRemote
import socket
s = socket.socket()
s.bind(('', 0))
port = s.getsockname()[1]
ppl = PipelineCommon([(ProcessorPolyglot().detect_language,
['text'],
{0: 'lang'}),
(ProcessorTokenizerRu(),
['text'],
{0 : 'tokens'}),
(ProcessorSentenceSplitter(),
['tokens'],
{0 : 'sentences'}),
(ProcessorMystem(),
['tokens', 'sentences'],
{'lemma' : 'lemma',
'postag' : 'postag'}),
(ProcessorSyntaxNetRemote('localhost', port),
['tokens', 'sentences'],
{'syntax_dep_tree' : 'syntax_dep_tree'}),
(ProcessorPolyglot(),
['text'],
{'entities' : 'entities'})])
text_ru = 'Мама мыла раму.'
annotations = ppl(text_ru)
我不明白是什么原因导致此错误。您能帮我解决这个问题吗?