Пример #1
0
 def __init__(self, text, title):
     self.title = title
     self.text = text
     self.keywords = list()
     self.sentences = list()
     self.summary = list()
     self.cut = pips('jieba.posseg', 'jieba').cut  # 自动安装结巴包失败,请手动安装: pip install jieba
     self.extract_tags = pips('jieba.analyse', 'jieba').extract_tags  # 自动安装结巴包失败,请手动安装: pip install jieba
Пример #2
0
# -*- coding: utf-8 -*-
# @Time    : 2019/7/20 13:42
# @Email  : [email protected]
# @Software: PyCharm
from jtyoui.error import LibraryNotInstallError
from jtyoui.tools import pips
import os
import glob
import zipfile
import shutil

try:
    import fitz  # 安装 pip install PyMuPDF
except ModuleNotFoundError:
    try:
        fitz = pips('fitz', 'PyMuPDF')  # 自动安装
    except ModuleNotFoundError:
        raise LibraryNotInstallError("安装 pip install PyMuPDF")


def _get_dir_name(file_dir):
    base_name = os.path.basename(file_dir)  # 获得地址的文件名
    dir_name = os.path.dirname(file_dir)  # 获得地址的父链接
    return dir_name, base_name


def image_pdf(file_dir, pdf_address=None):
    """
    照片转pdf
    :param file_dir: 照片的地址文件夹
    :param pdf_address: 保存pdf的文件地址,默认是当前地址