public void BuildFromStat <TModel>() where TModel : NGramModelBase, new() { var stat = new TextStatistician($"{PATH_BASE}stat.csv"); var model = new TModel(); model.FromStatistician(stat); model.Save(); }
public void Save() { string tmodelkey; Debug.Enter(); Debug.Write(SeverityType.Info, CategoryType.Data, "Importing categorization scheme..."); if (null != TModel) { TModel.AuthorizedName = null; TModel.Save(); } else { TModel = new TModel(TModelKey); TModel.Get(); } // // If the TModel Provided is categorized with 'Browsing Intended' // Set the flag (0x0002) // //if( TModel.CategoryBag.Contains( new KeyedReference( "Browsing Intended","1","uuid:BE37F93E-87B4-4982-BF6D-992A8E44EDAB" ) ) ) foreach (KeyedReference kr in TModel.CategoryBag) { if (kr.KeyValue == "1" && kr.TModelKey.ToUpper() == "UUID:BE37F93E-87B4-4982-BF6D-992A8E44EDAB") { CategorizationSchemeFlag = CategorizationSchemeFlag | 0x0002; } } // // Store the TModelKey // tmodelkey = TModel.TModelKey; // // Save the categorization scheme // SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_taxonomy_save"; sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@flag", SqlDbType.Int); sp.Parameters.Add("@taxonomyID", SqlDbType.BigInt, ParameterDirection.InputOutput); sp.Parameters.SetGuidFromKey("@tModelKey", tmodelkey); sp.Parameters.SetInt("@flag", CategorizationSchemeFlag); sp.ExecuteNonQuery(); int taxonomyID = sp.Parameters.GetInt("@taxonomyID"); // // Save the category values // foreach (CategoryValue cv in CategoryValues) { cv.Save(tmodelkey); } Debug.Leave(); }