nltk.translate.PhraseTable

class nltk.translate.PhraseTable[source]

Bases: object

In-memory store of translations for a given phrase, and the log probability of the those translations

__init__()[source]
translations_for(src_phrase)[source]

Get the translations for a source language phrase

Parameters

src_phrase (tuple(str)) – Source language phrase of interest

Returns

A list of target language phrases that are translations of src_phrase, ordered in decreasing order of likelihood. Each list element is a tuple of the target phrase and its log probability.

Return type

list(PhraseTableEntry)

add(src_phrase, trg_phrase, log_prob)[source]
Parameters

log_prob (float) – Log probability that given src_phrase, trg_phrase is its translation