Updated notebooks for new library organisation
[cipher-tools.git] / 2014 / 2014-challenge1.ipynb
index 5dabd2d091360ffb83a4ec18ce1e7fb5cc77480a..34d336235bd294425d4f5af018d3317278f86262 100644 (file)
@@ -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",
     "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()"
   },
   {
    "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"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 4,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "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"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 6,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
     "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": []
   }
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.4.3"
+   "version": "3.6.3"
   }
  },
  "nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
 }