Skip to content

Instantly share code, notes, and snippets.

View LemonPrefect's full-sized avatar

Saphir Gu LemonPrefect

View GitHub Profile
@LemonPrefect
LemonPrefect / JiebaBuilder.py
Last active January 8, 2023 17:40
Builder using jieba for Chinese implementation of tokenization for Lunr.py.
from collections import defaultdict
from lunr.field_ref import FieldRef
from lunr.builder import Builder
from lunr.token import Token
import jieba
"""
Jieba Builder
LemonPrefect<me@lemonprefect.cn>
Builder using jieba for Chinese implementation of tokenization for Lunr.py.
@LemonPrefect
LemonPrefect / syllables.ts
Created December 6, 2022 05:27
Deno script cli for query the syllables of word list from file.
import * as fs from "https://deno.land/std@0.167.0/node/fs.ts";
import axiod from "https://deno.land/x/axiod@0.26.2/mod.ts";
import { DOMParser } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";
import { colors } from "https://deno.land/x/cliffy@v0.25.5/ansi/colors.ts";
import { readLines } from "https://deno.land/std/io/buffer.ts";
const {error, warn, info} = {error: colors.bold.red, warn: colors.bold.yellow, info: colors.bold.blue};
export async function trans(word: string): Promise<string>{
word = word.split(" ")[0].trim();
@LemonPrefect
LemonPrefect / solution-lena.py
Last active December 6, 2022 07:24
Solution for lena from Xiangyun Cup Quals, 2022
import cv2
import pywt
import numpy as np
from PIL import Image
from numpy import uint8, ndarray
from reedsolo import RSCodec
def arnoldShuffle(imageData, factor):
shuffleTimes, a, b = factor