Exemplo n.º 1
0
 def testExpandAbbreviations(self):
     f = LMPreparationFormula()
     for languageId, v in ABBREVIATIONS.items():
         f.setLanguageId(languageId)
         for abbr, gt in v.items():
             f.strText = abbr
             f._expandAbbreviations()
             self.assertEquals(gt.encode('utf-8'), f.strText.encode('utf-8'))
Exemplo n.º 2
0
 def testExpandAbbreviations(self):
     f = LMPreparationFormula()
     for languageId, v in ABBREVIATIONS.items():
         f.setLanguageId(languageId)
         for abbr, gt in v.items():
             f.strText = abbr
             f._expandAbbreviations()
             self.assertEquals(gt.encode('utf-8'), f.strText.encode('utf-8'))
Exemplo n.º 3
0
    def _getAbbreviationsDict():
        """Get the abbreviations dictionary with keys
           encoded in byte string for comparison.
        """
        if len(LMPreparationFormula.abbreviationsDict.keys()) > 0:
            return LMPreparationFormula.abbreviationsDict

        aDict = {}
        for lang in ABBREVIATIONS.keys():
            if lang not in aDict:
                aDict[lang] = {}
            for k, v in ABBREVIATIONS[lang].items():
                aDict[lang][k.encode("utf-8")] = v

        LMPreparationFormula.abbreviationsDict = aDict
        return LMPreparationFormula.abbreviationsDict
Exemplo n.º 4
0
    def _getAbbreviationsDict():
        """Get the abbreviations dictionary with keys
           encoded in byte string for comparison.
        """
        if len(LMPreparationFormula.abbreviationsDict.keys()) > 0:
            return LMPreparationFormula.abbreviationsDict

        aDict = {}
        for lang in ABBREVIATIONS.keys():
            if lang not in aDict:
                aDict[lang] = {}
            for k, v in ABBREVIATIONS[lang].items():
                aDict[lang][k.encode('utf-8')] = v

        LMPreparationFormula.abbreviationsDict = aDict
        return LMPreparationFormula.abbreviationsDict