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


C# Searcher.DocFreq方法代码示例

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


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

示例1: idfExplain

		/// <summary> Computes a score factor for a phrase.
		/// 
		/// <p/>
		/// The default implementation sums the idf factor for
		/// each term in the phrase.
		/// 
		/// </summary>
		/// <param name="terms">the terms in the phrase
		/// </param>
		/// <param name="searcher">the document collection being searched
		/// </param>
		/// <returns> an IDFExplain object that includes both an idf 
		/// score factor for the phrase and an explanation 
		/// for each term.
		/// </returns>
		/// <throws>  IOException </throws>
		public virtual IDFExplanation idfExplain(System.Collections.ICollection terms, Searcher searcher)
		{
			if (SupportedMethods.overridesCollectionIDF)
			{
				float idf = Idf(terms, searcher);
				return new AnonymousClassIDFExplanation2(idf, this);
			}
			int max = searcher.MaxDoc();
			float idf2 = 0.0f;
			System.Text.StringBuilder exp = new System.Text.StringBuilder();
            foreach (Term term in terms)
			{
				int df = searcher.DocFreq(term);
				idf2 += Idf(df, max);
				exp.Append(" ");
				exp.Append(term.Text());
				exp.Append("=");
				exp.Append(df);
			}
			float fIdf = idf2;
			return new AnonymousClassIDFExplanation3(fIdf, exp, this);
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:38,代码来源:Similarity.cs

示例2: Idf

		public virtual float Idf(Term term, Searcher searcher)
		{
			return Idf(searcher.DocFreq(term), searcher.MaxDoc());
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:Similarity.cs

示例3: IdfExplain

		/// <summary> Computes a score factor for a simple term and returns an explanation
		/// for that score factor.
		/// 
		/// <p/>
		/// The default implementation uses:
		/// 
		/// <pre>
		/// idf(searcher.docFreq(term), searcher.maxDoc());
		/// </pre>
		/// 
		/// Note that {@link Searcher#MaxDoc()} is used instead of
		/// {@link Lucene.Net.Index.IndexReader#NumDocs()} because it is
		/// proportional to {@link Searcher#DocFreq(Term)} , i.e., when one is
		/// inaccurate, so is the other, and in the same direction.
		/// 
		/// </summary>
		/// <param name="term">the term in question
		/// </param>
		/// <param name="searcher">the document collection being searched
		/// </param>
		/// <returns> an IDFExplain object that includes both an idf score factor 
		/// and an explanation for the term.
		/// </returns>
		/// <throws>  IOException </throws>
		public virtual IDFExplanation IdfExplain(Term term, Searcher searcher)
		{
			if (SupportedMethods.overridesTermIDF)
			{
				float idf = Idf(term, searcher);
				return new AnonymousClassIDFExplanation(idf, this);
			}
			int df = searcher.DocFreq(term);
			int max = searcher.MaxDoc();
			float idf2 = Idf(df, max);
			return new AnonymousClassIDFExplanation1(df, max, idf2, this);
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:36,代码来源:Similarity.cs

示例4: idfExplain

		/// <summary> Computes a score factor for a phrase.
		/// 
		/// <p/>
		/// The default implementation sums the idf factor for
		/// each term in the phrase.
		/// 
		/// </summary>
		/// <param name="terms">the terms in the phrase
		/// </param>
		/// <param name="searcher">the document collection being searched
		/// </param>
		/// <returns> an IDFExplain object that includes both an idf 
		/// score factor for the phrase and an explanation 
		/// for each term.
		/// </returns>
		/// <throws>  IOException </throws>
		public virtual IDFExplanation idfExplain(IList<Lucene.Net.Index.Term> terms, Searcher searcher)
		{
			if (SupportedMethods.overridesCollectionIDF)
			{
				float idf = Idf(terms, searcher);
                return new IDFExplanation
                {
                    GetIdf = () => idf,
                    Explain = () => "Inexplicable"
                };
			}
			int max = searcher.MaxDoc();
			float idf2 = 0.0f;
			System.Text.StringBuilder exp = new System.Text.StringBuilder();
            foreach (Term term in terms)
			{
				int df = searcher.DocFreq(term);
				idf2 += Idf(df, max);
				exp.Append(" ");
				exp.Append(term.Text());
				exp.Append("=");
				exp.Append(df);
			}
			float fIdf = idf2;
            return new IDFExplanation
            {
                GetIdf = () => fIdf,
                Explain = () => exp.ToString()
            };
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:46,代码来源:Similarity.cs

示例5: IdfExplain

		/// <summary> Computes a score factor for a simple term and returns an explanation
		/// for that score factor.
		/// 
		/// <p/>
		/// The default implementation uses:
		/// 
		/// <pre>
		/// idf(searcher.docFreq(term), searcher.maxDoc());
		/// </pre>
		/// 
		/// Info: <see cref="Searcher.MaxDoc()"/> is used instead of
        /// <see cref="Lucene.Net.Index.IndexReader.NumDocs()"/> because it is
        /// proportional to <see cref="Searcher.DocFreq(Term)"/> , i.e., when one is
		/// inaccurate, so is the other, and in the same direction.
		/// 
		/// </summary>
		/// <param name="term">the term in question
		/// </param>
		/// <param name="searcher">the document collection being searched
		/// </param>
		/// <returns> an IDFExplain object that includes both an idf score factor 
		/// and an explanation for the term.
		/// </returns>
		/// <throws>  IOException </throws>
		public virtual IDFExplanation IdfExplain(Term term, Searcher searcher)
		{
			if (SupportedMethods.overridesTermIDF)
			{
				float idf = Idf(term, searcher);
                return new IDFExplanation 
                { GetIdf = () => idf, 
                  Explain = () => "Inexplicable"
                };

			}
			int df = searcher.DocFreq(term);
			int max = searcher.MaxDoc();
			float idf2 = Idf(df, max);
            return new IDFExplanation
            {
                GetIdf = () => idf2,
                Explain = () => "idf(docFreq=" + df + ", maxDocs=" + max + ")"
            };

		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:45,代码来源:Similarity.cs

示例6: IdfExplain

		/// <summary> Computes a score factor for a phrase.
		/// 
		/// <p/>
		/// The default implementation sums the idf factor for
		/// each term in the phrase.
		/// 
		/// </summary>
		/// <param name="terms">the terms in the phrase
		/// </param>
		/// <param name="searcher">the document collection being searched
		/// </param>
		/// <returns> an IDFExplain object that includes both an idf 
		/// score factor for the phrase and an explanation 
		/// for each term.
		/// </returns>
		/// <throws>  IOException </throws>
		public virtual IDFExplanation IdfExplain(ICollection<Term> terms, Searcher searcher)
		{
			int max = searcher.MaxDoc;
			float idf2 = 0.0f;
			System.Text.StringBuilder exp = new System.Text.StringBuilder();
            foreach (Term term in terms)
			{
				int df = searcher.DocFreq(term);
				idf2 += Idf(df, max);
				exp.Append(" ");
				exp.Append(term.Text);
				exp.Append("=");
				exp.Append(df);
			}
			float fIdf = idf2;
			return new AnonymousClassIDFExplanation3(fIdf, exp, this);
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:33,代码来源:Similarity.cs

示例7: MultiPhraseWeight

 public MultiPhraseWeight(MultiPhraseQuery enclosingInstance, Searcher searcher)
 {
     InitBlock(enclosingInstance);
     this.similarity = Enclosing_Instance.GetSimilarity(searcher);
     
     // compute idf
     int maxDoc = searcher.MaxDoc;
     foreach (Term[] terms in enclosingInstance.termArrays)
     {
         foreach (Term term in terms)
         {
             idf += similarity.Idf(searcher.DocFreq(term), maxDoc);
         }
     }
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:15,代码来源:MultiPhraseQuery.cs


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