<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zuri Hunter on Medium]]></title>
        <description><![CDATA[Stories by Zuri Hunter on Medium]]></description>
        <link>https://medium.com/@thestrugglingblack?source=rss-b3f7aeed3c45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jlr91YbzCASRCTsv-aYpUQ.jpeg</url>
            <title>Stories by Zuri Hunter on Medium</title>
            <link>https://medium.com/@thestrugglingblack?source=rss-b3f7aeed3c45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:42:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thestrugglingblack/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built my First Twitch Bot with Natural Language Understanding (NLU)]]></title>
            <link>https://javascript.plainenglish.io/how-i-built-my-first-twitch-bot-with-nlu-66000facdc38?source=rss-b3f7aeed3c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/66000facdc38</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[twitch]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Zuri Hunter]]></dc:creator>
            <pubDate>Fri, 08 Oct 2021 20:29:23 GMT</pubDate>
            <atom:updated>2021-10-12T10:19:25.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2Rzkv7cI-J7wjJDQ" /><figcaption>Photo by <a href="https://unsplash.com/@afgprogrammer?utm_source=medium&amp;utm_medium=referral">Mohammad Rahmani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Over the past couple of months, I have been experimenting with different areas of Machine Learning and Artificial Intelligence. Recently I tried building a <a href="https://en.wikipedia.org/wiki/Convolutional_neural_network">Convolutional Neural Network</a> that would have the ability to identify hair types from images. To learn more about my experiment you can check out my video <a href="https://www.youtube.com/watch?v=LtqaumBsuPM">here</a>.</p><p>Despite not having a successful outcome exploring Convolutional Neural Networks, I was still inspired to learn more about AI/ML. This led me to learn about a subset in the space called Natural Language Understanding, specifically “Question and Answer.” In my new project, I decided to build a Twitch Bot that will answer questions about the three black women who are trailblazers within the AI/ML industry, <strong>Timnit Gebru</strong>, <strong>Rediet Abebe</strong>, and <strong>Joy Buolamwini</strong>.</p><h3>What is Natural Language Understanding?</h3><p>In the text world for Machine Learning and Artificial Intelligence, there are two subtopics: Natural Language Processing and Natural Language Understanding. <strong>Natural Language Processing</strong> is when I teach the machine to extract, categorize and break down sentence structures. For example, the sentence “The quick brown fox jumps over the lazy dog.” Using a method called “<strong><em>name entity recognition</em></strong>” the machine would identify “fox” and “dogs” as “<strong><em>things</em></strong>” and then using “<strong><em>parts-of-speech tagging</em></strong>” the machine would parse out “brown”, “quick” and “lazy” as an <strong>adjective</strong> and “jumps” as a <strong>verb</strong>. These two methods within NLP alone just help the machine identify components in the natural language but do not really give the machine the ability to understand the sentence.</p><p>This is where the subtopic <strong>Natural Language Understanding</strong> is introduced. NLU trains the machine to have reading comprehension over the natural language that it processes. A method in NLU called “<strong>Question and Answer</strong>” teaches the machines how to respond to questions based on the data it receives. In the context of my example sentence, if I asked the machine “What color is the fox?”, it would answer back “The fox is brown.” Q&amp;A models can answer “definition” questions, “how and why” questions, and semantically constrained questions. Also, Q&amp;A models can be trained on everything, which is called “<strong>open domain</strong>” or it can be trained on a particular subject, “<strong>closed domain</strong>”. For the model that I will be building, it is going to be a closed domain since it will only be able to answer questions about the three ladies in the AI/ML industry and it will be able to answer “definition” questions and “how and why” questions.</p><h3>Building the Bot</h3><p>To build my Twitch Bot there are three major components that I will have to piece together: connecting to my own personal Twitch channel, setting up a cache database for the data, and building the “Question and Answer” model. Twitch has a very flexible API that allows me to read and post messages to my channel. The library I chose to interface with their API is <strong>TMI.js</strong>, a Twitch Message Interface library. My data is several text files that are less than 100KB. Each time my model runs, it will retrieve the data and conduct its analysis. To speed up this processing I am going to create an in-memory cache database. Cache Databases increases processing time and decreases the time it takes to retrieve data. The library I chose was <strong>memory-cache.js</strong>, a simple in-memory cache for Node.js.</p><p>Finally, I will be using the popular open-source machine-learning library called <strong>TensorFlow</strong>. TensorFlow was originally written in Python but it has grown to other programming languages. <strong>TensorFlow</strong> is written in <strong>Node.js</strong> and contains pre-trained models. There are two versions of TensorFlow: CPU and GPU. All of this means that the model will run on the CPU or GPU of my machine. Running models on GPU has been known for faster processing. For my model, I am going to use the CPU. The libraries that I will use to support my model are <strong>@tensorflow-models/qna.js</strong>, <strong>@tensorflow/tfjs</strong> and <strong>@tensorflow/tfjs-node</strong>.</p><h3>Setup Twitch</h3><p>The first step I have to do is initialize my Twitch client. <strong>TMI.js</strong> requires me to provide my username, password, and channel in order to view and respond to messages in my Twitch channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiQVCRCgzMweUjZXg7pp-w.png" /></figure><p>Since those three items are sensitive information, I will place them in an .env file. “<strong>dotenv</strong>” is a library that loads environment files to the process.env object. It is very secure and useful for configuring servers for different environments. Another configuration that I can set with my Twitch client is the connection type. To follow best practices I am going to set my connection to be secure (HTTPS). I am also going to set my Twitch client to constantly reconnect if there was a drop in connection.</p><h3>Build Out Model</h3><p>After initializing my Twitch client, the next thing to do is to build out my model. Earlier I mentioned that TensorFlow uses pre-trained models. A <strong>pre-trained model</strong> is a model that is developed by another party that serves as a foundation model to expand on. For example, if I want to build a model that can detect cat breeds in pictures. I have the option to build the model from scratch. This means I will have to train the model to know the difference between cats and other objects. This requires over millions of images of all types including cats. Yet if I used a pre-trained model it will already know the difference between cats and objects. This gives me the opportunity to build models faster to solve problems. For our use case, I am going to use a pre-trained model for “<strong>Question and Answer</strong>.”</p><p>Before I can use the model, I would need to feed it my own data. The data will be stored in a text file. The setback with doing that is every time the model runs the server would have to read the file system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*chtXQxoN_V-90mOSOdQIhA.png" /></figure><p>To bypass this I can store the data in memory and retrieve the data from the memory cache. I will do this by creating a self-invoke function. This will read the text files and place them in the memory cache. I will retrieve the information using the file name as its key.<br> <br>Now that I have my data in place, I can piece together the model. My model is going to answer questions from three topics. Instead of tailoring the code to all three topics, I am going to make a one-size-fits-all function. The function will capture the name of the topic and presented question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HnebLne3ojgg9XqlWkCSTA.png" /></figure><p>I am going to name the function “<strong>qnaModel</strong>.” The first thing it will do is initialize the Q&amp;A pre-trained model from TensorFlow. Then based on the name that it was given, it will retrieve the associated text from the memory cache. That information, along with the question is fed into TensorFlow’s function, called “<strong>findAnswers</strong>.” This function takes two parameters, the data and the question. In return, it will provide me with an array of objects. Here is an example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owEHiQzTFzRCY0AQLJineQ.png" /></figure><p>The object has four properties: <strong>text</strong>, <strong>startIndex</strong>, <strong>endIndex</strong> and <strong>score</strong>. The “<strong>text</strong>” displays the answer that the model developed. Both “<strong>startIndex</strong>” and “<strong>endIndex</strong>” point to where the model found the answer in the text. “<strong>Score</strong>” measures how confident the model is with its answer. The closer the number is to 1 the more confident the model is with the answer. By default, the first entry in the array will have the higher score from the model. In the code, I decide to place a conditional statement. If the array is greater than one, return the first element in the array. Finally, I export this function for my Twitch client to use.</p><h3>Connect Model to Twitch Bot</h3><p>The Twitch API has several events that I can use to interact with in my Twitch channel. I will need to use a channel event that allows me to listen for “messages”. From there I can analyze these messages and determine whether a user is trying to interact with our bot. I am going to look for messages that contain <strong>!joybuolamwini !redietabebe </strong>and <strong>!timnitgebru</strong>. Those messages will have a question preceding it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkUNUA1v6d66aIxcFbFJ5g.png" /></figure><p>Then, finally, I am going to pull in the function that does the data analysis for my questions. In the code snippet, I am going to drop all properties except “text.” This is because I only want to display the answer on my Twitch channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l1YPkArlFMUvleSVGSu68g.png" /></figure><p>After that, I am going to send the answer to my Twitch channel. To do this I use the “<strong>say</strong>” method. This method takes in two parameters: <strong>channel name</strong> and <strong>message</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdzvzP6VXpL6ZGYl1fXqKQ.png" /></figure><p>The following snippet shows everything together in the <strong>src/index.js </strong>file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfu9_3tKpdczsWuIjXfdbQ.png" /></figure><p>Now here is a short clip on my Twitch bot working within my Twitch channel.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbFDfUJGZV9M&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbFDfUJGZV9M&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FbFDfUJGZV9M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bedcbcb358b9f664a9a494fecf1256b2/href">https://medium.com/media/bedcbcb358b9f664a9a494fecf1256b2/href</a></iframe><h3>Conclusion</h3><p>The code above is my first iteration in combining NLU and Twitch API. There are <strong>several</strong> improvements that I can make to this code. An example would be caching answers to common questions. This would cut down on the server and model’s response time. Nevertheless, I wanted to share my journey in experimenting with Natural Language Understanding.</p><p>I hope this tutorial gives you the inspiration to dabble with TensorFlow using JavaScript. You can view the full code <a href="https://github.com/thestrugglingblack/struggle-bot">here</a>.</p><p><em>If you enjoyed this tutorial, check out my technology streams on </em><a href="http://www.twitch.tv/thestrugglingblack"><strong><em>www.twitch.tv/thestrugglingblack</em></strong></a></p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66000facdc38" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-i-built-my-first-twitch-bot-with-nlu-66000facdc38">How I Built my First Twitch Bot with Natural Language Understanding (NLU)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner-Friendly Introduction to GitLab CI/CD]]></title>
            <link>https://faun.pub/beginner-friendly-introduction-to-gitlab-ci-cd-1c80ee5ba0ae?source=rss-b3f7aeed3c45------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c80ee5ba0ae</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Zuri Hunter]]></dc:creator>
            <pubDate>Sat, 19 Jan 2019 22:53:11 GMT</pubDate>
            <atom:updated>2019-07-18T15:40:27.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixosClL_dPysk9sYaJxrHg.png" /></figure><p>The goal of this tutorial is to give a high-level introduction of GitLab CI/CD that helps people get started in 30 minutes without having to read all of GitLab‘s documentation. This tutorial is geared toward beginners who wish to tinker with CI/CD tools like GitLab CI/CD. In this tutorial, I will briefly go over what is CI/CD, why I decided to go with GitLab’s tool and a walkthrough on how to create a .gitlab-ci.yaml with an example application.</p><h3>CI/CD</h3><p>CI/CD is short for <strong>Continuous Integration/ Continuous Delivery / Continuous Deployment</strong>. It enables teams to build, test and release software at a faster rate. CI/CD removes manual human interactions where possible — automating everything except the final manual code deployment to production. One of the challenges of implementing this practice is integrating the various tools and systems required to build a CI/CD pipeline. For example, you might store your code in Bitbucket, test it in automated test suites on private infrastructure, and deploy your application to AWS or Microsoft Azure. Complicated applications residing on multiple systems have contributed to not all organizations implementing a seamless CI/CD pipeline.</p><h3>Why GitLab CI/CD?</h3><p>I use GitLab CI/CD for three reasons: I can build a complete CI/CD pipeline solution with one tool, it’s fast, and it’s open source. With GitLab CI/CD in the same place, I can create tickets, merge requests, write code and setup CI/CD tools without another application. It’s essentially a one-stop shop. GitLab CI/CD runs builds on<strong> GitLab Runners</strong>. <strong>Runners</strong> are isolated virtual machines that run predefined steps through the GitLab CI API. This tool, alone, allows for projects to run through the pipeline builds faster, compared to running on a single instance. You can learn more details about GitLab Runners in this <a href="https://docs.gitlab.com/runner/">link</a>. Finally, it’s open source, so I can always contribute to the code base, and create a new issue when a problem arises.</p><h3>Scenario</h3><p>Let’s say we have a Node.js API that retrieves a list of books in a database. We can create a pipeline that pushes our code through three phases: build, test and deploy. A <strong>pipeline</strong> is a group of steps that are grouped by similar characteristics. With those phases our pipeline is defined by three types:</p><ul><li><strong>Project Pipeline</strong></li><li><strong>Continuous Integration Pipeline</strong></li><li><strong>Deploy Pipeline</strong></li></ul><p>The <strong>Project Pipeline</strong> installs dependencies, runs linters and any scripts that deal with the code. The <strong>Continuous Integration Pipeline</strong> runs automated tests and builds a distributed version of the code. Finally, the <strong>Deploy Pipeline</strong> deploys code to a designated cloud provider and environment.</p><p>The steps that the three pipelines execute are called <strong>jobs</strong>. When you group a series of jobs by those characteristics it is called <strong>stages. </strong>Jobs are the basic building block for pipelines. They can be grouped together in stages and stages can be grouped together into pipelines. Here’s an example hierarchy of jobs, stages, and pipelines:</p><pre>A.) Build<br> i. Install NPM Dependencies<br> ii. Run ES-Linter<br> iii. Run Code-Minifier<br>B.) Test<br> i. Run unit, functional and end-to-end test.<br> ii. Run pkg to compile Node.js application<br>C.) Deploy<br> i. Production<br> 1.) Launch EC2 instance on AWS<br> ii. Staging<br> 1.) Launch on local development server</pre><p>In this hierarchy, all three components are considered three different pipelines. The main bullets — build, test, and deploy are <strong>stages</strong> and each bullet under those sections are jobs. Let’s break this out into a GitLab CI/CD yamlfile.</p><h3>Using GitLab CI/CD</h3><p>To use GitLab CI/CD, create a file called .gitlab-ci.yml at the root of the project in your GitLab repository and add the following yaml:</p><pre>image: node:10.5.0</pre><pre>stages:<br> — build<br> — test<br> — deploy</pre><pre>before_script:<br> — npm install</pre><p>As I mentioned earlier, GitLab CI/CD uses Runners to execute pipelines. We can define which operating system and predefined libraries we would want our Runner to be based off by using the image directive. In our instance, we will be using the latest version of Node.js for our Runner. The stages directive allows us to predefine a stage for the entire configuration. Jobs will be executed based off of the order listed in the stages directive. To learn more about stages you can view it <a href="https://docs.gitlab.com/ee/ci/yaml/#stages">here</a>. The before_script directive is used to run a command before all jobs.</p><p>Now let’s start with our job dedicated to the <strong>Build</strong> stage. We are going to call this job build-min-code. In this job we want it to install dependencies and minify the code. We can start this off with using the script directive. The scriptdirective is a shell script that gets executed within the Runner. Then we are going to assign this job to the “build” stage. To assign a job to a stage, use the stagedirective.</p><pre>build-min-code:<br>  stage: build<br>  script:<br>    - npm install<br>    - npm run minifier</pre><p>Now we have a job associated with our <strong>Build</strong> stage and we are going to do that for our <strong>Test</strong> stage. Our test job is going to be called run-unit-testand we are going to use the npm script in our API to run a test npm test.</p><pre>run-unit-test:<br>  stage: test<br>  script:<br>    - npm run test</pre><p>Finally, we are going to add a job to handle our <strong>Deploy</strong> stage: deploy-production, deploy-staging. In this instance, we are going to have two different jobs for deployment (staging and production). These jobs will reflect the same layout as our previous jobs but with a small change. Currently, all of our jobs are <strong>automatically</strong> set to be triggered on any code push or branch. We do not want to have that for when we deploy our code to staging and production. To prevent that from happening we use the only directive. The only directive defines the names of branches and tags for which the job will run. The job will look like the following:</p><pre>deploy-staging:<br> stage: deploy<br> script:<br>   — npm run deploy-stage<br> only:<br>   — develop</pre><pre>deploy-production:<br> stage: deploy<br> script:<br>   — npm run deploy-prod<br> only:<br>   — master</pre><p>In our deploy-staging job, the Runner will only execute it if there was a change to the develop branch and for deploy-production the master branch. Here is a screenshot below that shows a code push made to the master branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cdL-GKdhQs3UhCvDQU4ZQ.png" /></figure><p>From this image all three stages and jobs are triggered with the exception of deploy-staging since the code push was to themaster branch. GitLab CI/CD comes with an intuitive interface to help show what jobs and stages are running and what errors are occurring in the midst of the build. Below is the final version of the .gitlab-ci.yaml file. If you wish to test this out yourself, here is the <a href="https://gitlab.com/zh-examples/gitlabci-demo">link</a> to the example application.</p><pre>image: node:10.5.0</pre><pre>stages:<br>  - build<br>  - test<br>  - deploy</pre><pre>before_script:<br>  - npm install</pre><pre>build-min-code:<br>  stage: build<br>  script:<br>    - npm install<br>    - npm run minifier</pre><pre>run-unit-test:<br>  stage: test<br>  script:<br>    - npm run test</pre><pre>deploy-staging:<br>  stage: deploy<br>  script:<br>    - npm run deploy-stage<br>  only:<br>    - develop</pre><pre>deploy-production:<br>  stage: deploy<br>  script:<br>    - npm run deploy-prod<br>  only:<br>    - master</pre><h3>Conclusion</h3><p>The items covered above is a high-level overview of the capabilities that GitLab CI/CD can offer. GitLab CI/CD has the ability to have a more in-depth control of the automation of codebases by building and publishing Docker images to integrating with third-party tools. I hope that you found this tutorial helpful. Thanks for reading!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Join our community Slack and read our weekly Faun topics ⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oSdFkACJxs5iy1oR" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c80ee5ba0ae" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/beginner-friendly-introduction-to-gitlab-ci-cd-1c80ee5ba0ae">Beginner-Friendly Introduction to GitLab CI/CD</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>