X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=2014%2F2014-challenge1.ipynb;h=34d336235bd294425d4f5af018d3317278f86262;hb=1350633e419f802975c773db8de86e3de49ea7fd;hp=5dabd2d091360ffb83a4ec18ce1e7fb5cc77480a;hpb=df271527a6e3e4d10da9f9be3d1e9ebea9171493;p=cipher-tools.git diff --git a/2014/2014-challenge1.ipynb b/2014/2014-challenge1.ipynb index 5dabd2d..34d3362 100644 --- a/2014/2014-challenge1.ipynb +++ b/2014/2014-challenge1.ipynb @@ -2,10 +2,8 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, + "execution_count": 2, + "metadata": {}, "outputs": [], "source": [ "import os,sys,inspect\n", @@ -16,7 +14,10 @@ "import matplotlib.pyplot as plt\n", "%matplotlib inline\n", "\n", - "from cipherbreak import *\n", + "from cipher.caesar import *\n", + "from support.utilities import *\n", + "from support.text_prettify import *\n", + "from support.language_models import *\n", "\n", "c1a = open('1a.ciphertext').read()\n", "c1b = open('1b.ciphertext').read()" @@ -24,10 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, + "execution_count": 3, + "metadata": {}, "outputs": [ { "data": { @@ -35,7 +34,7 @@ "(4, -728.156672407534)" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -47,10 +46,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, + "execution_count": 4, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -82,10 +79,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, + "execution_count": 5, + "metadata": {}, "outputs": [ { "data": { @@ -93,7 +88,7 @@ "(22, -637.7038880633795)" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -105,10 +100,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, + "execution_count": 6, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -122,12 +115,33 @@ "print(' '.join(segment(sanitise(caesar_decipher(c1b, key_b)))))" ] }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "report on the trojan project having drugged the crew we were able to take the ship with essentially\n", + "no resistance the crew were handed to the somali pirates at the deepwater rendezvous as planned and\n", + "we began the survey just after midnight the radar showed an approaching vessel which our database\n", + "identified as a coastguard cutter we headed south to avoid detection with all ship lights off we\n", + "then completed the survey in the new location afterdawn with the listening post installed we began\n", + "assembling the equipment for phase two of the operation keeping a watch for further patrols in the\n", + "sky and on the water\n" + ] + } + ], + "source": [ + "print(lcat(tpack(segment(sanitise(caesar_decipher(c1b, key_b))))))" + ] + }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [] } @@ -148,9 +162,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3" + "version": "3.6.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 }