예제 #1
0
def svgTextFromCnnUrl(cnnurl, N=8, nGram=2, width=740, height=500):
    t = time()
    p = posts.getPostsFromUrl(cnnurl)
    print str(time()-t) + " seconds to fetch " + str(len(p)) + " unfiltered posts from disqus"
    t = time()
    # currently just displays the most common bigrams
    common_ngrams = stats.mostCommonNGramsFromPosts(p,N)
    common_ngrams = stats.nGramsListToTokenStringsList(common_ngrams[nGram-1])
    print str(time()-t) + " seconds to parse all the comments"
    s = svggen.commonTokensListToSVGImage(common_ngrams, width, height)
    return s
예제 #2
0
def svgTextFromCnnUrl(cnnurl, p=None, width=1000, height=1500):
    common_ngrams = commonNGrams(cnnurl, p)
    #print str(time()-t) + " seconds to parse all the comments"
    s = svggen.commonTokensListToSVGImage(common_ngrams, width, height)
    return s