57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
|
|
||
|
#include "../lib/tfti.h"
|
||
|
#include "../lib/word.h"
|
||
|
|
||
|
#include <sys/timeb.h>
|
||
|
|
||
|
/**************************************************************
|
||
|
* Zawiera definicje klasy Guess. *
|
||
|
* *
|
||
|
* Klasa ta pozwala na okreslenie opisu slowa nie *
|
||
|
* znajdujacego sie w slowniku wraz z prawdopodobienstwem *
|
||
|
* jego wystapienia. *
|
||
|
*************************************************************/
|
||
|
|
||
|
class Guess {
|
||
|
|
||
|
public:
|
||
|
|
||
|
// nazawa pliku slownika w parametrze
|
||
|
Guess(const char* suf_file);
|
||
|
|
||
|
// zwraca tablice opisow slowa wraz z prawdopodobienstwem ich wystapienia
|
||
|
int ana(const char* word, Words& result);
|
||
|
|
||
|
long time_overall;
|
||
|
|
||
|
private:
|
||
|
|
||
|
// sufiksy
|
||
|
TFTiv<char, char> _suf;
|
||
|
|
||
|
// prefiksy
|
||
|
TFTiv<char, char> _pref;
|
||
|
|
||
|
//odwraca ciag znakow
|
||
|
int reverse(const char* src, char* dest) {
|
||
|
|
||
|
// assert((src != NULL) && (dest != NULL));
|
||
|
|
||
|
const char* c = src;
|
||
|
|
||
|
int len = strlen(src);
|
||
|
|
||
|
for (int i=1; i<=len; ++i) {
|
||
|
dest[i-1] = src[len-i];
|
||
|
}
|
||
|
|
||
|
dest[len] = '\0';
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
//dodaje nowy element do tablicy WordsProb
|
||
|
int add_word_prob(Words& tab, const char* word, const char* path, unsigned len, int source);
|
||
|
|
||
|
};
|