python package package reference problem, missing function in utils file
AttributeError: "Utils" object has no attribute" init_utils"
the original text is here, how to use this function? Define another one yourself? Or do you have some skills? Shouldn"t it be executed automatically if it doesn"t start with self? As you are unfamiliar with the use of packages, please advise
class Utils(object):
def __init__(self, utils_data=None):
self.stopwords = self.init_utils(utils_data)
def _init_utils(self, utils_data):
for wd in utils_data["user_dict"]:
jieba.add_word(wd)
return set(utils_data["stopwords"])
def _token_filter(self, token): -sharp ; ;
return token not in self.stopwords and not token.isdigit() and len(token) >= 2
def cut(self, text):
return list(filter(self._token_filter, list(jieba.cut(text.lower())))) -sharp
< hr >
Summary afterwards:
I think the problem may be that when you make an external call, the assignment confuses list and dictionary, so I"ve removed _ before, which is not successful, but after straightening out the code, you can succeed. Or did I upgrade my ubuntu relationship in the middle? @ _ @, I don"t know, all kinds of possibilities, thank you for your attention!