예제 #1
0
 def get_additional(bwo, **kwargs):
     """Return formatted data of object."""
     from inspire.modules.predicter.utils import get_classification_from_task_results
     keywords = get_classification_from_task_results(bwo)
     results = bwo.get_tasks_results()
     prediction_results = results.get("arxiv_guessing", {})
     if prediction_results:
         prediction_results = prediction_results[0].get("result")
     return render_template(
         'workflows/styles/harvesting_record_additional.html',
         object=bwo,
         keywords=keywords,
         score=prediction_results.get("max_score"),
         decision=prediction_results.get("decision")
     )
예제 #2
0
    def _filter_core_keywords(obj, eng):
        from inspire.utils.knowledge import check_keys
        from inspire.modules.predicter.utils import (
            get_classification_from_task_results,
            update_classification_in_task_results,
        )

        result = get_classification_from_task_results(obj)
        if result is None:
            return
        filtered_core_keywords = {}
        for core_keyword, times_counted in result.get("Core keywords").items():
            if not check_keys(filter_kb, [core_keyword]):
                filtered_core_keywords[core_keyword] = times_counted
        result["Filtered Core keywords"] = filtered_core_keywords
        update_classification_in_task_results(obj, result)
예제 #3
0
def is_record_relevant(obj, *args, **kwargs):
    """Shall we halt this workflow for potential acceptance or just reject?"""
    from inspire.modules.predicter.utils import (
        get_classification_from_task_results,
    )
    results = obj.get_tasks_results()
    prediction_results = results.get("arxiv_guessing", {})
    classification_results = get_classification_from_task_results(obj)

    if prediction_results and classification_results:
        prediction_results = prediction_results[0].get("result")
        score = prediction_results.get("max_score")
        decision = prediction_results.get("decision")
        core_keywords = classification_results.get("Core keywords")
        if decision.lower() == "rejected" and score > 0 and \
                len(core_keywords) == 0:
            return False
    return True