fcs.server.data_base_policy_module

This module describes Task Server’s behavior during link database key generation and application of user’s feedback.

class AbstractPolicyModule
static generate_key(key, priority)

Generates a key with information about the priorities of given links.

Parameters:
  • key (int) – Page URL.
  • priority (int) – Page priority.
static calculate_priority(priority, feedback_rating, depth)

Calculates new priority of page according to rating sent in user’s feedback.

Parameters:
  • priority (int) – Current priority of page.
  • feedback_rating (int) – Rating sent by user in feedback.
  • depth (int) – Page depth in comparison with original site affected by feedback.
static get_feedback_propagation_depth()

Returns maximal depth of feedback propagation - how many levels of pages retrieved from original page can have its priority changed.

class SimplePolicyModule

Implementation of AbstractPolicyModule.

MIN_PRIORITY

Minimal link priority.

MAX_PRIORITY

Maximal link priority.

DEFAULT_PRIORITY

Default link priority.

FEEDBACK_PRIORITY_MAPPING

Dict with mapping between link rating sent in feedback and its priority.

static generate_key(key, priority)

Generates a key with information about the priorities of given links.

Parameters:
  • key (int) – Page URL.
  • priority (int) – Page priority.
Returns:

Link database key.

Return type:

string

static get_feedback_propagation_depth()

Returns maximal depth of feedback propagation - how many levels of pages retrieved from original page can have its priority changed. Maximal depth is always 3.

Returns:Maximal depth of feedback propagation (always 3).
Return type:int
static calculate_priority(priority, feedback_rating, depth)

Calculates new priority of page according to rating sent in user’s feedback.

Parameters:
  • priority (int) – Current priority of page.
  • feedback_rating (int) – Rating sent by user in feedback.
  • depth (int) – Page depth in comparison with original site affected by feedback.
Returns:

New priority of page.

Return type:

int