当前位置: 首页>>代码示例>>C#>>正文


C# Term.Text方法代码示例

本文整理汇总了C#中Term.Text方法的典型用法代码示例。如果您正苦于以下问题:C# Term.Text方法的具体用法?C# Term.Text怎么用?C# Term.Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Term的用法示例。


在下文中一共展示了Term.Text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DumbRegexpQuery

 internal DumbRegexpQuery(Term term, int flags)
     : base(term.Field)
 {
     RegExp re = new RegExp(term.Text(), flags);
     Automaton = re.ToAutomaton();
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:6,代码来源:TestRegexpRandom2.cs

示例2: DumbRegexpQuery

 internal DumbRegexpQuery(TestRegexpRandom2 outerInstance, Term term, int flags)
     : base(term.Field())
 {
     this.OuterInstance = outerInstance;
     RegExp re = new RegExp(term.Text(), flags);
     Automaton = re.ToAutomaton();
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:7,代码来源:TestRegexpRandom2.cs

示例3: FuzzyTermsEnum

        /// <summary>
        /// Constructor for enumeration of all terms from specified <code>reader</code> which share a prefix of
        /// length <code>prefixLength</code> with <code>term</code> and which have a fuzzy similarity &gt;
        /// <code>minSimilarity</code>.
        /// <p>
        /// After calling the constructor the enumeration is already pointing to the first
        /// valid term if such a term exists.
        /// </summary>
        /// <param name="terms"> Delivers terms. </param>
        /// <param name="atts"> <seealso cref="AttributeSource"/> created by the rewrite method of <seealso cref="MultiTermQuery"/>
        /// thats contains information about competitive boosts during rewrite. It is also used
        /// to cache DFAs between segment transitions. </param>
        /// <param name="term"> Pattern term. </param>
        /// <param name="minSimilarity"> Minimum required similarity for terms from the reader. Pass an integer value
        ///        representing edit distance. Passing a fraction is deprecated. </param>
        /// <param name="prefixLength"> Length of required common prefix. Default value is 0. </param>
        /// <exception cref="IOException"> if there is a low-level IO error </exception>
        public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, float minSimilarity, int prefixLength, bool transpositions)
        {
            if (!InstanceFieldsInitialized)
            {
                InitializeInstanceFields();
                InstanceFieldsInitialized = true;
            }
            if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity)
            {
                throw new System.ArgumentException("fractional edit distances are not allowed");
            }
            if (minSimilarity < 0.0f)
            {
                throw new System.ArgumentException("minimumSimilarity cannot be less than 0");
            }
            if (prefixLength < 0)
            {
                throw new System.ArgumentException("prefixLength cannot be less than 0");
            }
            this.Terms = terms;
            this.Term_Renamed = term;

            // convert the string into a utf32 int[] representation for fast comparisons
            string utf16 = term.Text();
            //LUCENE TO-DO
            //this.TermText = new int[utf16.codePointCount(0, utf16.Length)];
            this.TermText = new int[utf16.Length];
            for (int cp, i = 0, j = 0; i < utf16.Length; i += Character.CharCount(cp))
            {
                TermText[j++] = cp = Character.CodePointAt(utf16, i);
            }
            this.TermLength = TermText.Length;
            this.DfaAtt = atts.AddAttribute<ILevenshteinAutomataAttribute>();

            //The prefix could be longer than the word.
            //It's kind of silly though.  It means we must match the entire word.
            this.RealPrefixLength = prefixLength > TermLength ? TermLength : prefixLength;
            // if minSimilarity >= 1, we treat it as number of edits
            if (minSimilarity >= 1f)
            {
                this.MinSimilarity_Renamed = 0; // just driven by number of edits
                MaxEdits = (int)minSimilarity;
                Raw = true;
            }
            else
            {
                this.MinSimilarity_Renamed = minSimilarity;
                // calculate the maximum k edits for this similarity
                MaxEdits = InitialMaxDistance(this.MinSimilarity_Renamed, TermLength);
                Raw = false;
            }
            if (transpositions && MaxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE)
            {
                throw new System.NotSupportedException("with transpositions enabled, distances > " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE + " are not supported ");
            }
            this.Transpositions = transpositions;
            this.Scale_factor = 1.0f / (1.0f - this.MinSimilarity_Renamed);

            this.MaxBoostAtt = atts.AddAttribute<IMaxNonCompetitiveBoostAttribute>();
            Bottom = MaxBoostAtt.MaxNonCompetitiveBoost;
            BottomTerm = MaxBoostAtt.CompetitiveTerm;
            BottomChanged(null, true);
        }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:80,代码来源:FuzzyTermsEnum.cs

示例4: RegexpQuery

 /// <summary>
 /// Constructs a query for terms matching <code>term</code>.
 /// </summary>
 /// <param name="term"> regular expression. </param>
 /// <param name="flags"> optional RegExp features from <seealso cref="RegExp"/> </param>
 /// <param name="provider"> custom AutomatonProvider for named automata </param>
 public RegexpQuery(Term term, int flags, AutomatonProvider provider)
     : base(term, (new RegExp(term.Text(), flags)).ToAutomaton(provider))
 {
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:10,代码来源:RegexpQuery.cs


注:本文中的Term.Text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。