summaryrefslogtreecommitdiff
path: root/src/lattice.h
blob: 1177e7688297f28f475e882953d801ad1e65158c (plain)
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
#ifndef __LATTICE_H_
#define __LATTICE_H_

#include <string>
#include <vector>
#include "wordid.h"

struct LatticeArc {
  WordID label;
  double cost;
  int dist2next;
  LatticeArc() : label(), cost(), dist2next() {}
  LatticeArc(WordID w, double c, int i) : label(w), cost(c), dist2next(i) {}
};

class Lattice : public std::vector<std::vector<LatticeArc> > {
 public:
  Lattice() {}
  explicit Lattice(size_t t, const std::vector<LatticeArc>& v = std::vector<LatticeArc>()) :
   std::vector<std::vector<LatticeArc> >(t, v) {}
 
  // TODO add distance functions
};

struct LatticeTools {
  static bool LooksLikePLF(const std::string &line);
  static void ConvertTextToLattice(const std::string& text, Lattice* pl);
  static void ConvertTextOrPLF(const std::string& text_or_plf, Lattice* pl);
};

#endif