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
#=======================================================================# | |
# extract_data.py # | |
#=======================================================================# | |
# usage: extract_data.py [-h] [-i INPUT_DIR] [-o OUTPUT_DIR] | |
# | |
# This program extracts provision numbers from a set of documents. | |
# | |
# optional arguments: | |
# -h, --help show this help message and exit | |
# -i INPUT_DIR, --input_dir INPUT_DIR |
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
#!/usr/bin/env python | |
'''Crop an image to just the portions containing text. | |
Usage: | |
./crop_morphology.py path/to/image.jpg | |
This will place the cropped image in path/to/image.crop.png. | |
For details on the methodology, see |
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
# Keras==1.0.6 | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers.recurrent import LSTM | |
from keras.layers.core import TimeDistributedDense, Activation | |
from keras.preprocessing.sequence import pad_sequences | |
from keras.layers.embeddings import Embedding | |
from sklearn.cross_validation import train_test_split | |
from sklearn.metrics import confusion_matrix, accuracy_score, precision_recall_fscore_support |