public DSSMModel(string name, string commonModelPath, Vocab vocab, int sourceWindowSize, int targetWindowSize, bool compatibilityMode)
 {
     this.Name        = name;
     this.SourceModel = new DNN();
     this.SourceModel.LoadModelV0(commonModelPath, compatibilityMode);
     this.TargetModel      = this.SourceModel;
     this.Vocabulary       = vocab;
     this.SourceWindowSize = sourceWindowSize;
     this.TargetWindowSize = targetWindowSize;
 }
        private double[] GetEmbeddings(DNN model, string text, int windowSize, FeatureType featureType, int nHashCount)
        {
            text = TextUtils.N1Normalize(text);

            if (text.Length == 0)
            {
                text = "#";
            }

            List <Dictionary <int, double> > rgSideWfs = new List <Dictionary <int, double> >();

            var featStrFeq = TextUtils.String2FeatStrSeq(text, 3, windowSize, featureType);  // letter N-gram

            if (featureType == FeatureType.wordhash)
            {
                rgSideWfs = TextUtils.StrFreq2IdFreq(featStrFeq, nHashCount);
            }
            else
            {
                rgSideWfs = TextUtils.StrFreq2IdFreq(featStrFeq, this.Vocabulary);
            }

            return(model.Fprop(rgSideWfs));
        }