Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

TextSenseSequenceVMatrix.h

Go to the documentation of this file.
00001 00003 #ifndef TextSenseSequenceVMatrix_INC 00004 #define TextSenseSequenceVMatrix_INC 00005 00006 #include <plearn/vmat/RowBufferedVMatrix.h> 00007 #include "WordNet/WordNetOntology.h" 00008 #include <plearn/vmat/DiskVMatrix.h> 00009 #include <plearn/vmat/VMat.h> 00010 #include "WordNet/WordNetOntology.h" 00011 #include <plearn/math/random.h> 00012 00013 namespace PLearn { 00014 using namespace std; 00015 00017 class TextSenseSequenceVMatrix: public RowBufferedVMatrix 00018 { 00019 protected: 00020 // ********************* 00021 // * protected options * 00022 // ********************* 00023 00025 VMat dvm; 00027 int window_size; // window_size = 2*n_context 00029 bool is_supervised_data; 00031 TVec<int> res_pos; 00033 bool rand_syn; 00035 TVec<TVec<pair<int, real> > > word_given_sense_priors; 00037 WordNetOntology *wno; 00039 mutable int my_current_row_index; 00041 mutable Vec my_current_row; 00043 bool keep_in_sentence; 00045 int sentence_boundary; 00047 bool undefined_pos_set; 00049 int undefined_pos; 00050 00051 public: 00052 00053 // **************** 00054 // * Constructors * 00055 // **************** 00056 00058 TextSenseSequenceVMatrix(); 00060 00067 TextSenseSequenceVMatrix(VMat that_dvm, int that_window_size, TVec<int> that_res_pos = TVec<int>(0), bool that_rand_syn = false, WordNetOntology *that_wno = NULL) 00068 :inherited(that_dvm->length(), 3*(that_window_size+1)),dvm(that_dvm),window_size(that_window_size), is_supervised_data(dvm->width()==3), res_pos(that_res_pos), rand_syn(that_rand_syn), wno(that_wno), my_current_row_index(-3*(that_window_size+1)), my_current_row(3*(that_window_size+1)), keep_in_sentence(false), undefined_pos_set(false) 00069 /* ### Initialise all fields to their default value */ 00070 { 00071 build_(); 00072 } 00073 00074 // ****************** 00075 // * Object methods * 00076 // ****************** 00077 00078 private: 00080 // (Please implement in .cc) 00081 void build_(); 00082 00084 void permute(Vec v) const; 00085 00087 void apply_boundary(const Vec& v) const; 00088 00089 protected: 00091 // (Please implement in .cc) 00092 static void declareOptions(OptionList& ol); 00093 00095 virtual void getNewRow(int i, const Vec& v) const; 00096 00097 public: 00099 int getRestrictedRow(int i, Vec v) const; 00100 00101 // simply calls inherited::build() then build_() 00102 virtual void build(); 00103 00105 virtual void makeDeepCopyFromShallowCopy(map<const void*, void*>& copies); 00106 00108 void setOntology(WordNetOntology *that_wno){wno = that_wno;} 00109 00111 void setWindowSize(int that_window_size){window_size = that_window_size;} 00112 00114 void setWordSequence(VMat that_dvm){dvm = that_dvm; is_supervised_data = that_dvm->width()==3; } 00115 00117 void setRandomGeneration(bool that_rand_syn){rand_syn = that_rand_syn;} 00118 00120 void setRestrictedPOS(TVec<int> that_res_pos){res_pos = that_res_pos;} 00121 00123 void setSentenceBoundary(int b){keep_in_sentence = true; sentence_boundary = b;} 00124 00126 void setUndefinedPOSId(int pos_id){undefined_pos_set = true; undefined_pos = pos_id;} 00127 00128 typedef RowBufferedVMatrix inherited; 00130 PLEARN_DECLARE_OBJECT(TextSenseSequenceVMatrix); 00131 00132 }; 00133 00134 } // end of namespace PLearn 00135 #endif

Generated on Tue Aug 17 16:08:35 2004 for PLearn by doxygen 1.3.7