labs-edaf30/lab2/dictionary.h
2024-11-21 08:50:09 +01:00

29 lines
816 B
C++

#pragma once
#include "word.h"
#include <filesystem>
#include <string>
#include <vector>
#define MAXLEN 30
// using std::vector;
using std::filesystem::path;
class Dictionary {
public:
Dictionary();
void add_trigram_suggestions(std::vector<std::string> &suggestions,
const std::string &word) const;
void rank_suggestions(std::vector<std::string> &suggestions,
const std::string &word) const;
void trim_suggestions(std::vector<std::string> &suggestions,
const std::string &word) const;
bool contains(const std::string &word) const;
std::vector<std::string> get_suggestions(const std::string &word) const;
int slurp(path p);
int spit(path p);
private:
std::vector<Word> words[MAXLEN];
};