def __init__(self, text): """Init Paragraph. param text: tring to split type text: str """ self.text = text log.debug('Init Paragraph: %s' % self.text)
def __init__(self, title, text): """Init Essay. param title: tring to split type title: str param text: body essay type text: str """ self.title = title self.text = text self.paragraphs = [Paragraph(p) for p in get_paragraphs(text)] log.debug('Init Essay: %s' % self.title)
def paragraphs_count(self): """Paragraph count.""" log.debug("Get the paragraphs count in the essay.") return len(self.paragraphs)
def words_count(self): """Words count.""" log.debug("Get the words count in the essay.") return sum((p.words_count for p in self.paragraphs))
def chars_count(self): """Characters count.""" log.debug("Get the characters count in the essay.") return len(self.text)
def size(self): """Paragraph size.""" log.debug("Get paragraph size.") return len(self.text)
def sentences(self): """List of sentences.""" log.debug("Get the sentences in the paragraph.") return get_sentences(self.text)
def words(self): """List of words.""" log.debug("Get the words in the paragraph.") return tokenize(self.text)