diff --git a/edX Lightning Talk.ipynb b/edX Lightning Talk.ipynb
index a34be55..f681ab3 100644
--- a/edX Lightning Talk.ipynb
+++ b/edX Lightning Talk.ipynb
@@ -212,42 +212,14 @@
"\n",
"We can partition by threes too:\n",
"\n",
- "(The quick brown) (quick brown fox) ... (the lazy dog)\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "slideshow": {
- "slide_type": "fragment"
- }
- },
- "source": [
+ "(The quick brown) (quick brown fox) ... (the lazy dog)\n",
+ "\n",
"Or, the condition can be two words (`condition = 'the lazy'`):\n",
"\n",
- "(The quick brown) (quick brown fox) ... (the lazy dog)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "slideshow": {
- "slide_type": "fragment"
- }
- },
- "source": [
+ "(The quick brown) (quick brown fox) ... (the lazy dog)\n",
+ "\n",
+ "These are **trigrams**.\n",
"\n",
- "These are **trigrams**."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "slideshow": {
- "slide_type": "fragment"
- }
- },
- "source": [
"We can partition any **N** number of words together as **ngrams**."
]
},
@@ -343,7 +315,7 @@
"source": [
"words = ('The quick brown fox jumped over the '\n",
" 'lazy dog and the quick cat').split(' ')\n",
- "print words"
+ "print(words)"
]
},
{
@@ -409,6 +381,17 @@
"{k: dict(v) for k, v in dict(cfd).items()}"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "slideshow": {
+ "slide_type": "slide"
+ }
+ },
+ "source": [
+ "## Conditional Frequency Distributions (CFDs) ##"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {
@@ -501,9 +484,9 @@
"word = random.choice(TEXT)\n",
"# generate 15 more words\n",
"for i in range(15):\n",
- " print word,\n",
+ " print(word + ' ', end='')\n",
" if word in cfd:\n",
- " word = random.choice(cfd[word].keys())\n",
+ " word = random.choice(list(cfd[word].keys()))\n",
" else:\n",
" break"
]
@@ -604,10 +587,12 @@
"cell_type": "markdown",
"metadata": {
"slideshow": {
- "slide_type": "fragment"
+ "slide_type": "slide"
}
},
"source": [
+ "# Syllables\n",
+ "\n",
"* poet: /ˈpoʊət/\n",
"* does: /ˈdʌz/\n",
"\n",
@@ -806,7 +791,7 @@
"source": [
"from stat_parser import Parser\n",
"parsed = Parser().parse('The quick brown fox jumps over the lazy dog.')\n",
- "print parsed"
+ "print(parsed)"
]
},
{
@@ -917,6 +902,18 @@
"[https://spacy.io/docs/api/#speed-comparison](https://spacy.io/docs/api/#speed-comparison)"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "slideshow": {
+ "slide_type": "slide"
+ }
+ },
+ "source": [
+ "![Screenshot of displaCy, a dependency visualizer for spaCy](images/displacy.png)\n",
+ "[https://demos.explosion.ai/displacy/](https://demos.explosion.ai/displacy/)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {
@@ -962,6 +959,20 @@
"[http://karpathy.github.io/2015/05/21/rnn-effectiveness/](http://karpathy.github.io/2015/05/21/rnn-effectiveness/)"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "slideshow": {
+ "slide_type": "slide"
+ }
+ },
+ "source": [
+ "![Screenshot of word-rnn readme on Github](images/word-rnn.png)\n",
+ "[word-rnn](https://github.com/larspars/word-rnn)\n",
+ "\n",
+ "[word-rnn-tensorflow](https://github.com/hunkim/word-rnn-tensorflow)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {
@@ -973,28 +984,30 @@
"source": [
"# The end #\n",
"\n",
- "Questions?"
+ "Questions?\n",
+ "\n",
+ "Full write up at: [hallada.net/blog](http://www.hallada.net/2017/07/11/generating-random-poems-with-python.html)"
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
- "display_name": "Python 2",
+ "display_name": "Python 3",
"language": "python",
- "name": "python2"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
- "version": 2
+ "version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.12"
+ "pygments_lexer": "ipython3",
+ "version": "3.5.2"
},
"livereveal": {
"scroll": true,
diff --git a/images/displacy.png b/images/displacy.png
new file mode 100644
index 0000000..f8577b8
Binary files /dev/null and b/images/displacy.png differ
diff --git a/images/word-rnn.png b/images/word-rnn.png
new file mode 100644
index 0000000..7667b8e
Binary files /dev/null and b/images/word-rnn.png differ