zeeguu/core/language/strategies/word_history_difficulty_estimator.py
def recurrence_until_timestamp(cls, language: 'model.Language', user: 'model.User',max_timestamp):
        """
                This estimator computes the ratio of new words for a given user and language
                :param language: language of the text that needs to be estimated
                :param user: the user for which the difficulty estimation needs to be done
                :rtype: WordHistoryDifficultyEstimator
                :return: WordHistoryDifficultyEstimator with initialized user, language and word => score map
                        which can be used for determining scores for multiple articles for the same user and language
        """

        estimator = cls(language, user)

        # determine word scores
        words_history = WordInteractionHistory.find_all_word_histories_for_user_language(user, language)

        words_found = []
        event_history = []
        for wh in words_history:
            history = [event for event in wh.interaction_history if event.seconds_since_epoch <= max_timestamp]

            if len(history) > 0:
                words_found.append(wh.word.word)
                event_history.append(history)

        words_score = [0 for e in event_history]

        estimator.score_map = dict(zip(words_found, words_score))

        return estimator

                This estimator computes the ratio of new words for a given user and language
                :param language: language of the text that needs to be estimated
                :param user: the user for which the difficulty estimation needs to be done
                :rtype: WordHistoryDifficultyEstimator
                :return: WordHistoryDifficultyEstimator with initialized user, language and word => score map
                        which can be used for determining scores for multiple articles for the same user and language
        
This estimator computes the ratio of new words for a given user and language
This estimator computes the ratio of new words for a given user and language
def recurrence_until_timestamp(cls, language: 'model.Language', user: 'model.User',max_timestamp):
        estimator = cls(language, user)
        words_history = WordInteractionHistory.find_all_word_histories_for_user_language(user, language)
        words_found = []
        event_history = []
        for wh in words_history:
            history = [event for event in wh.interaction_history if event.seconds_since_epoch <= max_timestamp]
            if len(history) > 0:
                words_found.append(wh.word.word)
                event_history.append(history)
        words_score = [0 for e in event_history]
        estimator.score_map = dict(zip(words_found, words_score))
        return estimator
def recurrence_until_timestamp ( cls , language : 'model.Language' , user : 'model.User' , max_timestamp ) : estimator = cls ( language , user ) words_history = WordInteractionHistory . find_all_word_histories_for_user_language ( user , language ) words_found = [ ] event_history = [ ] for wh in words_history : history = [ event for event in wh . interaction_history if event . seconds_since_epoch <= max_timestamp ] if len ( history ) > 0 : words_found . append ( wh . word . word ) event_history . append ( history ) words_score = [ 0 for e in event_history ] estimator . score_map = dict ( zip ( words_found , words_score ) ) return estimator
This estimator computes the ratio of new words for a given user and language
This estimator computes the ratio of new words for a given user and language
"""
                This estimator computes the ratio of new words for a given user and language
                :param language: language of the text that needs to be estimated
                :param user: the user for which the difficulty estimation needs to be done
                :rtype: WordHistoryDifficultyEstimator
                :return: WordHistoryDifficultyEstimator with initialized user, language and word => score map
                        which can be used for determining scores for multiple articles for the same user and language
        """ # determine word scores
WordHistoryDifficultyEstimator with initialized user, language and word => score map
which can be used for determining scores for multiple articles for the same user and language
WordHistoryDifficultyEstimator with initialized user language and word = > score map which can be used for determining scores for multiple articles for the same user and language
WordHistoryDifficultyEstimator
cls
language
'model.Language'
language of the text that needs to be estimated
language of the text that needs to be estimated
user
'model.User'
the user for which the difficulty estimation needs to be done
the user for which the difficulty estimation needs to be done
max_timestamp