espnet.nets.scorers.ngram.NgramFullScorer
Less than 1 minute
espnet.nets.scorers.ngram.NgramFullScorer
class espnet.nets.scorers.ngram.NgramFullScorer(ngram_model, token_list)
Bases: Ngrambase
, BatchScorerInterface
Fullscorer for ngram.
Initialize Ngrambase.
- Parameters:
- ngram_model – ngram model path
- token_list – token list from dict or model.json
score(y, state, x)
Score interface for both full and partial scorer.
- Parameters:
- y – previous char
- state – previous state
- x – encoded feature
- Returns: Tuple of : batchfied scores for next token with shape of (n_batch, n_vocab) and next state list for ys.
- Return type: tuple[torch.Tensor, List[Any]]