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 | 50 |
1 files changed, 46 insertions, 4 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 228b8e4..50c74a2 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 @@ -51,8 +51,33 @@ Disclaimer: This is a very crude proof-of-concept, but it does work.</p> <p>I opened a CSV file and added some sample entries, with a corresponding label.</p> -<p><img src="/assets/posts/swift-chatbot/intent-csv.png" alt="Screenshot of Sample Dataset" /> -<img src="/assets/posts/swift-chatbot/create-intent.png" alt="Screenshot of Create ML Text Classifier" /></p> +<p><img src="/assets/posts/swift-chatbot/intent-csv.png" alt="Screenshot of Sample Dataset" /></p> + +<pre><code>text,label +hey there,greetings +hello,greetings +good morning,greetings +good evening,greetings +hi,greetings +open the pod bay doors,banter +who let the dogs out,banter +ahh that's hot,banter +bruh that's rad,banter +nothing,banter +da fuq,banter +can you tell me details about the compound aspirin,deez-drug +i want to know about some compounds,deez-drug +search about the compound,deez-drug +tell me about the molecule,deez-drug +tell me about something,banter +tell me something cool,banter +tell a joke,banter +make me a sandwich,banter +whatcha doing,greetings +i love you,banter +</code></pre> + +<p><img src="/assets/posts/swift-chatbot/create-intent.png" alt="Screenshot of Create ML Text Classifier" /></p> <h2>Word Tagging</h2> @@ -60,8 +85,25 @@ Disclaimer: This is a very crude proof-of-concept, but it does work.</p> This model will be only called if the intent from the classifier is a custom action. I created a sample JSON with only 3 examples (I know, very less, but works for a crude PoC).</p> -<p><img src="/assets/posts/swift-chatbot/drugs-json.png" alt="Screenshot of Sample Dataset" /> -<img src="/assets/posts/swift-chatbot/create-tagger.png" alt="Screenshot of Create ML Text Classifier" /></p> +<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> +</code></pre></div> + +<p><img src="/assets/posts/swift-chatbot/create-tagger.png" alt="Screenshot of Create ML Text Classifier" /></p> <h2>Time to Get Swift-y</h2> |