def getRealCosts(corpus): """ Retorna as funcoes de custo unigrama, bigrama e possiveis fills obtidas a partir do corpus.""" _realUnigramCost, _realBigramCost, _possibleFills = None, None, None if _realUnigramCost is None: print('Training language cost functions [corpus: ' + corpus + ']... ') _realUnigramCost, _realBigramCost = util.makeLanguageModels(corpus) if corpus == "corpus.txt": _possibleFills = util.makeInverseRemovalDictionary(corpus, 'aeiou') else: _possibleFills = util.makeInverseRemovalDictionary( corpus, 'aáàãâeéêiíoõôóuú') print('Done!') return _realUnigramCost, _realBigramCost, _possibleFills
def getRealCostspt(corpus='corpuspt.txt'): """ Retorna as funcoes de custo unigrama, bigrama e possiveis fills obtidas a partir do corpus em portugues.""" _realUnigramCost, _realBigramCost, _possibleFills = None, None, None if _realUnigramCost is None: print('Treinamento em portugues do custo da funcão [corpus: ' + corpus + ']... ') _realUnigramCost, _realBigramCost = util.makeLanguageModels(corpus) _possibleFills = util.makeInverseRemovalDictionary(corpus, 'aeiou') print('Done!') return _realUnigramCost, _realBigramCost, _possibleFills