public ShingleFilterFactory(Map<String, String> args) {super(args);maxShingleSize = getInt(args, "maxShingleSize", ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE);if (maxShingleSize < 2) {throw new IllegalArgumentException("Invalid maxShingleSize (" + maxShingleSize + ") - must be at least 2");}minShingleSize = getInt(args, "minShingleSize", ShingleFilter.DEFAULT_MIN_SHINGLE_SIZE);if (minShingleSize < 2) {throw new IllegalArgumentException("Invalid minShingleSize (" + minShingleSize + ") - must be at least 2");}if (minShingleSize > maxShingleSize) {throw new IllegalArgumentException("Invalid minShingleSize (" + minShingleSize + ") - must be no greater than maxShingleSize (" + maxShingleSize + ")");}outputUnigrams = getBoolean(args, "outputUnigrams", true);outputUnigramsIfNoShingles = getBoolean(args, "outputUnigramsIfNoShingles", false);tokenSeparator = get(args, "tokenSeparator", ShingleFilter.DEFAULT_TOKEN_SEPARATOR);fillerToken = get(args, "fillerToken", ShingleFilter.DEFAULT_FILLER_TOKEN);if (!args.isEmpty()) {throw new IllegalArgumentException("Unknown parameters: " + args);}}
public ShingleFilterFactory(IDictionary<string, string> args): base(args){maxShingleSize = GetInt32(args, "maxShingleSize", ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE);if (maxShingleSize < 2){throw new ArgumentOutOfRangeException("Invalid maxShingleSize (" + maxShingleSize + ") - must be at least 2");}minShingleSize = GetInt32(args, "minShingleSize", ShingleFilter.DEFAULT_MIN_SHINGLE_SIZE);if (minShingleSize < 2){throw new ArgumentOutOfRangeException("Invalid minShingleSize (" + minShingleSize + ") - must be at least 2");}if (minShingleSize > maxShingleSize){throw new ArgumentOutOfRangeException("Invalid minShingleSize (" + minShingleSize + ") - must be no greater than maxShingleSize (" + maxShingleSize + ")");}outputUnigrams = GetBoolean(args, "outputUnigrams", true);outputUnigramsIfNoShingles = GetBoolean(args, "outputUnigramsIfNoShingles", false);tokenSeparator = Get(args, "tokenSeparator", ShingleFilter.DEFAULT_TOKEN_SEPARATOR);fillerToken = Get(args, "fillerToken", ShingleFilter.DEFAULT_FILLER_TOKEN);if (args.Count > 0){throw new ArgumentException("Unknown parameters: " + args);}}