category

language_detection_scoring

Shared portable language detection scoring predicates.

Availability:
logtalk_load(language_detection(loader))
Author: Paulo Moura
Version: 1:1:0
Date: 2026-10-15
Compilation flags:
static
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

(none)

Protected predicates

cosine_similarity/3

Computes cosine similarity between two lexically sorted sparse count vectors.

Compilation flags:
static
Template:
cosine_similarity(Counts1,Counts2,Similarity)
Mode and number of proofs:
cosine_similarity(+list(pair(atom,positive_integer)),+list(pair(atom,positive_integer)),-float) - one

normalize_scores/2

Normalizes non-negative scores to sum to one or returns an empty list when their total is zero.

Compilation flags:
static
Template:
normalize_scores(RawScores,Scores)
Mode and number of proofs:
normalize_scores(+list(pair(atom,number)),-list(pair(atom,float))) - one

squared_norm/2

Computes the squared norm of a sparse count vector.

Compilation flags:
static
Template:
squared_norm(Counts,SquareSum)
Mode and number of proofs:
squared_norm(+list(pair(atom,positive_integer)),-float) - one

cosine_similarity/5

Computes cosine similarity using precomputed squared norms.

Compilation flags:
static
Template:
cosine_similarity(Counts1,SquareSum1,Counts2,SquareSum2,Similarity)
Mode and number of proofs:
cosine_similarity(+list,+float,+list,+float,-float) - one

Private predicates

(none)

Operators

(none)