コード例 #1
0
        /// <summary>
        /// Creates a new <see cref="NorwegianLightStemFilterFactory"/> </summary>
        public NorwegianLightStemFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            string variant = Get(args, "variant");

            if (variant == null || "nb".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.BOKMAAL;
            }
            else if ("nn".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.NYNORSK;
            }
            else if ("no".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.BOKMAAL | NorwegianStandard.NYNORSK;
            }
            else
            {
                throw new System.ArgumentException("invalid variant: " + variant);
            }
            if (args.Count > 0)
            {
                throw new System.ArgumentException("Unknown parameters: " + args);
            }
        }
コード例 #2
0
 /// <summary>
 /// Creates a new <see cref="NorwegianLightStemFilter"/> </summary>
 /// <param name="input"> the source <see cref="TokenStream"/> to filter </param>
 /// <param name="flags"> set to <see cref="NorwegianStandard.BOKMAAL"/>,
 ///                     <see cref="NorwegianStandard.NYNORSK"/>, or both. </param>
 public NorwegianLightStemFilter(TokenStream input, NorwegianStandard flags)
     : base(input)
 {
     stemmer     = new NorwegianLightStemmer(flags);
     termAtt     = AddAttribute <ICharTermAttribute>();
     keywordAttr = AddAttribute <IKeywordAttribute>();
 }
コード例 #3
0
        /// <summary>
        /// Creates a new <see cref="NorwegianMinimalStemFilterFactory"/> </summary>
        public NorwegianMinimalStemFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            string variant = Get(args, "variant");

            if (variant == null || "nb".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.BOKMAAL;
            }
            else if ("nn".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.NYNORSK;
            }
            else if ("no".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.BOKMAAL | NorwegianStandard.NYNORSK;
            }
            else
            {
                throw new ArgumentException("invalid variant: " + variant);
            }
            if (args.Count > 0)
            {
                throw new ArgumentException(string.Format(J2N.Text.StringFormatter.CurrentCulture, "Unknown parameters: {0}", args));
            }
        }
コード例 #4
0
 /// <summary>
 /// Creates a new <see cref="NorwegianMinimalStemmer"/> </summary>
 /// <param name="flags"> set to <see cref="NorwegianStandard.BOKMAAL"/>,
 ///                     <see cref="NorwegianStandard.NYNORSK"/>, or both. </param>
 public NorwegianMinimalStemmer(NorwegianStandard flags)
 {
     if (flags <= 0 || flags > (int)NorwegianStandard.BOKMAAL + NorwegianStandard.NYNORSK)
     {
         throw new ArgumentException("invalid flags");
     }
     //useBokmaal = (flags & NorwegianStandard.BOKMAAL) != 0; // LUCENENET: Never read
     useNynorsk = (flags & NorwegianStandard.NYNORSK) != 0;
 }
コード例 #5
0
        /// <summary>
        /// Creates a new <see cref="NorwegianMinimalStemFilterFactory"/> </summary>
        public NorwegianMinimalStemFilterFactory(IDictionary <string, string> args)
            : base(args)
        {
            string variant = Get(args, "variant");

            if (variant is null || "nb".Equals(variant, StringComparison.Ordinal))
            {
                flags = NorwegianStandard.BOKMAAL;
            }
コード例 #6
0
 /// <summary>
 /// Creates a new <see cref="NorwegianLightStemmer"/> </summary>
 /// <param name="flags"> set to <see cref="NorwegianStandard.BOKMAAL"/>, <see cref="NorwegianStandard.NYNORSK"/>, or both. </param>
 public NorwegianLightStemmer(NorwegianStandard flags)
 {
     if (flags <= 0 || flags > (int)NorwegianStandard.BOKMAAL + NorwegianStandard.NYNORSK)
     {
         throw new ArgumentException("invalid flags");
     }
     useBokmaal = (flags & NorwegianStandard.BOKMAAL) != 0;
     useNynorsk = (flags & NorwegianStandard.NYNORSK) != 0;
 }