This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
import re | |
import copy | |
import pprint | |
pp = pprint.PrettyPrinter(indent=4) | |
class EarleyParser(object): | |
def __init__(self): |