Skip to content

Instantly share code, notes, and snippets.

@language-engineering
Created October 3, 2012 16:51
Show Gist options
  • Select an option

  • Save language-engineering/3828258 to your computer and use it in GitHub Desktop.

Select an option

Save language-engineering/3828258 to your computer and use it in GitHub Desktop.
from sussex_nltk.stats import expected_sentiment_tokens, normalised_lexical_diversity, prob_short_sents
#Ensure that you correctly pass either a list of tokens, or a list of sentences (see comments below)
#This function requires a list of tokens acquired from the "sample_words_by_sents" function on a corpus reader
print "Expected number of sentiment tokens per 500 tokens: %s" % expected_sentiment_tokens(tokens)
#This function requires a list of tokens acquired from the "sample_words_by_sents" function
print "Normalised lexical diversity: %s" % normalised_lexical_diversity(tokens)
#This function requires a list of sentences, where each sentence is a list of tokens
#which is acquired using the "sample_sents" function on a corpus reader
print "Probability of short sentences: %s" % prob_short_sents(sents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment