private void incrementValues(SELECTOR sel)
            {
                switch (sel)
                {
                case SELECTOR.CLIREG_ID:
                    this.clientRegistryId += 1;
                    break;

                case SELECTOR.CLISTOMAP_ID:
                    this.clientStoreMapId += 1;
                    break;

                case SELECTOR.DATSERV_ID:
                    this.databaseServiceId += 1;
                    break;

                case SELECTOR.DATSERVMAP_ID:
                    this.databaseServiceStoreMapId += 1;
                    break;

                case SELECTOR.ESBSERV_ID:
                    this.esbServiceId += 1;
                    break;

                case SELECTOR.ESBSERVMAP_ID:
                    this.esbServiceStoreMapId += 1;
                    break;

                case SELECTOR.GLOBCFG_ID:
                    this.globalConfigId += 1;
                    break;

                case SELECTOR.STOAPPVER_ID:
                    this.storeAppVersionId += 1;
                    break;

                case SELECTOR.STOCLICFG_ID:
                    this.storeClientConfigId += 1;
                    break;

                case SELECTOR.STOCFG_ID:
                    this.storeConfigId += 1;
                    break;

                case SELECTOR.STOSITINF_ID:
                    this.storeSiteInfoId += 1;
                    break;
                }
            }
            /// <summary>
            /// Retrieves the next id values based on the SELECTOR
            /// Pushes to the output variable and then
            /// increments the specified id
            /// </summary>
            /// <param name="sel"></param>
            /// <param name="nextIdVal"></param>
            /// <param name="stu"></param>
            public void GetNextIds(
                SELECTOR sel,
                ref ulong nextIdVal, out string stu)
            {
                stu = string.Empty;
                ulong valToPull = 1;

                this.logCurrentValues("- Before ", false, sel);
                switch (sel)
                {
                case SELECTOR.CLIREG_ID:
                    valToPull = this.clientRegistryId;
                    break;

                case SELECTOR.CLISTOMAP_ID:
                    valToPull = this.clientStoreMapId;
                    break;

                case SELECTOR.DATSERV_ID:
                    valToPull = this.databaseServiceId;
                    break;

                case SELECTOR.DATSERVMAP_ID:
                    valToPull = this.databaseServiceStoreMapId;
                    break;

                case SELECTOR.ESBSERV_ID:
                    valToPull = this.esbServiceId;
                    break;

                case SELECTOR.ESBSERVMAP_ID:
                    valToPull = this.esbServiceStoreMapId;
                    break;

                case SELECTOR.GLOBCFG_ID:
                    valToPull = this.globalConfigId;
                    break;

                case SELECTOR.STOAPPVER_ID:
                    valToPull = this.storeAppVersionId;
                    break;

                case SELECTOR.STOCLICFG_ID:
                    valToPull = this.storeClientConfigId;
                    break;

                case SELECTOR.STOCFG_ID:
                    valToPull = this.storeConfigId;
                    break;

                case SELECTOR.STOSITINF_ID:
                    valToPull = this.storeSiteInfoId;
                    break;

                default:
                    valToPull = 1;
                    break;
                }

                //Set the outgoing variable
                nextIdVal = valToPull;

                //Increment values
                this.incrementValues(sel);
                this.logCurrentValues("- After ", false, sel);
            }
            private void logCurrentValues(string s, bool all, SELECTOR e)
            {
                var flog = FileLogger.Instance;

                if (flog != null)
                {
                    if (all)
                    {
                        flog.logMessage(LogLevel.DEBUG,
                                        "PawnSecNextIdVO",
                                        (s ?? "(null())") +
                                        "{0}" +
                                        "cliRegId={1}" + Environment.NewLine +
                                        "cliStoMap={2}" + Environment.NewLine +
                                        "datServId={3}" + Environment.NewLine +
                                        "datServStoMapId={4}" + Environment.NewLine +
                                        "esbServId={5}" + Environment.NewLine +
                                        "esbServStoMapId={6}" + Environment.NewLine +
                                        "globCfgId={7}" + Environment.NewLine +
                                        "stoAppVerId={8}" + Environment.NewLine +
                                        "stoCliCfgId={9}" + Environment.NewLine +
                                        "stoCfgId={10}" + Environment.NewLine +
                                        "stoSiteInfoId={11}",
                                        Environment.NewLine,
                                        this.clientRegistryId,
                                        this.clientStoreMapId,
                                        this.databaseServiceId,
                                        this.databaseServiceStoreMapId,
                                        this.esbServiceId,
                                        this.esbServiceStoreMapId,
                                        this.globalConfigId,
                                        this.storeAppVersionId,
                                        this.storeClientConfigId,
                                        this.storeConfigId,
                                        this.storeSiteInfoId);
                    }
                    else
                    {
                        var sB = new StringBuilder(64);
                        sB.Append((s ?? "null") + e);
                        switch (e)
                        {
                        case SELECTOR.CLIREG_ID:
                            sB.Append(" ClientRegistryId   = " + this.clientRegistryId);
                            break;

                        case SELECTOR.CLISTOMAP_ID:
                            sB.Append(" ClientStoreMapId   = " + this.clientStoreMapId);
                            break;

                        case SELECTOR.DATSERV_ID:
                            sB.Append(" DatabaseServiceId  = " + this.databaseServiceId);
                            break;

                        case SELECTOR.DATSERVMAP_ID:
                            sB.Append(" DatabaseServiceMapId = " + this.databaseServiceStoreMapId);
                            break;

                        case SELECTOR.ESBSERV_ID:
                            sB.Append(" ESBServiceId = " + this.esbServiceId);
                            break;

                        case SELECTOR.ESBSERVMAP_ID:
                            sB.Append(" ESBServiceMapId = " + this.esbServiceStoreMapId);
                            break;

                        case SELECTOR.GLOBCFG_ID:
                            sB.Append(" GlobalConfigid = " + this.globalConfigId);
                            break;

                        case SELECTOR.STOAPPVER_ID:
                            sB.Append(" StoreAppVerId = " + this.storeAppVersionId);
                            break;

                        case SELECTOR.STOCLICFG_ID:
                            sB.Append(" StoreClientConfigId = " + this.storeClientConfigId);
                            break;

                        case SELECTOR.STOCFG_ID:
                            sB.Append(" StoreConfigId = " + this.storeConfigId);
                            break;

                        case SELECTOR.STOSITINF_ID:
                            sB.Append(" StoreSiteInfoId = " + this.storeSiteInfoId);
                            break;
                        }
                        sB.AppendLine();
                        flog.logMessage(LogLevel.DEBUG, "PawnNextIdVO", sB.ToString());
                    }
                }
            }
Exemple #4
0
 protected override void Visit_SELECTOR(SELECTOR node)
 {
     /* MOVE CODE HERE */
 }
Exemple #5
0
 protected virtual void Visit_SELECTOR(SELECTOR node)
 {
 }
        public aceConsoleScript GenerateScript([Description("tags")] String tags = "")
        {
            if (tags.Contains("!"))
            {
                tags       = tags.Replace("!", "");
                RemoveZero = false;
            }

            List <string> left_tags  = new List <string>();
            List <string> right_tags = new List <String>();

            if (tags.Contains("--"))
            {
                Match mach = SELECTOR.Match(tags);
                left_tags  = mach.Groups[1].Value.SplitSmart("-");
                right_tags = mach.Groups[2].Value.SplitSmart("-");
            }
            else
            {
                right_tags = tags.SplitSmart("-");
            }


            String fs_tag  = "";
            String fs_tagn = "";

            foreach (var fst in right_tags)
            {
                fs_tagn = SELECTOR_NUMBER.Match(fst).Value; //.Groups[0].Value;
                if (fs_tagn.Length > 0)
                {
                    fs_size = Int32.Parse(fs_tagn);
                    fs_tag  = fst;
                }
            }

            if (!fs_tag.isNullOrEmpty())
            {
                right_tags.Remove(fs_tag);
                right_tags.Add(fs_tag.Replace(fs_tagn, ""));
            }

            var left_match  = definitions.Where(x => left_tags.Contains(x.key));
            var right_match = definitions.Where(x => right_tags.Contains(x.key));

            List <String> left_lines = new List <string>();
            //left_lines.Add("    .New");

            List <String> right_lines = new List <string>();

            //right_lines.Add("   .New");



            left_lines.AddRange(left_match.Select(x => x.value));
            right_lines.AddRange(right_match.Select(x => x.value));

            tags = tags.Replace("--", "-");


            filter_code = "bec.ops.docClassification.filter.model{" + Environment.NewLine + String.Join(Environment.NewLine, left_lines) + Environment.NewLine + "}";
            weight_code = "bec.ops.docClassification.weight.model{" + Environment.NewLine + String.Join(Environment.NewLine, right_lines) + Environment.NewLine + "}";


            description += "Feature selection based on " + String.Join(",", left_match.Select(x => x.description));

            description += "Term weighting based on " + String.Join(",", right_match.Select(x => x.description));

            StringBuilder sb = new StringBuilder();

            if (!RemoveZero)
            {
                tags         = "n" + tags;
                description += " Feature selection without zero-filter.";
            }

            sb.AppendLine($"bec.InitExperimentContext runName=\"{tags}\";runComment=\"{description}\";silendDatasetLoad=true;");
            sb.AppendLine($"bec.ops.docClassification.filter.FeatureFilter RemoveZero={RemoveZero};limit={fs_size};nVectorOperation=\"max\";outputFilename=\"{tags}_selected\";");
            sb.AppendLine("bec.ops.docClassification.ResetModels;");

            sb.AppendLine(filter_code);
            sb.AppendLine(weight_code);

            sb.AppendLine($"bec.ops.ClassificationWithDS outputName=\" \";DSFilename=\" \";DSCount=500;options=\" \";");
            sb.AppendLine($"bec.ops.Execute options=\"clearContextOnStart, clearContextOnFinish, skipExistingExperiment\";");
            sb.AppendLine($"bec.CloseExperimentContext;");

            aceConsoleScript script = sb.ToString();

            // input.setContent(sb.ToString());


            return(script);
        }