Computation of F-Score measure. It is computed as
    F(E) = ( (W^2 + 1) * P(E) * R(E) ) / ( W^2 * P(E) + R(E) ), where:

    - P(E) is precision metrics of extract E.
    - R(E) is recall metrics of extract E.
    - W is a weighting factor that favours P(E) metrics
      when W > 1 and favours R(E) metrics when W < 1.

    If W = 1.0 (default value) basic F-Score is computed.
    It is equivalent to F(E) = (2 * P(E) * R(E)) / (P(E) + R(E)).

    :parameter iterable evaluated_sentences:
        Sentences of evaluated extract.
    :parameter iterable reference_sentences:
        Sentences of reference extract.
    :returns float:
        Returns 0.0 <= P(E) <= 1.0

def f_score(evaluated_sentences, reference_sentences, weight=1.0):
    """
    Computation of F-Score measure. It is computed as
    F(E) = ( (W^2 + 1) * P(E) * R(E) ) / ( W^2 * P(E) + R(E) ), where:

    - P(E) is precision metrics of extract E.
    - R(E) is recall metrics of extract E.
    - W is a weighting factor that favours P(E) metrics
      when W > 1 and favours R(E) metrics when W < 1.

    If W = 1.0 (default value) basic F-Score is computed.
    It is equivalent to F(E) = (2 * P(E) * R(E)) / (P(E) + R(E)).

    :parameter iterable evaluated_sentences:
        Sentences of evaluated extract.
    :parameter iterable reference_sentences:
        Sentences of reference extract.
    :returns float:
        Returns 0.0 <= P(E) <= 1.0
    """
    p = precision(evaluated_sentences, reference_sentences)
    r = recall(evaluated_sentences, reference_sentences)

    weight **= 2 # weight = weight^2
    denominator = weight * p + r
    if denominator == 0.0:
        return 0.0
    else:
        return ((weight + 1) * p * r) / denominator