Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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>();
 }
        /// <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));
            }
        }
Ejemplo n.º 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;
 }
        /// <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;
            }
Ejemplo n.º 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;
 }