def __init__(self, text, locale='en_GB'): TextAnalyzer.__init__(self, text, locale) self.setTextScores() self.reading_ease = 206.835 - (1.015 * self.scores['sentlen_average'] ) - (84.6 * self.scores['wordlen_average']) self.min_age = None
def __init__(self, text, locale='en_GB'): TextAnalyzer.__init__(self,text,locale) self.setTextScores() self.avi = 0 self.readingindex = 0 self.setReadingIndex() self.setAvi() self.setMinimumAge()
def __init__(self, text, locale='en_GB'): TextAnalyzer.__init__(self, text, locale) self.setTextScores() self.avi = 0 self.readingindex = 0 self.setReadingIndex() self.setAvi() self.setMinimumAge()
def __init__(self, text, locale='en_GB', simplewordlist=[]): TextAnalyzer.__init__(self, text, locale) self.setSimpleWordsList(simplewordlist) self.setTextScores() self.readingindex = 0 self.us_grade = 0 self.setReadingIndex() self.setGrade() self.min_age = getMinimumAgeFromUsGrade(self.us_grade)
def __init__(self, text, locale='en_GB', simplewordlist=[]): TextAnalyzer.__init__(self,text,locale) self.setSimpleWordsList(simplewordlist) self.setTextScores() self.readingindex = 0 self.us_grade = 0 self.setReadingIndex() self.setGrade() self.min_age = getMinimumAgeFromUsGrade(self.us_grade)
def __init__(self, text, locale='en_GB'): TextAnalyzer.__init__(self,text,locale) self.setTextScores() self.us_grade = 0 self.setGrade() self.min_age = getMinimumAgeFromUsGrade(self.us_grade)
def __init__(self, text, locale='en_GB'): TextAnalyzer.__init__(self,text,locale) self.setTextScores() self.reading_ease = 206.835 - ( 1.015 * self.scores['sentlen_average'] ) - ( 84.6 * self.scores['wordlen_average'] ) self.min_age = None
def test_short_locale(self): with self.assertRaises(LookupError): t = TextAnalyzer("some text","e")
def test_incorrect_locale(self): with self.assertRaises(LookupError): t = TextAnalyzer("some text","bad_locale")
def test_tokenize_language_exotic(self): t = TextAnalyzer("some text","zu_ZA") self.assertEqual(t.tokenize_language,"english","default tokenize_language should be english")
def test_tokenize_language_custom(self): t = TextAnalyzer("some text","nl_NL") self.assertEqual(t.tokenize_language,"dutch","set tokenize_language should be dutch")
def test_bad_simpleword_list(self): t = TextAnalyzer("some text") with self.assertRaises(ValueError): t.setSimpleWordsList("this string")
def test_correct_locale(self): try: t = TextAnalyzer("some text","nl_NL") except: fk = None self.assertTrue(hasattr(t,"scores"),"text analyzer not made with non default but correct locale")