diff options
Diffstat (limited to 'docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html')
-rw-r--r-- | docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html b/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html index 0eea323..0b307fd 100644 --- a/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html +++ b/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html @@ -89,20 +89,20 @@ I created a sample JSON with only 3 examples (I know, very less, but works for a <p><img src="/assets/posts/swift-chatbot/drugs-json.png" alt="Screenshot of Sample Dataset" /></p> -<div class="codehilite"><pre><span></span><code><span class="p">[</span> - <span class="p">{</span> - <span class="nt">"tokens"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Tell"</span><span class="p">,</span><span class="s2">"me"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"drug"</span><span class="p">,</span><span class="s2">"Aspirin"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span> - <span class="nt">"labels"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span> - <span class="p">},</span> - <span class="p">{</span> - <span class="nt">"tokens"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Please"</span><span class="p">,</span><span class="s2">"tell"</span><span class="p">,</span><span class="s2">"me"</span><span class="p">,</span><span class="s2">"information"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"compound"</span><span class="p">,</span><span class="s2">"salicylic"</span><span class="p">,</span><span class="s2">"acid"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span> - <span class="nt">"labels"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span> - <span class="p">},</span> - <span class="p">{</span> - <span class="nt">"tokens"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Information"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"compound"</span><span class="p">,</span><span class="s2">"Ibuprofen"</span><span class="p">,</span><span class="s2">"please"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span> - <span class="nt">"labels"</span><span class="p">:</span> <span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span> - <span class="p">}</span> -<span class="p">]</span> +<div class="codehilite"><pre><span></span><code><span class="p">[</span><span class="w"></span> +<span class="w"> </span><span class="p">{</span><span class="w"></span> +<span class="w"> </span><span class="nt">"tokens"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Tell"</span><span class="p">,</span><span class="s2">"me"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"drug"</span><span class="p">,</span><span class="s2">"Aspirin"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span><span class="w"></span> +<span class="w"> </span><span class="nt">"labels"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span><span class="w"></span> +<span class="w"> </span><span class="p">},</span><span class="w"></span> +<span class="w"> </span><span class="p">{</span><span class="w"></span> +<span class="w"> </span><span class="nt">"tokens"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Please"</span><span class="p">,</span><span class="s2">"tell"</span><span class="p">,</span><span class="s2">"me"</span><span class="p">,</span><span class="s2">"information"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"compound"</span><span class="p">,</span><span class="s2">"salicylic"</span><span class="p">,</span><span class="s2">"acid"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span><span class="w"></span> +<span class="w"> </span><span class="nt">"labels"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span><span class="w"></span> +<span class="w"> </span><span class="p">},</span><span class="w"></span> +<span class="w"> </span><span class="p">{</span><span class="w"></span> +<span class="w"> </span><span class="nt">"tokens"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"Information"</span><span class="p">,</span><span class="s2">"about"</span><span class="p">,</span><span class="s2">"the"</span><span class="p">,</span><span class="s2">"compound"</span><span class="p">,</span><span class="s2">"Ibuprofen"</span><span class="p">,</span><span class="s2">"please"</span><span class="p">,</span><span class="s2">"."</span><span class="p">],</span><span class="w"></span> +<span class="w"> </span><span class="nt">"labels"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"COMPOUND"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">,</span><span class="s2">"NONE"</span><span class="p">]</span><span class="w"></span> +<span class="w"> </span><span class="p">}</span><span class="w"></span> +<span class="p">]</span><span class="w"></span> </code></pre></div> <p><img src="/assets/posts/swift-chatbot/create-tagger.png" alt="Screenshot of Create ML Text Classifier" /></p> @@ -208,9 +208,14 @@ Otherwise, it calls the custom action.</p> <p>If I ever release a part-2, it will either be about implementing this in Tensorflow.JS or an iOS app using SwiftUI ;)</p> - <div class="commentbox"></div> + <script data-isso="//comments.navan.dev/" + src="//comments.navan.dev/js/embed.min.js"></script> + <section id="isso-thread"> + <noscript>Javascript needs to be activated to view comments.</noscript> + </section> + <!--<div class="commentbox"></div> <script src="https://unpkg.com/commentbox.io/dist/commentBox.min.js"></script> - <script>commentBox('5650347917836288-proj')</script> + <script>commentBox('5650347917836288-proj')</script>--> </main> |