Skip to content

Commit

Permalink
Make python support all model types
Browse files Browse the repository at this point in the history
  • Loading branch information
kpu committed May 30, 2013
1 parent 80150ba commit 53071f7
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 384 deletions.
3 changes: 3 additions & 0 deletions lm/virtual_interface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "util/string_piece.hh"

#include <string>
#include <string.h>

namespace lm {
namespace base {
Expand Down Expand Up @@ -119,7 +120,9 @@ class Model {

size_t StateSize() const { return state_size_; }
const void *BeginSentenceMemory() const { return begin_sentence_memory_; }
void BeginSentenceWrite(void *to) const { memcpy(to, begin_sentence_memory_, StateSize()); }
const void *NullContextMemory() const { return null_context_memory_; }
void NullContextWrite(void *to) const { memcpy(to, null_context_memory_, StateSize()); }

// Requires in_state != out_state
virtual float Score(const void *in_state, const WordIndex new_word, void *out_state) const = 0;
Expand Down
Loading

0 comments on commit 53071f7

Please sign in to comment.