~ubuntu-branches/ubuntu/trusty/sunpinyin/trusty-proposed

« back to all changes in this revision

Viewing changes to src/pinyin/hunpin_seg.h

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120330153155-ep92npxp3mucniyt
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
class CHunpinSegmentor : public IPySegmentor
26
26
{
27
27
public:
28
 
    CHunpinSegmentor (EShuangpinType  shpType); 
29
 
        
30
 
        virtual TSegmentVec& getSegments (bool) {return m_segs;}
31
 
 
32
 
        
33
 
    virtual const wstring& getInputBuffer () {return m_inputBuf;}
34
 
        
35
 
    virtual const char* getSylSeps () {return "'";}
36
 
        
37
 
    virtual unsigned push (unsigned ch);
38
 
    virtual unsigned pop ();
39
 
    virtual unsigned insertAt (unsigned idx, unsigned ch);
40
 
    virtual unsigned deleteAt (unsigned idx, bool backward=true);
41
 
    virtual unsigned clear (unsigned from=0);
42
 
        
43
 
    virtual unsigned updatedFrom () {return m_updatedFrom;}
44
 
        
 
28
    CHunpinSegmentor (EShuangpinType shpType);
 
29
 
 
30
    virtual TSegmentVec& getSegments(bool) { return m_segs; }
 
31
 
 
32
 
 
33
    virtual const wstring& getInputBuffer() { return m_inputBuf; }
 
34
 
 
35
    virtual const char* getSylSeps() { return "'"; }
 
36
 
 
37
    virtual unsigned push(unsigned ch);
 
38
    virtual unsigned pop();
 
39
    virtual unsigned insertAt(unsigned idx, unsigned ch);
 
40
    virtual unsigned deleteAt(unsigned idx, bool backward = true);
 
41
    virtual unsigned clear(unsigned from = 0);
 
42
 
 
43
    virtual unsigned updatedFrom() { return m_updatedFrom; }
 
44
 
45
45
    bool load(const char * pyTrieFileName);
46
 
    
47
 
    void setGetFuzzySyllablesOp (CGetFuzzySyllablesOp<CPinyinData> *op) {m_pGetFuzzySyllablesOp = op;}
48
 
 
49
 
        
50
 
        
51
 
        
 
46
 
 
47
    void setGetFuzzySyllablesOp(CGetFuzzySyllablesOp<CPinyinData> *op) {
 
48
        m_pGetFuzzySyllablesOp = op; }
 
49
 
 
50
 
 
51
 
 
52
 
52
53
private:
53
 
    inline unsigned _push  (unsigned ch);
54
 
    inline unsigned _clear (unsigned from);
55
 
    inline void _addFuzzySyllables (TSegment &seg);
56
 
    inline unsigned _updateWith (const std::string& new_pystr, unsigned from = UINT_MAX);
57
 
    inline void _locateSegment (unsigned idx, unsigned &strIdx, unsigned &segIdx);
58
 
        int _encode(const char* buf,int ret);
 
54
    inline unsigned _push(unsigned ch);
 
55
    inline unsigned _clear(unsigned from);
 
56
    inline void _addFuzzySyllables(TSegment &seg);
 
57
    inline unsigned _updateWith(const std::string& new_pystr,
 
58
                                unsigned from = UINT_MAX);
 
59
    inline void _locateSegment(unsigned idx, unsigned &strIdx, unsigned &segIdx);
 
60
    int _encode(const char* buf, int ret);
59
61
    int _encode(const char* buf);
60
62
 
61
 
    
 
63
 
62
64
    CGetFuzzySyllablesOp<CPinyinData>  *m_pGetFuzzySyllablesOp;
63
65
 
64
 
        
 
66
 
65
67
    CDATrie<short>                      m_pytrie;
66
 
    std::string                         m_pystr;
67
 
    wstring                             m_inputBuf;
68
 
    TSegmentVec                         m_segs;
69
 
    TSegmentVec                         m_fuzzy_segs;
70
 
    TSegmentVec                         m_merged_segs;
71
 
        
72
 
    unsigned                            m_updatedFrom;
73
 
        static CShuangpinData               s_shpData;
74
 
        
75
 
        
 
68
    std::string m_pystr;
 
69
    wstring m_inputBuf;
 
70
    TSegmentVec m_segs;
 
71
    TSegmentVec m_fuzzy_segs;
 
72
    TSegmentVec m_merged_segs;
 
73
 
 
74
    unsigned m_updatedFrom;
 
75
    static CShuangpinData s_shpData;
76
76
};
77
77
 
78
78
#endif /* SUNPY_PINYIN_SEG_H */