Exemple #1
0
            public TransformApplierParams(TextTransform parent)
            {
                var host = parent._host;

                host.Check(Enum.IsDefined(typeof(Language), parent.AdvancedSettings.TextLanguage));
                host.Check(Enum.IsDefined(typeof(CaseNormalizationMode), parent.AdvancedSettings.TextCase));
                WordExtractorFactory = parent._wordFeatureExtractor?.CreateComponent(host, parent._dictionary);
                CharExtractorFactory = parent._charFeatureExtractor?.CreateComponent(host, parent._dictionary);
                VectorNormalizer     = parent.AdvancedSettings.VectorNormalizer;
                Language             = parent.AdvancedSettings.TextLanguage;
                StopWordsRemover     = parent._stopWordsRemover;
                TextCase             = parent.AdvancedSettings.TextCase;
                KeepDiacritics       = parent.AdvancedSettings.KeepDiacritics;
                KeepPunctuations     = parent.AdvancedSettings.KeepPunctuations;
                KeepNumbers          = parent.AdvancedSettings.KeepNumbers;
                OutputTextTokens     = parent.AdvancedSettings.OutputTokens;
                Dictionary           = parent._dictionary;
            }
 public TransformApplierParams(IHost host, Arguments args)
 {
     Contracts.AssertValue(host);
     host.CheckUserArg(args.Column != null, nameof(args.Column), "Columns must be specified");
     host.CheckUserArg(args.WordFeatureExtractor != null || args.CharFeatureExtractor != null || args.OutputTokens,
                       nameof(args.WordFeatureExtractor), "At least one feature extractor or OutputTokens must be specified.");
     host.Check(Enum.IsDefined(typeof(Language), args.Language));
     host.Check(Enum.IsDefined(typeof(CaseNormalizationMode), args.TextCase));
     WordExtractorFactory = args.WordFeatureExtractor?.CreateComponent(host, args.Dictionary);
     CharExtractorFactory = args.CharFeatureExtractor?.CreateComponent(host, args.Dictionary);
     VectorNormalizer     = args.VectorNormalizer;
     Language             = args.Language;
     StopWordsRemover     = args.StopWordsRemover;
     TextCase             = args.TextCase;
     KeepDiacritics       = args.KeepDiacritics;
     KeepPunctuations     = args.KeepPunctuations;
     KeepNumbers          = args.KeepNumbers;
     OutputTextTokens     = args.OutputTokens;
     Dictionary           = args.Dictionary;
 }