Commits

Matt Bone committed 3433f61

some changes...

  • Participants
  • Parent commits d9a0c85

Comments (0)

Files changed (2)

File alternatives_for_authoring.ipynb

       "\n",
       "$$1 + 1 = 2$$\n",
       "\n",
+      "$$a + b = 3$$\n",
+      "\n",
       "$$E = \\frac{mc^2}{\\sqrt{1-\\frac{v^2}{c^2}}}$$\n",
       "\n",
       "And the inline support works, too: $2 + 2 = 4$.\n",
      "source": [
       "## Wiki Syntax and Markdown\n",
       "\n",
-      "The [first wiki](http://en.wikipedia.org/wiki/WikiWikiWeb) came around in 1995 and included [its own text formatting rules](http://c2.com/cgi/wiki?TextFormattingExamples) to enable quick communication between programmers. Not only did this inspire tons of [wikis](http://www.wikipedia.org/) and [wiki](http://moinmo.in/) [software](https://www.dokuwiki.org/dokuwiki), it also inspired a lot of wiki markup like [markdown](http://daringfireball.net/projects/markdown/basics) and [ReStructuredText](http://docutils.sourceforge.net/docs/user/rst/quickstart.html). Probably the most widely used syntax these days is [github flavored markdown](https://help.github.com/articles/github-flavored-markdown).\n",
+      "The [first wiki](http://en.wikipedia.org/wiki/WikiWikiWeb) came around in 1995 and included [its own text formatting rules](http://c2.com/cgi/wiki?TextFormattingExamples) to enable quick communication between programmers. Not only did this inspire tons of [wikis](http://www.wikipedia.org/) and [wiki](http://moinmo.in/) [software](https://www.dokuwiki.org/dokuwiki), it also inspired a lot of wiki markup like [markdown](http://daringfireball.net/projects/markdown/basics) and [ReStructuredText](http://docutils.sourceforge.net/docs/user/rst/quickstart.html). Probably the most widely used syntax these days is [github flavored markdown](https://help.github.com/articles/github-flavored-markdown). In the python world, [sphinx](http://sphinx-doc.org/) is often used for authoring an is frequently published to [read the docs](https://readthedocs.org/).\n"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def foo():\n",
+      "    \"\"\"\n",
+      "    This is my docstring\n",
+      "    \"\"\"\n",
+      "    return \"foo\"\n",
       "\n",
-      "* sphinx\n",
-      "* read the docs\n"
-     ]
+      "foo.__doc__"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 10,
+       "text": [
+        "'\\n    This is my docstring\\n    '"
+       ]
+      }
+     ],
+     "prompt_number": 10
     },
     {
      "cell_type": "markdown",
      "source": [
       "## docbook\n",
       "\n",
-      "http://www.docbook.org/tdg5/en/html/docbook.html"
+      "While it is based on xml [docbook](http://www.docbook.org/tdg5/en/html/docbook.html) is worth mentioning because it is a valuable authoring tool."
      ]
     },
     {
      "source": [
       "## pandoc\n",
       "\n",
-      "http://johnmacfarlane.net/pandoc/"
+      "[pandoc](http://johnmacfarlane.net/pandoc/) is a very intereting project that lets you convert between all types of markup by taking advantage of the tree structure that we've talked abot to no end throughout this course."
      ]
     },
     {

File inverted_index.ipynb

       "from collections import defaultdict\n",
       "from pprint import pprint\n",
       "from functools import partial\n",
+      "import json\n",
       "import requests"
      ],
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 1
+     "prompt_number": 14
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 2
+     "prompt_number": 15
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 3
+     "prompt_number": 16
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 4
+     "prompt_number": 17
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 5
+     "prompt_number": 18
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 6
+     "prompt_number": 19
     },
     {
      "cell_type": "code",
        ]
       }
      ],
-     "prompt_number": 7
+     "prompt_number": 20
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 8
+     "prompt_number": 21
     },
     {
      "cell_type": "code",
        ]
       }
      ],
-     "prompt_number": 9
+     "prompt_number": 22
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "student1 = {'first': 'Art',\n",
+      "            'last': 'Van Delay',\n",
+      "            'age': 37}\n",
+      "student2 = {'first': 'Bob',\n",
+      "            'last': 'Smith',\n",
+      "            'age': 33}\n",
+      "student3 = {'first': 'Sally',\n",
+      "            'last': 'Smith',\n",
+      "            'age': 28}"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [],
+     "prompt_number": 23
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "response = requests.put(\"http://localhost:9200/school/students/1\", data=json.dumps(student1))\n",
+      "response = requests.put(\"http://localhost:9200/school/students/2\", data=json.dumps(student2))\n",
+      "response = requests.put(\"http://localhost:9200/school/students/3\", data=json.dumps(student3))"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [],
+     "prompt_number": 29
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "requests.get('http://localhost:9200/school/students/1').json()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 32,
+       "text": [
+        "{u'_id': u'1',\n",
+        " u'_index': u'school',\n",
+        " u'_source': {u'age': 37, u'first': u'Art', u'last': u'Van Delay'},\n",
+        " u'_type': u'students',\n",
+        " u'_version': 2,\n",
+        " u'exists': True}"
+       ]
+      }
+     ],
+     "prompt_number": 32
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "requests.get('http://localhost:9200/school/students/2').json()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 33,
+       "text": [
+        "{u'_id': u'2',\n",
+        " u'_index': u'school',\n",
+        " u'_source': {u'age': 33, u'first': u'Bob', u'last': u'Smith'},\n",
+        " u'_type': u'students',\n",
+        " u'_version': 1,\n",
+        " u'exists': True}"
+       ]
+      }
+     ],
+     "prompt_number": 33
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "requests.get('http://localhost:9200/school/students/3').json()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 34,
+       "text": [
+        "{u'_id': u'3',\n",
+        " u'_index': u'school',\n",
+        " u'_source': {u'age': 28, u'first': u'Sally', u'last': u'Smith'},\n",
+        " u'_type': u'students',\n",
+        " u'_version': 1,\n",
+        " u'exists': True}"
+       ]
+      }
+     ],
+     "prompt_number": 34
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "requests.get('http://localhost:9200/school/students/4').json()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 37,
+       "text": [
+        "{u'_id': u'4', u'_index': u'school', u'_type': u'students', u'exists': False}"
+       ]
+      }
+     ],
+     "prompt_number": 37
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "requests.get('http://localhost:9200/school/students/_search', \n",
+      "             data=json.dumps({\"query\": {\"text\": {\"last\": \"smith\"}}})).json()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 42,
+       "text": [
+        "{u'_shards': {u'failed': 0, u'successful': 5, u'total': 5},\n",
+        " u'hits': {u'hits': [{u'_id': u'2',\n",
+        "    u'_index': u'school',\n",
+        "    u'_score': 0.30685282,\n",
+        "    u'_source': {u'age': 33, u'first': u'Bob', u'last': u'Smith'},\n",
+        "    u'_type': u'students'},\n",
+        "   {u'_id': u'3',\n",
+        "    u'_index': u'school',\n",
+        "    u'_score': 0.30685282,\n",
+        "    u'_source': {u'age': 28, u'first': u'Sally', u'last': u'Smith'},\n",
+        "    u'_type': u'students'}],\n",
+        "  u'max_score': 0.30685282,\n",
+        "  u'total': 2},\n",
+        " u'timed_out': False,\n",
+        " u'took': 3}"
+       ]
+      }
+     ],
+     "prompt_number": 42
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "_.content"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": [
+      {
+       "metadata": {},
+       "output_type": "pyout",
+       "prompt_number": 41,
+       "text": [
+        "'{\"took\":34,\"timed_out\":false,\"_shards\":{\"total\":5,\"successful\":5,\"failed\":0},\"hits\":{\"total\":2,\"max_score\":0.30685282,\"hits\":[{\"_index\":\"school\",\"_type\":\"students\",\"_id\":\"2\",\"_score\":0.30685282, \"_source\" : {\"age\": 33, \"last\": \"Smith\", \"first\": \"Bob\"}},{\"_index\":\"school\",\"_type\":\"students\",\"_id\":\"3\",\"_score\":0.30685282, \"_source\" : {\"age\": 28, \"last\": \"Smith\", \"first\": \"Sally\"}}]}}'"
+       ]
+      }
+     ],
+     "prompt_number": 41
     },
     {
      "cell_type": "code",
      "input": [],
      "language": "python",
      "metadata": {},
-     "outputs": [],
-     "prompt_number": 9
+     "outputs": []
     }
    ],
    "metadata": {}