⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleclassngram.h

📁 这是一款很好用的工具包
💻 H
字号:
/* * SimpleClassNgram.h -- *	N-gram model over word classes that are unambiguous * * Copyright (c) 2002 SRI International.  All Rights Reserved. * * @(#)$Header: /home/srilm/devel/lm/src/RCS/SimpleClassNgram.h,v 1.2 2002/08/25 17:27:45 stolcke Exp $ * */#ifndef _SimpleClassNgram_h_#define _SimpleClassNgram_h_#include <stdio.h>#include "ClassNgram.h"/* * This is a specialization of ClassNgram where each word is member of * at most one class, and the classes expand to single words only. */class SimpleClassNgram: public ClassNgram{public:    SimpleClassNgram(Vocab &vocab, SubVocab &classVocab, unsigned order)	: ClassNgram(vocab, classVocab, order), haveClassDefError(false) { };    /*     * LM interface     */    LogP wordProb(VocabIndex word, const VocabIndex *context);    LogP wordProbRecompute(VocabIndex word, const VocabIndex *context);    void *contextID(VocabIndex word, const VocabIndex *context,							unsigned &length);    LogP contextBOW(const VocabIndex *context, unsigned length);    LogP sentenceProb(const VocabIndex *sentence, TextStats &stats);    /*     * I/O of class definitions     */    Boolean readClasses(File &file);protected:    LogP replaceWithClass(VocabIndex word, VocabIndex &clasz);    LogP replaceWithClass(const VocabIndex *words, VocabIndex *classes,					unsigned maxWords = maxWordsPerLine);					/* replace words with classes */    Boolean haveClassDefError;};#endif /* _SimpleClassNgram_h_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -