00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.cs.cmu.edu/~lemur/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #ifndef _ONESTEPMARKOVCHAIN_HPP 00014 #define _ONESTEPMARKOVCHAIN_HPP 00015 00017 00022 #include "Index.hpp" 00023 #include "WeightedIDSet.hpp" 00024 00025 class OneStepMarkovChain { 00026 public: 00028 OneStepMarkovChain(WeightedIDSet &docSet, Index &homeIndex, double *wdNorm, double stopProbAlpha); 00029 ~OneStepMarkovChain(); 00030 00032 00038 00039 void startFromWordIteration(int toWord); 00040 bool hasMoreFromWord() { 00041 while (itPos <= ind.termCountUnique() && fromWordPr[itPos]==0) 00042 itPos++; 00043 return (itPos<= ind.termCountUnique()); 00044 } 00046 void nextFromWordProb(int &fromWord, double &prob); 00048 00049 private: 00050 void computeFromWordProb(int toWord); 00051 Index &ind; 00052 double alpha; 00053 int *dSet; 00054 double *norm; 00055 double *fromWordPr; 00056 int itPos; 00057 int curToWord; 00058 }; 00059 00060 00061 #endif /* _ONESTEPMARKOVCHAIN_HPP */