I’m looking to implement the pLSI algorithm in R. I found this python code, but I am stuck in a few places, like line #8 for termID, value in docTermDic[docID].iteritems():. In this case I don’t understand how to implement both termID & value inside a for loop, and what docTermDic[docID].iteritems() is.
Is there any tool available using which I can extract the algo or the pseudocode so as to enable me to code it up myself?
Well, python is designed to look like some kind of pseudocode. It looks like what you’re asking is something that will scan your brain in order to find what you don’t understand and explain it you. I suppose it doesn’t exist.
For the specific part of the question about dictionaries :
this will iterate through all pairs (key,value) in the dict, and affect both key and value. You can’t do it in every language. If your language can’t do this, just do something like :
iterate through all keys, and affect the value as first instruction.