Tasks completed

  • Debug asyncio gather and coroutines in Python.
  • Shortened the record time and used the asyncio.gather function to run them in parallel. This change allowed updates to the word counts dictionary along with getting the top words on the list.
  • We fixed all words to lowercase. This is helpful to prevent the following: [WordPair(word='Fish', count=6)] and [WordPair(word='fish', count=11)]

Code snippet:

async def getWords(wt):
    words = wt.getTopWordsTracker()
    print(f"time: {time.strftime('%X')}")
    print(words)

async def main():
    wt = WordTracker()
    while True:
        L = await asyncio.gather(wt.recordWordsFromMicrophone(), getWords(wt))
        print(L)

Example output:

time: 15:25:54
[[WordPair(word='blue', count=2), WordPair(word='goldfish', count=2),
WordPair(word='new', count=2), WordPair(word="we're", count=2),
WordPair(word='going', count=2), WordPair(word='read', count=2),
WordPair(word='Red', count=2), WordPair(word='this', count=2),
WordPair(word='has', count=2), WordPair(word='little', count=2),
WordPair(word='we', count=2), WordPair(word="don't", count=2),
WordPair(word='know', count=2), WordPair(word='say', count=2),
WordPair(word='about', count=2), WordPair(word='car', count=2),
WordPair(word='multiple', count=2), WordPair(word='times', count=2),
WordPair(word='and', count=2), WordPair(word='not', count=2)],
[WordPair(word='Blue', count=3), WordPair(word='to', count=3),
WordPair(word='cars', count=3), WordPair(word='fishing', count=3),
WordPair(word='like', count=3), WordPair(word='a', count=3)],
[WordPair(word='one', count=4), WordPair(word='star', count=4),
WordPair(word='it', count=4), WordPair(word='are', count=4),
WordPair(word='what', count=4)], [WordPair(word='I', count=5)],
[WordPair(word='Fish', count=6)], [WordPair(word='fish', count=11)]]
[None, None]

Future prework

  • Read up and twitchio documentation and how to send a message. Also maybe reach out to timeenjoyed on how she did the time bot.

Future work

  • Call the chat bot and word tracker separately without blocking each other.
  • Use GitHub integrations to run Python test with Poetry.
  • Create blog post of cloud storage and load balancer experience for a static website (hugo). Also, use Colemak…