about summary refs log tree commit diff stats
path: root/freevars.cpp
blob: 4429d00ca36ae6b8217f6f7a6d58dc90f528d3f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "freevars.h"
#include <fstream>
#include "kgramstats.h"

freevar::freevar(word& w, std::string file) : w(w)
{
  std::ifstream infile(file);
  if (infile)
  {
    std::string line;
    while (getline(infile, line))
    {
      instances.insert(line);
      w.forms.add(line);
    }
  }
}

bool freevar::check(std::string f) const
{
  return (instances.count(f) == 1);
}

void freevar::add(std::string f)
{
  instances.insert(f);
}

word& freevar::getWord()
{
  return w;
}