Python script to find word frequencies of a given document
Question: I am looking for a simple script that can find frequencies of words for a
given document (probably by using portable stemmer).

Is there any library or simple script that does this process?


Answer: use [nltk](http://www.nltk.org/)

    
    
    import nltk
    
    YOUR_STRING = "Your words"
    
    words = [w for w in YOUR_STRING.split()]
    freq_dist = nltk.FreqDist(words)
    
    tokens = freq_dist.keys()
    
    #50 most frequent
    most_frequent = tokens[:50]
    
    #50 least frequent
    least_frequent = tokens[-50:]
    

