代码出现TypeError: 'module' object is not callable应该怎样修改呢

代码出现TypeError: 'module' object is not callable应该怎样修改呢

import pandas as pd
import jieba.posseg as pseg
from synonyms import synonyms
import zhon.hanzi
from nltk.corpus import stopwords
punc = zhon.hanzi.punctuation  #要去除的中文标点符号
baidu_stopwords = stopwords.words('chinese') #导入停用词表
#读入文件
with open(r'D:\文本储存\9999991111.txt',encoding="gb18030") as fp:
    text = fp.read()
       
ls = pseg.cut(text) #使用jieba.posseg分词,可以得到每个词的词性

# 去掉长度为1或非名词的词,包括标点
newls = []
for word, flag in ls:
    if len(word) > 1 and flag.startswith('n'): 
        # flag.startswith('n') 表示词性以'n'开头即为名词
        newls.append(word)
#统计词频
ds = pd.Series(newls).value_counts()

#合并同义词,并保留同义词中词频高的词
syn_dict = {}
new_ds = ds.copy()   #复制一份原始的Series.
for idx, freq in ds.items():
    syn_res =synonyms(idx)
    if syn_res:
        syn_freq = max([ds.get(syn_word, 0) for syn_word in syn_res]) #获取同义词中出现频率最高的词
        syn_dict[idx] = syn_freq
        new_ds.drop(syn_res, errors='ignore', inplace=True)  #去除同义词
new_ds.rename(syn_dict, inplace=True)

#再次统计词频
new_ds = new_ds.value_counts()

#去除停用词
for i in baidu_stopwords:
    try:      #处理找不到元素i时pop()方法可能出现的错误
        new_ds.pop(i)  
    except:
        continue #没有i这个词,跳过本次,继续下一个词

pd.set_option('display.max_rows', None)#显示全部行
pd.set_option('display.max_columns', None)#显示全部列

print(new_ds[:300])



   提示是 syn_res =synonyms(idx) 出错 为啥呢

synonyms是模块,不是函数,所以没法调用