Skip to content

Instantly share code, notes, and snippets.

View siebeniris's full-sized avatar
🍀

Yiyi Chen siebeniris

🍀
View GitHub Profile
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import itertools
import string
"""
Since character embeddings are a bit weak in pytorch 3, this will hopefully help out
I think these should be trainable and also, invertable!
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active May 23, 2024 07:53
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@jackyliang
jackyliang / Baidu Maps API
Last active September 9, 2021 07:17
Baidu Maps API
Baidu Maps API Detailed Explanation
-
Explanation of [drawing Objects onto Baidu Maps](http://developer.baidu.com/map/jsdemo.htm#f0_7).
Draw Shit Onto Baidu Map:
-
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@bufas
bufas / earley.py
Created November 2, 2014 20:46
Basic Python implementation of the Earley algorithm for parse tree generation
class State(object):
def __init__(self, label, rules, dot_idx, start_idx, end_idx, idx, made_from, producer):
self.label = label
self.rules = rules
self.dot_idx = dot_idx
self.start_idx = start_idx
self.end_idx = end_idx
self.idx = idx
self.made_from = made_from
self.producer = producer
@veer66
veer66 / simple_earley_parser.py
Created September 20, 2014 13:20
Simple Earley Parser
import json
import sys
import re
import copy
import pprint
pp = pprint.PrettyPrinter(indent=4)
class EarleyParser(object):
def __init__(self):