Created
December 12, 2017 17:23
-
-
Save aviks/d7a98a4e42ce06d441401ebb68d4af1d to your computer and use it in GitHub Desktop.
Language Detection Demo
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"using Flux\n", | |
"using Flux: onehotbatch, reset!" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(Any[:en, :it, :so, :fr, :es], ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' … '3', '4', '5', '6', '7', '8', '9', ' ', '\\n', '_'], Chain(Dense(39, 15, NNlib.σ), Recur(LSTMCell(15, 15))), Dense(15, 5))" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"langs, alphabet, scanner, encoder = open(deserialize, \"model-som-0.25.jls\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"model (generic function with 1 method)" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"function model(x)\n", | |
" state = scanner.(x.data)[end]\n", | |
" reset!(scanner)\n", | |
" softmax(encoder(state))\n", | |
"end" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"predict (generic function with 1 method)" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"predict(s) =\n", | |
" isempty(s) ?\n", | |
" softmax(ones(length(langs))) :\n", | |
" model(onehotbatch(normalize_string(s, casefold=true, stripmark=true), alphabet, '_')).data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"5-element Array{Float64,1}:\n", | |
" 0.812894 \n", | |
" 0.00761692\n", | |
" 0.0375369 \n", | |
" 0.0111166 \n", | |
" 0.130836 " | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"predict(\"hello, world\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/ColorTypes.ji for module ColorTypes.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/PlotUtils.ji for module PlotUtils.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/PlotThemes.ji for module PlotThemes.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/Showoff.ji for module Showoff.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/Measures.ji for module Measures.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/FileIO.ji for module FileIO.\n", | |
"\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mRecompiling stale cache file /Users/mike/.julia/lib/v0.6/Interact.ji for module Interact.\n", | |
"\u001b[39m" | |
] | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<div id=\"interact-js-shim\">\n", | |
" <script charset=\"utf-8\">\n", | |
"(function (IPython, $, _, MathJax) {\n", | |
" $.event.special.destroyed = {\n", | |
"\tremove: function(o) {\n", | |
"\t if (o.handler) {\n", | |
"\t\to.handler.apply(this, arguments)\n", | |
"\t }\n", | |
"\t}\n", | |
" }\n", | |
"\n", | |
" var OutputArea = IPython.version >= \"4.0.0\" ? require(\"notebook/js/outputarea\").OutputArea : IPython.OutputArea;\n", | |
"\n", | |
" var redrawValue = function (container, type, val) {\n", | |
"\tvar selector = $(\"<div/>\");\n", | |
"\tvar oa = new OutputArea(_.extend(selector, {\n", | |
"\t selector: selector,\n", | |
"\t prompt_area: true,\n", | |
"\t events: IPython.events,\n", | |
"\t keyboard_manager: IPython.keyboard_manager\n", | |
"\t})); // Hack to work with IPython 2.1.0\n", | |
"\n", | |
"\tswitch (type) {\n", | |
"\tcase \"image/png\":\n", | |
" var _src = 'data:' + type + ';base64,' + val;\n", | |
"\t $(container).find(\"img\").attr('src', _src);\n", | |
"\t break;\n", | |
"\tcase \"text/latex\":\n", | |
"\t\tif (MathJax){\n", | |
"\t\t\tvar math = MathJax.Hub.getAllJax(container)[0];\n", | |
"\t\t\tMathJax.Hub.Queue([\"Text\", math, val.replace(/^\\${1,2}|\\${1,2}$/g, '')]);\n", | |
"\t\t\tbreak;\n", | |
"\t\t}\n", | |
"\tdefault:\n", | |
"\t var toinsert = OutputArea.append_map[type].apply(\n", | |
"\t\toa, [val, {}, selector]\n", | |
"\t );\n", | |
"\t $(container).empty().append(toinsert.contents());\n", | |
"\t selector.remove();\n", | |
"\t}\n", | |
" }\n", | |
"\n", | |
"\n", | |
" $(document).ready(function() {\n", | |
"\tfunction initComm(evt, data) {\n", | |
"\t var comm_manager = data.kernel.comm_manager;\n", | |
" //_.extend(comm_manager.targets, require(\"widgets/js/widget\"))\n", | |
"\t comm_manager.register_target(\"Signal\", function (comm) {\n", | |
" comm.on_msg(function (msg) {\n", | |
" var val = msg.content.data.value;\n", | |
" $(\".signal-\" + comm.comm_id).each(function() {\n", | |
" var type = $(this).data(\"type\");\n", | |
" if (typeof(val[type]) !== \"undefined\" && val[type] !== null) {\n", | |
" redrawValue(this, type, val[type], type);\n", | |
" }\n", | |
" });\n", | |
" delete val;\n", | |
" delete msg.content.data.value;\n", | |
" });\n", | |
"\t });\n", | |
"\n", | |
"\t // coordingate with Comm and redraw Signals\n", | |
"\t // XXX: Test using Reactive here to improve performance\n", | |
"\t $([IPython.events]).on(\n", | |
"\t\t'output_appended.OutputArea', function (event, type, value, md, toinsert) {\n", | |
"\t\t if (md && md.reactive) {\n", | |
" // console.log(md.comm_id);\n", | |
" toinsert.addClass(\"signal-\" + md.comm_id);\n", | |
" toinsert.data(\"type\", type);\n", | |
" // Signal back indicating the mimetype required\n", | |
" var comm_manager = IPython.notebook.kernel.comm_manager;\n", | |
" var comm = comm_manager.comms[md.comm_id];\n", | |
" comm.then(function (c) {\n", | |
" c.send({action: \"subscribe_mime\",\n", | |
" mime: type});\n", | |
" toinsert.bind(\"destroyed\", function() {\n", | |
" c.send({action: \"unsubscribe_mime\",\n", | |
" mime: type});\n", | |
" });\n", | |
" })\n", | |
"\t\t }\n", | |
"\t });\n", | |
"\t}\n", | |
"\n", | |
"\ttry {\n", | |
"\t // try to initialize right away. otherwise, wait on the status_started event.\n", | |
"\t initComm(undefined, IPython.notebook);\n", | |
"\t} catch (e) {\n", | |
"\t $([IPython.events]).on('kernel_created.Kernel kernel_created.Session', initComm);\n", | |
"\t}\n", | |
" });\n", | |
"})(IPython, jQuery, _, MathJax);\n", | |
"</script>\n", | |
" <script>\n", | |
" window.interactLoadedFlag = true\n", | |
" $(\"#interact-js-shim\").bind(\"destroyed\", function () {\n", | |
" if (window.interactLoadedFlag) {\n", | |
" console.warn(\"JavaScript required by Interact will be removed if you remove this cell or run using Interact more than once.\")\n", | |
" }\n", | |
" })\n", | |
" $([IPython.events]).on(\"kernel_starting.Kernel kernel_restarting.Kernel\", function () { window.interactLoadedFlag = false })\n", | |
" </script>\n", | |
"</div>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"using Plots, Interact" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", | |
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 600 400\">\n", | |
"<defs>\n", | |
" <clipPath id=\"clip00\">\n", | |
" <rect x=\"0\" y=\"0\" width=\"600\" height=\"400\"/>\n", | |
" </clipPath>\n", | |
"</defs>\n", | |
"<polygon clip-path=\"url(#clip0700)\" points=\"\n", | |
"0,400 600,400 600,0 0,0 \n", | |
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n", | |
"<defs>\n", | |
" <clipPath id=\"clip01\">\n", | |
" <rect x=\"120\" y=\"0\" width=\"421\" height=\"400\"/>\n", | |
" </clipPath>\n", | |
"</defs>\n", | |
"<polygon clip-path=\"url(#clip0700)\" points=\"\n", | |
"32.2221,375.813 580.315,375.813 580.315,11.811 32.2221,11.811 \n", | |
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n", | |
"<defs>\n", | |
" <clipPath id=\"clip02\">\n", | |
" <rect x=\"32\" y=\"11\" width=\"549\" height=\"365\"/>\n", | |
" </clipPath>\n", | |
"</defs>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 90.8232,375.813 90.8232,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 198.546,375.813 198.546,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 306.269,375.813 306.269,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 413.991,375.813 413.991,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 521.714,375.813 521.714,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,375.813 580.315,375.813 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,303.013 580.315,303.013 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,230.212 580.315,230.212 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,157.412 580.315,157.412 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,84.6115 580.315,84.6115 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n", | |
" 32.2221,11.811 580.315,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,375.813 580.315,375.813 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,375.813 32.2221,11.811 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 90.8232,375.813 90.8232,370.353 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 198.546,375.813 198.546,370.353 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 306.269,375.813 306.269,370.353 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 413.991,375.813 413.991,370.353 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 521.714,375.813 521.714,370.353 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,375.813 40.4435,375.813 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,303.013 40.4435,303.013 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,230.212 40.4435,230.212 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,157.412 40.4435,157.412 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,84.6115 40.4435,84.6115 \n", | |
" \"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 32.2221,11.811 40.4435,11.811 \n", | |
" \"/>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 90.8232, 389.613)\" x=\"90.8232\" y=\"389.613\">en</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 198.546, 389.613)\" x=\"198.546\" y=\"389.613\">it</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 306.269, 389.613)\" x=\"306.269\" y=\"389.613\">so</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 413.991, 389.613)\" x=\"413.991\" y=\"389.613\">fr</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 521.714, 389.613)\" x=\"521.714\" y=\"389.613\">es</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 380.313)\" x=\"26.2221\" y=\"380.313\">0.0</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 307.513)\" x=\"26.2221\" y=\"307.513\">0.2</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 234.712)\" x=\"26.2221\" y=\"234.712\">0.4</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 161.912)\" x=\"26.2221\" y=\"161.912\">0.6</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 89.1115)\" x=\"26.2221\" y=\"89.1115\">0.8</text>\n", | |
"</g>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 26.2221, 16.311)\" x=\"26.2221\" y=\"16.311\">1.0</text>\n", | |
"</g>\n", | |
"<polygon clip-path=\"url(#clip0702)\" points=\"\n", | |
"47.7342,375.813 47.7342,375.813 133.912,375.813 133.912,375.813 47.7342,375.813 47.7342,375.813 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 47.7342,375.813 47.7342,375.813 133.912,375.813 133.912,375.813 47.7342,375.813 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0702)\" points=\"\n", | |
"155.457,12.9721 155.457,375.813 241.635,375.813 241.635,12.9721 155.457,12.9721 155.457,12.9721 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 155.457,12.9721 155.457,375.813 241.635,375.813 241.635,12.9721 155.457,12.9721 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0702)\" points=\"\n", | |
"263.179,375.813 263.179,375.813 349.358,375.813 349.358,375.813 263.179,375.813 263.179,375.813 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 263.179,375.813 263.179,375.813 349.358,375.813 349.358,375.813 263.179,375.813 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0702)\" points=\"\n", | |
"370.902,375.801 370.902,375.813 457.08,375.813 457.08,375.801 370.902,375.801 370.902,375.801 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 370.902,375.801 370.902,375.813 457.08,375.813 457.08,375.801 370.902,375.801 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0702)\" points=\"\n", | |
"478.625,374.666 478.625,375.813 564.803,375.813 564.803,374.666 478.625,374.666 478.625,374.666 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0702)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 478.625,374.666 478.625,375.813 564.803,375.813 564.803,374.666 478.625,374.666 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0700)\" points=\"\n", | |
"446.991,62.931 562.315,62.931 562.315,32.691 446.991,32.691 \n", | |
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 446.991,62.931 562.315,62.931 562.315,32.691 446.991,32.691 446.991,62.931 \n", | |
" \"/>\n", | |
"<polygon clip-path=\"url(#clip0700)\" points=\"\n", | |
"452.991,53.859 488.991,53.859 488.991,41.763 452.991,41.763 452.991,53.859 \n", | |
" \" fill=\"#009af9\" fill-opacity=\"1\"/>\n", | |
"<polyline clip-path=\"url(#clip0700)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n", | |
" 452.991,53.859 488.991,53.859 488.991,41.763 452.991,41.763 452.991,53.859 \n", | |
" \"/>\n", | |
"<g clip-path=\"url(#clip0700)\">\n", | |
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;\" transform=\"rotate(0, 494.991, 52.311)\" x=\"494.991\" y=\"52.311\">Probability</text>\n", | |
"</g>\n", | |
"</svg>\n" | |
] | |
}, | |
"execution_count": 8, | |
"metadata": { | |
"comm_id": "e0b58720-3288-4bdf-9c18-4b5e7d0b2708", | |
"reactive": true | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"@manipulate for s = \"c'é una bella filosofia\"\n", | |
" bar(String.(langs), predict(s),\n", | |
" label=[\"Probability\"], ylims=(0,1))\n", | |
"end" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Julia 0.6.1-pre", | |
"language": "julia", | |
"name": "julia-0.6" | |
}, | |
"language_info": { | |
"file_extension": ".jl", | |
"mimetype": "application/julia", | |
"name": "julia", | |
"version": "0.6.2" | |
}, | |
"widgets": { | |
"state": { | |
"16a34112-fcfc-4231-a945-604910a594dc": { | |
"views": [ | |
{ | |
"cell_index": 6 | |
} | |
] | |
} | |
}, | |
"version": "1.2.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment