.. index:: single: ranker_common
.. _ranker_common/0:

.. rst-class:: right

**category**

``ranker_common``
=================

Shared predicates for ranker score access, diagnostics, and export.

| **Availability:** 
|    ``logtalk_load(ranking_protocols(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-04-30

| **Compilation flags:**
|    ``static``


| **Implements:**
|    ``public`` :ref:`ranker_protocol <ranker_protocol/0>`
| **Extends:**
|    ``public`` :ref:`options <options/0>`
| **Uses:**
|    :ref:`avltree <avltree/0>`
|    :ref:`format <format/0>`
|    :ref:`list <list/0>`
|    :ref:`type <type/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`ranker_protocol/0::check_ranker/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`ranker_protocol/0::diagnostic/2`  :ref:`ranker_protocol/0::diagnostics/2`  :ref:`ranker_protocol/0::export_to_clauses/4`  :ref:`ranker_protocol/0::export_to_file/4`  :ref:`ranker_protocol/0::learn/2`  :ref:`ranker_protocol/0::learn/3`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`ranker_protocol/0::print_ranker/1`  :ref:`ranker_protocol/0::rank/3`  :ref:`ranker_protocol/0::ranker_options/2`  :ref:`ranker_protocol/0::scores/2`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  :ref:`ranker_protocol/0::valid_ranker/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

(no local declarations; see entity ancestors if any)

Protected predicates
--------------------

.. index:: ranker_scores_data/2
.. _ranker_common/0::ranker_scores_data/2:

``ranker_scores_data/2``
^^^^^^^^^^^^^^^^^^^^^^^^

Hook predicate that importing ranker implementations must define in order to expose the learned item-score pairs on the ranker native numeric scale.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``ranker_scores_data(Ranker,Scores)``
| **Mode and number of proofs:**
|    ``ranker_scores_data(+compound,-list(pair))`` - ``one``


------------

.. index:: ranker_diagnostics_data/2
.. _ranker_common/0::ranker_diagnostics_data/2:

``ranker_diagnostics_data/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hook predicate that importing ranker implementations must define in order to expose diagnostics metadata.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``ranker_diagnostics_data(Ranker,Diagnostics)``
| **Mode and number of proofs:**
|    ``ranker_diagnostics_data(+compound,-list(compound))`` - ``one``


------------

.. index:: ranker_export_template/4
.. _ranker_common/0::ranker_export_template/4:

``ranker_export_template/4``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hook predicate that importing ranker implementations must define in order to expose the exported ranker template for a given functor.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``ranker_export_template(Dataset,Ranker,Functor,Template)``
| **Mode and number of proofs:**
|    ``ranker_export_template(+object_identifier,+compound,+atom,-callable)`` - ``one``


------------

.. index:: ranker_term_template/2
.. _ranker_common/0::ranker_term_template/2:

``ranker_term_template/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^

Hook predicate that importing ranker implementations must define in order to expose the learned ranker term template used by pretty-printing helpers.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``ranker_term_template(Ranker,Template)``
| **Mode and number of proofs:**
|    ``ranker_term_template(+compound,-callable)`` - ``one``


------------

.. index:: print_ranker_template/1
.. _ranker_common/0::print_ranker_template/1:

``print_ranker_template/1``
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Pretty-printing helper predicate used by importing ranker implementations to show the learned ranker term template.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``print_ranker_template(Ranker)``
| **Mode and number of proofs:**
|    ``print_ranker_template(+compound)`` - ``one``


------------

.. index:: valid_ranker_metadata/2
.. _ranker_common/0::valid_ranker_metadata/2:

``valid_ranker_metadata/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^

True when the diagnostics list contains the expected model identifier, a valid effective options list, and a structurally valid dataset summary.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``valid_ranker_metadata(Model,Diagnostics)``
| **Mode and number of proofs:**
|    ``valid_ranker_metadata(+atom,+list(compound))`` - ``zero_or_one``


------------

.. index:: valid_item_value_pairs/2
.. _ranker_common/0::valid_item_value_pairs/2:

``valid_item_value_pairs/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

True when the second argument is an ordered list of unique ``Item-Value`` pairs aligned with the first argument item list.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``valid_item_value_pairs(Items,Pairs)``
| **Mode and number of proofs:**
|    ``valid_item_value_pairs(+list,+list(pair))`` - ``zero_or_one``


------------

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

