Package sphinxbase :: Module sphinxbase :: Class NGramModel
[hide private]
[frames] | no frames]

Class NGramModel

source code

object --+
         |
        NGramModel

Proxy of C NGramModel struct

Instance Methods [hide private]
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattr__(self, name) source code
 
__repr__(self)
repr(x)
source code
 
__init__(self, *args)
__init__(NGramModel self, char const * path) -> NGramModel __init__(NGramModel self, Config config, LogMath logmath, char const * path) -> NGramModel
source code
 
__swig_destroy__(...)
delete_NGramModel(NGramModel self)
 
__del__(self) source code
 
write(self, path, ftype)
write(NGramModel self, char const * path, int ftype)
source code
 
str_to_type(self, str)
str_to_type(NGramModel self, char const * str) -> int
source code
 
type_to_str(self, type)
type_to_str(NGramModel self, int type) -> char const *
source code
 
casefold(self, kase)
casefold(NGramModel self, int kase)
source code
 
size(self)
size(NGramModel self) -> int
source code
 
add_word(self, word, weight)
add_word(NGramModel self, char const * word, float weight) -> int
source code
 
prob(self, n)
prob(NGramModel self, size_t n) -> int
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
fromIter(itor)
fromIter(void * itor) -> NGramModel
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __swig_getmethods__ = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__setattr__(self, name, value)

source code 

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__init__(self, *args)
(Constructor)

source code 

__init__(NGramModel self, char const * path) -> NGramModel __init__(NGramModel self, Config config, LogMath logmath, char const * path) -> NGramModel

Overrides: object.__init__

write(self, path, ftype)

source code 

write(NGramModel self, char const * path, int ftype)

Write an N-Gram model to disk.

0 for success, <0 on error

casefold(self, kase)

source code 

casefold(NGramModel self, int kase)

Case-fold word strings in an N-Gram model.

WARNING: This is not Unicode aware, so any non-ASCII characters will not be converted.

add_word(self, word, weight)

source code 

add_word(NGramModel self, char const * word, float weight) -> int

Add a word (unigram) to the language model.

The semantics of this are not particularly well-defined for model
sets, and may be subject to change. Currently this will add the word
to all of the submodels

Parameters:
-----------

model:  The model to add a word to.

word:  Text of the word to add.

weight:  Weight of this word relative to the uniform distribution.

The word ID for the new word.