File size: 2,186 Bytes
fd49381 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.pair cimport pair
from cdictree cimport Scores
cdef extern from 'Vocab.h' namespace 'OnDiskPt':
cdef cppclass Vocab:
Vocab()
cdef extern from 'Word.h' namespace 'OnDiskPt':
cdef cppclass Word:
Word()
string &GetString(Vocab vocab)
cdef extern from 'Phrase.h' namespace 'OnDiskPt':
cdef cppclass Phrase:
Phrase()
unsigned GetSize()
Word &GetWord(unsigned pos)
cdef extern from 'SourcePhrase.h' namespace 'OnDiskPt':
cdef cppclass SourcePhrase:
SourcePhrase()
unsigned GetSize()
Word &GetWord(unsigned pos)
cdef extern from 'TargetPhrase.h' namespace 'OnDiskPt':
ctypedef pair[int,int] AlignPair
ctypedef vector[AlignPair] AlignType
cdef cppclass TargetPhrase:
TargetPhrase()
unsigned GetSize()
Word &GetWord(unsigned pos)
AlignType &GetAlign()
Scores &GetScores()
cdef extern from 'TargetPhraseCollection.h' namespace 'OnDiskPt':
cdef cppclass TargetPhraseCollection:
TargetPhraseCollection()
TargetPhrase &GetTargetPhrase(unsigned index)
unsigned GetSize()
string GetDebugStr()
cdef extern from 'OnDiskWrapper.h' namespace 'OnDiskPt':
cdef cppclass OnDiskWrapper
cdef extern from 'PhraseNode.h' namespace 'OnDiskPt':
cdef cppclass PhraseNode:
PhraseNode()
PhraseNode* GetChild(Word &word, OnDiskWrapper &wrapper)
TargetPhraseCollection* GetTargetPhraseCollection(unsigned tableLimit, OnDiskWrapper &wrapper)
ctypedef PhraseNode* ConstPhraseNodePointer 'const PhraseNode*'
cdef extern from 'OnDiskWrapper.h' namespace 'OnDiskPt':
cdef cppclass OnDiskWrapper:
OnDiskWrapper()
bint BeginLoad(string& path)
PhraseNode& GetRootSourceNode()
Vocab& GetVocab()
cdef extern from 'OnDiskQuery.h' namespace 'OnDiskPt':
cdef cppclass OnDiskQuery:
OnDiskQuery(OnDiskWrapper &wrapper)
SourcePhrase Tokenize(vector[string]& tokens)
PhraseNode* Query(SourcePhrase& sourcePhrase)
PhraseNode* Query(vector[string]& tokens)
|