我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用jieba._get_abs_path()。
def set_stop_words(self, stop_words_path): abs_path = _get_abs_path(stop_words_path) if not os.path.isfile(abs_path): raise Exception("jieba: file does not exist: " + abs_path) content = open(abs_path, 'rb').read().decode('utf-8') for line in content.splitlines(): self.stop_words.add(line)
def set_idf_path(self, idf_path): new_abs_path = _get_abs_path(idf_path) if not os.path.isfile(new_abs_path): raise Exception("jieba: file does not exist: " + new_abs_path) self.idf_loader.set_new_path(new_abs_path) self.idf_freq, self.median_idf = self.idf_loader.get_idf()