1 #ifndef __WFST_H__ // -*- tab-width: 2 mode: c++ -*-
4 #ifndef __DICTIONARY_H__
5 #include "dictionary.h"
20 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
21 #include <boost/shared_ptr.hpp>
24 #define SEGM_SEPARATOR 1
25 #define NGRAM_LENGTH 2
31 void segment_best(const Lattice
&,Segmentation
&final_seg
);
34 class Sections
: public std::vector
<Section
> {
36 Sentence
const * st
; /// This is used for operator<< only
37 void construct(const Lattice
&words
);
38 friend std::ostream
& operator << (std::ostream
&os
,const Sections
&s
);
43 Segmentor takes a Sentence, a Lattice and a range, then try to generate
44 all possible Segmentation.
54 Trace(boost::shared_ptr
<WordEntries
> _we
):s(_we
),next_syllable(0) {}
57 std::vector
<Trace
> segs
;
58 Lattice
const *_words
;
62 void init(const Lattice
&words
,
65 bool step(Segmentation
&seg
);
75 WFST():ngram_enabled(false) {}
77 void enable_ngram(bool enable
= true) { ngram_enabled
= enable
; }
79 void segment_best(const Lattice
&words
,Segmentation
&seps
);
80 void segment_best_no_fuzzy(const Lattice
&words
,Segmentation
&seps
);
81 void segment_all(const Sentence
&sent
,std::vector
<Segmentation
> &result
);
84 public: // for testing purpose
85 void generate_misspelled_words(const std::vector
<uint
> &pos
,
87 Segmentation
& final_seg
);
88 // variables needed when run wfst
89 Lattice
const *p_words
;