def getRating(self): termScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED interval = 100.00 - lowerLimitScore if termScore < lowerLimitScore: message = _(u'Frecuencia muy baja') level = Level.DANGER code = Code.INCREASE elif termScore < lowerLimitScore + interval * 0.25: message = _(u'Frecuencia Aceptable') level = Level.ACCEPTABLE code = Code.OK elif termScore < lowerLimitScore + interval * 1.01: message = _(u'Frecuencia óptima') level = Level.SUCCESS code = Code.OK else: message = _(u'Frecuencia excesiva') level = Level.DANGER code = Code.OVERUSED return TextAuditRating(TokenScoreRating.RATING_NAME, termScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def getRating(self): mandatoryBlockLengthScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED # interval = 100.00 - lowerLimitScore if mandatoryBlockLengthScore < lowerLimitScore: message = _( u'%s --> Es demasiado corto, revisa los terminos que te recomendamos' ) % self.mandatoryField level = Level.DANGER code = Code.SHORT elif mandatoryBlockLengthScore <= 100: message = _( u'%s --> La longitud es la correcta') % self.mandatoryField level = Level.SUCCESS code = Code.OK else: message = _(u'%s --> Es demasiado largo, la longitud es excesiva' ) % self.mandatoryField level = Level.DANGER code = Code.LONG return TextAuditRating(self.RATING_NAME, mandatoryBlockLengthScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def _getMandatoryBlocksRating(self, mandatoryBlocksScore, lowerLimitScore): message = None level = Level.DANGER code = Code.UNDEFINED interval = 100.00 - lowerLimitScore if mandatoryBlocksScore < lowerLimitScore: message = _( u'Usas muy pocos bloques de mandatory tokens, debes usar más, revisa las combinaciones recomendadas' ) level = Level.DANGER code = Code.ADD elif mandatoryBlocksScore < interval * 0.35: message = _( u'Deberías incluir algún bloque más de mandatory tokens, revisa las combinaciones recomendadas' ) level = Level.WARNING code = Code.ADD elif mandatoryBlocksScore < 125: message = _(u'Usas suficientes mandatory blocks') level = Level.SUCCESS code = Code.OK else: message = _( u'Estás usando demasiados mandatory blocks, google puede considerarlo SPAM y penalizarte' ) level = Level.DANGER code = Code.OVERUSED return TextAuditRating(MandatoryRating.RATING_NAME_BLOCKS, mandatoryBlocksScore, code, level, self.rawScoreBlock, self.lowerLimitBlock, self.upperLimitBlock, message)
def getRating(self): proofTermsScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED interval = 100.00 - lowerLimitScore if proofTermsScore < lowerLimitScore: message = _( u'Este texto no tiene los terminos necesarios para posicionarse en esta Query' ) level = Level.DANGER code = Code.ADD elif proofTermsScore < lowerLimitScore + interval: message = _( u'El contenido semántico de tu texto es óptimo para esta Query' ) level = Level.SUCCESS code = Code.OK else: message = _( u'Estás abusando de las palabras más utilizadas para esta Query. Para que Google considere que un texto versa sobre una temática, no es necesario que pongas todas las palabras que se te ocurran' ) level = Level.DANGER code = Code.OVERUSED return TextAuditRating(ProofTermsTokensRating.RATING_NAME, proofTermsScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def getRating(self): scoreBadWords = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED # message if scoreBadWords < max(7, self.textSeoDocument.getLenRawTokens() * 0.05): message = _(u'Tu texto tiene pocas faltas de ortografía') level = Level.SUCCESS code = Code.OK elif scoreBadWords < max( 15, self.textSeoDocument.getLenRawTokens() * 0.10): message = _(u'Tu texto tiene bastantes faltas de ortografía') level = Level.WARNING code = Code.IMPROVE else: message = _(u'Tu texto tiene demasiadas faltas de ortografía') level = Level.DANGER code = Code.IMPROVE return TextAuditRating( GrammarScoreRating.RATING_NAME, scoreBadWords, code, level, scoreBadWords, lowerLimit=0, upperLimit=int( max(7, self.textSeoDocument.getLenRawTokens() * 0.05)), message=message)
def getRating(self): mandatoryBlockTokensScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED # interval = 100.00 - lowerLimitScore if self.upperLimit == 1: message = _(u'%s --> Datos insuficientes para evaluar' ) % self.mandatoryField level = Level.ACCEPTABLE code = Code.UNDEFINED elif mandatoryBlockTokensScore < lowerLimitScore: message = _( u'%s --> Muy pocos mandatory, revisa los terminos que te recomendamos' ) % self.mandatoryField level = Level.DANGER code = Code.ADD elif mandatoryBlockTokensScore <= 100: message = _(u'%s --> Mandatory suficiente') % self.mandatoryField level = Level.SUCCESS code = Code.OK else: message = _(u'%s --> Demasiados mandatory terms en este bloque' ) % self.mandatoryField level = Level.DANGER code = Code.OVERUSED return TextAuditRating(self.RATING_NAME, mandatoryBlockTokensScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def getRating(self): proofTermsLengthScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED if proofTermsLengthScore < lowerLimitScore: message = _(u'La longitud del texto es insuficiente') level = Level.DANGER code = Code.SHORT else: message = _(u'Tu texto es suficientemente largo') level = Level.SUCCESS code = Code.OK return TextAuditRating( ProofTermsLengthRating.RATING_NAME, proofTermsLengthScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message )
def getRating(self): readabilityScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED interval = 100.00 - lowerLimitScore if readabilityScore < lowerLimitScore: message = _(u'Tu texto es demasiado confuso') level = Level.DANGER code = Code.IMPROVE elif readabilityScore < lowerLimitScore + interval * 0.85: message = _(u'Tu texto es normal, se entiende bien') level = Level.ACCEPTABLE code = Code.OK else: message = _(u'Tu texto es fácil de comprender') level = Level.SUCCESS code = Code.OK return TextAuditRating(ReadabilityRating.RATING_NAME, readabilityScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def getRating(self): scoreCategories = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED # message if scoreCategories < 50: message = _( u'Tu texto tiene poco contenido en común con los resultados arrojados por google' ) level = Level.DANGER code = Code.IMPROVE else: message = _(u'Tu texto habla sobre la materia') level = Level.SUCCESS code = Code.OK return TextAuditRating(self.name, scoreCategories, code, level, scoreCategories, lowerLimit=0, upperLimit=100, message=message)
def getRating(self): metaKeyWordsScore, _lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED if metaKeyWordsScore > 100.00: message = _( u'Demasiados Metakeywords. Reduce la lista o quítala directamente' ) level = Level.DANGER code = Code.LONG else: message = _(u'Tus metakeywords tienen una longitud aceptable.') level = Level.SUCCESS code = Code.OK return TextAuditRating(MetaKeyWordsLengthRating.RATING_NAME, metaKeyWordsScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def getRating(self): spamScore, lowerLimitScore = self._getScore() message = None level = Level.DANGER code = Code.UNDEFINED # interval = 100.00 - lowerLimitScore if spamScore < lowerLimitScore: message = _( u'Tu texto repite demasiadas veces los mismos términos') level = Level.DANGER code = Code.OVERREPETITION else: message = _(u'Tienes suficiente diversidad de términos') level = Level.SUCCESS code = Code.OK return TextAuditRating(SpamScore.RATING_NAME, spamScore, code, level, self.rawScore, self.lowerLimit, self.upperLimit, message)
def _getMandatoryTokensRating(self, mandatoryTokensScore, lowerLimitScore): message = None level = Level.DANGER code = Code.UNDEFINED if mandatoryTokensScore < lowerLimitScore: message = _(u'No usas mandatory Tokens, debes añadir más') level = Level.DANGER code = Code.ADD elif mandatoryTokensScore < 110: message = _(u'Usas suficientes mandatory tokens') level = Level.SUCCESS code = Code.OK else: message = _( u'Estás usando demasiados mandatory tokes, google puede considerarlo SPAM y penalizarte' ) level = Level.DANGER code = Code.OVERUSED return TextAuditRating(MandatoryRating.RATING_NAME_TOKENS, mandatoryTokensScore, code, level, self.rawScoreTokens, self.lowerLimitTokens, self.upperLimitTokens, message)
from utils.translation import gettext_noop as _ # Default language code. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = "en-us" LANGUAGES = (("en", _("English")), ("ru", _("Russian")), ("uk", _("Ukrainian")))