Sentence Pair Score

Module for code related to scoring sentence pairs.

class yalign.sentencepairscore.SentencePairScore

Bases: yalign.datatypes.ScoreFunction

This class provides a score of how close two sentences are to being translations of each other.

SCORE_MULTIPLIER = 3
logistic_function(x)

See: http://en.wikipedia.org/wiki/Logistic_function

train(pairs, word_score_function)

Trains the sentence pair likelihood score using examples. pairs is an interable of SentencePair instances. word_score_function is an instance of ScoreFunction, perhaps even an instance of WordPairScore.

word_pair_score
class yalign.sentencepairscore.SentencePairScoreProblem(word_pair_score)

Bases: simpleai.machine_learning.models.ClassificationProblem

Provides the classifier attributes.

number_of_word_pair_scores(sentence_pair)

The number of the word pair scores divided by the number of words of the longest sentence.

ratio_of_character_count(sentence_pair)

The ratio of the sentence with the least characters over the sentence with the most characters.

sum_of_word_pair_scores(sentence_pair)

The sum of the word pair scores divided by the word count of the longest sentence.

target(sentence_pair)

Returns if these sentences are translations of each other