This file contains hidden or 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 argparse | |
import json | |
def get_parser(): | |
"Get an argument parser for this module." | |
parser = argparse.ArgumentParser( | |
description="Train an word embedding model using LSTM network") | |
parser.add_argument("--run_string", default="", type=str, | |
help="Optional string to help you identify the run") |
This file contains hidden or 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
from urlparse import urlparse | |
import colorsys, sys | |
def keyword_tuples(query): | |
"""Create (keyword,value) tuples for the query.""" | |
return map(lambda x:tuple(x.split('=')), query.split('&')) | |
def get_colors(url): | |
"""Get colors from the URL, returns a list of hex color values (without #)""" | |
result = urlparse(url) |
This file contains hidden or 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
# modified from: https://gist.github.com/dellis23/6174914/ | |
# - Added NLTK, which simplifies the chain and ngram logic. | |
# To use this script, you need to have downloaded the punkt | |
# data like this: | |
# | |
# import nltk | |
# nltk.download('punkt') | |
# | |
# - No more occasional KeyErrors. |
NewerOlder