summaryrefslogtreecommitdiff
path: root/decoder/lattice.h
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-26 12:49:06 -0600
committerChris Dyer <redpony@gmail.com>2009-12-26 12:49:06 -0600
commit3f01c8ed777aec011181dc515d9d28aa81e8530b (patch)
tree93d9f6bfb9c26cb8334ca97b42b42a27dc1dc323 /decoder/lattice.h
parent9be811a26da86b87bac8696f155188d9a675e61b (diff)
increase intersection speed by a couple orders of magnitude for linear chain graphs
Diffstat (limited to 'decoder/lattice.h')
-rw-r--r--decoder/lattice.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/decoder/lattice.h b/decoder/lattice.h
index 71589b92..9a1932df 100644
--- a/decoder/lattice.h
+++ b/decoder/lattice.h
@@ -24,18 +24,22 @@ struct LatticeArc {
class Lattice : public std::vector<std::vector<LatticeArc> > {
friend void LatticeTools::ConvertTextOrPLF(const std::string& text_or_plf, Lattice* pl);
public:
- Lattice() {}
+ Lattice() : is_sentence_(false) {}
explicit Lattice(size_t t, const std::vector<LatticeArc>& v = std::vector<LatticeArc>()) :
- std::vector<std::vector<LatticeArc> >(t, v) {}
+ std::vector<std::vector<LatticeArc> >(t, v),
+ is_sentence_(false) {}
int Distance(int from, int to) const {
if (dist_.empty())
return (to - from);
return dist_(from, to);
}
-
+ // TODO this should actually be computed based on the contents
+ // of the lattice
+ bool IsSentence() const { return is_sentence_; }
private:
void ComputeDistances();
Array2D<int> dist_;
+ bool is_sentence_;
};
#endif