• Skip to primary navigation
  • Skip to main content

DebKR

To the Stars

  • About
  • Blog
  • Contact

descending

Building a Tagging Engine in Python using Dictionaries

Building a Tagging Engine in Python using Dictionaries

01/05/2016 By debkr

tagging-engineI started playing around building a Tagging Engine in Python using Lists but now I’ve studied a bit more – particularly Dictionaries – I want to see how I can perfect what I was working on. Here are a couple of key things I added/changed in this program over the version I was working on earlier.

1. Using a dictionary instead of lists for faster counting and simpler recall. This is straight forward, using the get method as taught by Dr. Chuck (see Coding 101 part 7 for more details).

words = dict()
for word in wordlist :
____if word in excluded : continue
____words[word] = words.get(word,0) + 1

[Read more…] about Building a Tagging Engine in Python using Dictionaries

Filed Under: Blog, Personalised Training Plan, Programming, Programming Projects Tagged With: ==, count, descending, dictionary, iteration, len(), length, list, loop, order, print, program, range, raw_input, user, variable, working directory

Copyright © 2016–2025 · Powered by WordPress On Genesis Framework · Log in

  • Writing
  • Developing
  • Consulting