Skip to content

Instantly share code, notes, and snippets.

😃
Excelsior

游刃 Elfsong

😃
Excelsior
Block or report user

Report or block Elfsong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Elfsong
Elfsong / esim.py
Created May 18, 2019 — forked from namakemono/esim.py
Implementation of ESIM(Enhanced LSTM for Natural Language Inference)
View esim.py
"""
Implementation of ESIM(Enhanced LSTM for Natural Language Inference)
https://arxiv.org/abs/1609.06038
"""
import numpy as np
from keras.layers import *
from keras.activations import softmax
from keras.models import Model
def StaticEmbedding(embedding_matrix):
@Elfsong
Elfsong / server.java
Created Apr 19, 2019
Sent file in blocksize
View server.java
// TODO: FILE_BYTES_REQUEST
for (int initial_position = 0; initial_position < qq.fileDescriptor.fileSize; ) {
long offset = 0;
long remained = qq.fileDescriptor.fileSize - initial_position;
if (remained > blockSize) {
offset = blockSize;
} else {
offset = remained;
View combinations pair
(_,_,_) -> (0,_,_) = remove all three pitchs
(_,_,_) -> (a,b,c) = a + b == 3 or a + c == 3 retrive all three notes or octaves
View split_story_dialogue.py
import json
import os
import re
import jieba
ROOT_PATH = "/Users/elfsong/PycharmProjects/BERT_demo"
RESOURCE_PATH = os.path.join(ROOT_PATH, "Test text")
View V_Byte_V1.py
def vbyte_encode(num):
# out_bytes stores a list of output bytes encoding the number
out_bytes = []
###
# Your answer BEGINS HERE
###
while num >= 128:
out_bytes = [num % 128] + out_bytes
@Elfsong
Elfsong / average_split.py
Last active Mar 11, 2019
优雅地均匀分割字符串
View average_split.py
def avsplit1(s, n):
fn = len(s)//n
rn = len(s)%n
ar = [fn+1]*rn+ [fn]*(n-rn)
si = [i*(fn+1) if i<rn else (rn*(fn+1)+(i-rn)*fn) for i in range(n)]
sr = [s[si[i]:si[i]+ar[i]] for i in range(n)]
return sr
def avsplit2(s, n):
fn = len(s)//n
View pinyin
# coding: utf-8
import ast
import clr
import json
import os
import re
from StoryTelling.tts import append_pronunciation
from StoryTelling.tts.tools import OnlineTts
from Speech.Cognitive.Services import TimeLine
View movie_studio.py
import os
import time
from multiprocessing import Process
import cocos
import cv2
import numpy as np
import pyglet
from PIL import ImageGrab
from cocos.actions import CallFunc
@Elfsong
Elfsong / excel_reader
Created Jan 26, 2019
Excel Reader #spreadsheet #python
View excel_reader
import os
import xlrd
ROOT_PATH = r"C:\Users\t-midu\PycharmProjects\Scenario"
RESOURCE_PATH = os.path.join(ROOT_PATH, "resource")
file_path = os.path.join(RESOURCE_PATH, "sentence_class.xls")
data = xlrd.open_workbook(file_path)
@Elfsong
Elfsong / excel_writer.py
Last active Jan 26, 2019
Excel writer #spreadsheet #python
View excel_writer.py
import xlwt
import random
import demo_night
ROOT_PATH = r"C:\Users\t-midu\PycharmProjects\Scenario_detecter"
RESOURCE_PATH = os.path.join(ROOT_PATH, "resource")
file_path = os.path.join(RESOURCE_PATH, "stories.json.txt")
# Crating a new sheet
You can’t perform that action at this time.