def testNormalizeCharacters(self): strTest = ur"a b c \uff1b , % œ" strGt = ur"a b c % oe" f = LMPreparationFormula() f.setText(strTest) f._normalizeUtf8() f._normalizePunctuation(self.allPunctList) self.assertEquals(strGt, f.getText())
def testNormalizePunctuationKeepInWords(self): f = LMPreparationFormula() f.setKeepNewWords(True) f.setText(u"".join("/ HES-SO und AdG/LA - auch im Winter / Sommer -")) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "HES-SO und AdG/LA auch im Winter Sommer" self.assertEquals(gt, strResult)
def testNormalizePunctuation(self): f = LMPreparationFormula() f.setText(u"".join(string.punctuation + u"‰")) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = u"$%&'@\u2030" self.assertEquals(gt, strResult) f.setLanguageId(1) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "dollars pourcent et ' at pour mille" self.assertEquals(gt, strResult)
def testNormalizePunctuation(self): f = LMPreparationFormula() f.setText(u"".join(string.punctuation + u"‰")) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = u"$%&'-/@\u2030" self.assertEquals(gt, strResult) f.setLanguageId(1) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "dollars pourcent et '-/ at pour mille" self.assertEquals(gt, strResult)
def testNormalizePunctuation(self): f = LMPreparationFormula() f.setText(u"".join(string.punctuation)) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "$%&' @" self.assertEquals(gt, strResult) f.setLanguageId(1) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "dollars pourcent et ' at" self.assertEquals(gt, strResult)
def testNormalizePunctuation(self): f = LMPreparationFormula() f.setText("".join(string.punctuation + "‰")) f.setExpandNumberInWords(False) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "$%&'-/@‰" self.assertEqual(gt, strResult) f.setLanguageId(1) f._normalizePunctuation(self.allPunctList) strResult = f.getText() gt = "dollars pourcent et '-/ at pour mille" self.assertEqual(gt, strResult)