softcount: tolerate zero ngrams
[vspell.git] / libvspell / posgen.h
blob22f46b6c7f858f7ab5c4db52951fcaea28e91c77
1 #ifndef __POSGEN_H__ // -*- tab-width: 2 mode: c++ -*-
2 #define __POSGEN_H__
4 #ifndef __SPELL_H__
5 #include "spell.h"
6 #endif
8 #ifndef __VECTOR__
9 #include <vector>
10 #endif
12 class PosGen
14 private:
15 uint ii,n;
16 int i;
17 std::vector<uint> pos;
18 bool run;
20 uint len;
22 public:
23 /**
24 initialization C(n,k)
25 len_: n
26 n_: k
28 void init(uint len_,uint n_);
30 /**
31 On each call, it fills pos with positions.
32 Notice that pos.size() may be larger than len.
33 But len is used instead pos.size().
35 bool step(std::vector<uint> &pos,uint &len);
36 void done();
40 /**
41 Position generator.
44 class Generator
46 private:
47 PosGen pgen;
49 public:
50 void init(const Sentence &st);
51 bool step(std::vector<uint> &pos,uint &len);
52 void done();
55 #endif