随笔分类 - Python
摘要:```python import sys import faiss import numpy as np d = 64 nb = 100 nq = 10 np.random.seed(1234) xb = np.random.random((nb,d)).astype('float32') prin
阅读全文
摘要:import cv2 import numpy as np from skimage.metrics import structural_similarity import imutils def image_similarity(img1, img2): """ :param img1: 图片1
阅读全文
摘要:[[index, index + len(value) - 1] for index in [_.start() for _ in re.finditer(value, corrected_text)]]
阅读全文
摘要:# -*- coding: utf-8 -*-# import threading import time from queue import Queue def do(name): print(name) time.sleep(0.1) def task(name): if not message
阅读全文
摘要:import shutil from pathlib import Path from traceback import format_exc from log_color.log_color import Logger from progress.bar import IncrementalBar
阅读全文
摘要:wav2pcm import numpy as np def wav2pcm(wav_file, pcm_file, data_type=np.int16): f = open(wav_file, "rb") f.seek(0) f.read(44) data = np.fromfile(f, dt
阅读全文
摘要:from difflib import SequenceMatcher def text_similar_rate(text1, text2): """ :param text1: 文本1 :param text2: 文本2 :return: 相似度 """ return SequenceMatch
阅读全文
摘要:# -*- coding: utf-8 -*-# class Point: def __init__(self, xy): self.x = xy[0] self.y = xy[1] def line_intersection(line1, line2): """ :param line1: 线段一
阅读全文