quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_search.a #include <StackSearch.h> StackSearch(); StackSearch(const StackSearch& copy_search); boolean setNumLevels(long num_levels); SearchLevel& getSearchLevel(long level) boolean decode(FrontEnd& fe, long num_frames = ALL_FRAMES); boolean getHypotheses(String& output_hyp, long level, float& total_score, long& num_frames, DoubleLinkedList& trace_path);
description:// configure FrontEnd // FrontEnd fe; Sof front_end_sof; front_end_sof.open(L"front_end.sof"); fe.read(front_end_sof, front_end_sof.first(fe.name())); front_end_sof.close(); // configure StackSearch // StackSearch search_engine; long num_levels = 3; search_engine.setNumLevels(num_levels); // read models // Sof model_sof; model_sof.open(L"models.sof"); for (long curr_level = 0; curr_level < num_levels; curr_level++) { SearchLevel& level = search_engine.getSearchLevel(curr_level); level.load(model_sof); } model_sof.close(); // process the sentence // Filename speech_file(L"speech_file.raw"); fe.open(speech_file); search_engine.decode(fe); fe.close(); // get the best hypothesis // String best_hypothesis; long level = 0; float score = 0; long num_frames = 0; DoubleLinkedList& trace_path; search_engine.getHypotheses(best_hypothesis, level, score, num_frames, DoubleLinkedList & trace_path);
static const String CLASS_NAME = L"StackSearch";
static const String StackSearch::DEF_PARAM = L"stack_search";
static const long START_FRAME = -1;
static const long ALL_FRAMES = -1;
static const long DEF_NUM_LEVELS = 3;
static const long MAX_NUM_FRAMES = 1000;
static const long DEF_N_BEST = 1;
static const long ALL_LEVELS = -1;
static const long ERR = 90800;
static const long ERR = 90801;
typedef GraphVertex<SearchNode> GVSnode;
Vector<VectorFloat> features_d;
Long num_frames_d;
Long n_best_d;
Long current_frame_d;
Vector<SearchLevel> search_levels_d;
Vector<Long> nsymbol_mapping_d;
Vector<Long> context_mapping_d;
MatrixFloat max_frame_scores_d;
VectorFloat max_stack_scores_d;
MatrixFloat stat_model_scores_d;
Vector<DoubleLinkedList<Trace> > trace_lists_d;
DoubleLinkedList<Trace> valid_hyps_d;
Vector<HashTable<HashKey<GraphVertex<SearchNode> > Stack<Hypothesis> > > stacks_d;
static MemoryManager mgr_d;
static Integral::DEBUG debug_level_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
static boolean setDebug(Integral::DEBUG debug_level;
~StackSearch();
StackSearch();
StackSearch(const StackSearch& arg);
boolean assign(const StackSearch& arg);
long sofSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const StackSearch& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
boolean setNumLevels(long num_levels);
long getNumLevels() const;
SearchLevel& getSearchLevel(long level);
Vector<SearchLevel>& getSearchLevels();
boolean initSizes(long total_num_frames);
boolean initializeLinearDecoder();
boolean decode(FrontEnd& fe, long num_frames = ALL_FRAMES);
boolean decode(Vector<VectorFloat>& features, long num_frames = ALL_FRAMES);
boolean getHypotheses(String& output_hyp, long level, float& total_score, long& num_frames, DoubleLinkedList<Trace>& trace_path);
boolean clearTraceStorage();
boolean clearSearchNodesTraceLists();
boolean clearValidHypsTrace();
boolean traverseTraceLevels();
boolean pathsRemainTrace();
boolean propagateTraces(DoubleLinkedList<Trace>* top_list = NULL);
boolean propagateTracesDown(long level_num);
boolean propagateTracesUp(long level_num, DoubleLinkedList<Trace>* top_list = NULL);
boolean evaluateTraceModels();
long getActiveTraces(long search_level = ALL_LEVELS);
boolean printNewPath(Trace* new_trace, Trace* old_trace);
boolean printDeletedPath(Trace* new_trace, Trace* old_trace);
boolean beamPruneTrace(long level_num);
boolean generateRightContexts(DoubleLinkedList<Context>& context_list, const Context& initial_context, long depth);
boolean generateInitialTraces();
boolean extend(DoubleLinkedList<Trace>& hlist, long start_frame);
boolean getTraces(DoubleLinkedList<Trace>& trace_list, long level);
boolean setTopLevelTraces(DoubleLinkedList<Trace>& top_trace_list);
boolean decode();
boolean setFrame(long frame);