NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//This Analysis will combine tf/idf and term count and spanquery scores but apply adjusting weights from app setting
//I found an issue here. TFIDF is never used
private void btnCustAnal3_Click(object sender, EventArgs e)
{
//perform a rank search and store the results
TopDocs rankSearch = simpleRank();
TopDocs spanSearch = spanQuery();
TopDocs tfIdfSearch = tfIdfQuery();
if (rankSearch != null && spanSearch != null && tfIdfSearch != null)
{
directory = FSDirectory.Open(new DirectoryInfo(appDefaultindexPath));
IndexReader indexReader = IndexReader.Open(directory, true);
IndexSearcher indexSearch = new IndexSearcher(indexReader);
BooleanQuery booleanquery = new BooleanQuery();
String tmp = "";
String docText = "";
String strTypeSearch = "B Analysis";//"Rank and Span Query with IDF Tie Breakers";
var spanHit = spanSearch.ScoreDocs.OrderByDescending(o => o.Score).ToList();
var tfHit = tfIdfSearch.ScoreDocs.OrderByDescending(s => s.Score).ToList();
//I am not certain but I think this is wrong it is applying a tfidf score if there is no span score
//Tuesday this is not where the issue is.
//String outPut = "";
//foreach (ScoreDoc rd in rankSearch.ScoreDocs)
//{
// outPut += rd.Score.ToString() + ", ";
//}
//MessageBox.Show(outPut.ToString());
//Friday 3-2 I may need to add tf idf to each here regardless of spans object
float highestRank = rankSearch.MaxScore;
//MessageBox.Show("The highest rank is: " + highestRank.ToString());
float minRank = 0;
foreach (ScoreDoc rd in rankSearch.ScoreDocs)
{

var thsSd = spanHit.Find(o => o.Doc == rd.Doc);
var thsTf = tfHit.Find(s => s.Doc == rd.Doc);
//Normalize the TF and SPAN score so it never overwhelms the Rank of 1
//if (rd.Score > 2) { MessageBox.Show("Rank score is: " + rd.ToString()); }

//MessageBox.Show("The highes rank: " + rd.Score);
//if this is found there is a span hit document
if (thsSd != null)
{
rd.Score += Math.Abs((thsSd.Score - minRank) / (highestRank - minRank));
//rd.Score += thsSd.Score;
}
//2-9-17 removed the else from this. it is double counting
//else //there is no span to score just use the tf idf score
//{
//var thsTf = tfHit.Find(s => s.Doc == rd.Doc);
else if (thsTf != null)
{
//MessageBox.Show("No Span query");
//rd.Score = rd.Score + (thsTf.Score * tfRatio);
///MessageBox.Show("RdScore = " + rd.Score.ToString() + " new:" + (rd.Score + thsTf.Score).ToString());
rd.Score += Math.Abs((thsTf.Score - minRank) / (highestRank - minRank));
//rd.Score += thsTf.Score;
//var documentTest = indexSearch.Doc(rd.Doc);
//String sf = documentTest.Get("BODY");
//String[] phrs = sf.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
//sf
//indexSearch.Explain()
//phrs.Length();

//MessageBox.Show("Terms in Doc: " + rd.Doc.ToString());
}
//}
}
var hits = rankSearch.ScoreDocs.OrderByDescending(o => o.Score).ToList();
//just get the size we want
int sz = Convert.ToInt32(cmbBoxReturnSize.Text);
int cntr = 0;
foreach (var hit in hits)
{
if (cntr >= sz)
{
break;
}
var documentFromSearch = indexSearch.Doc(hit.Doc);
docText = documentFromSearch.Get("BODY");
tmp = documentFromSearch.Get("CCR");
//look for duplicate
var ths = scoredDocs.Where(c => c.ccr == tmp);
if (ths.Count() < 1)
{
scoredDocs.Add(new scrDoc(hit.Doc, tmp, hit.Score, docText));
}
//scoredDocs.Add(new scrDoc(hit.Doc, tmp, hit.Score, docText));
cntr++;
}
//now lets create the child form to display them
if (this.OwnedForms.Count() < 1)
{
intCntofChildren = 1;
}
else
{
intCntofChildren++;
}
Form srchResultForm = new SAT_Tool.ScoreForm(indexReader, indexSearch, booleanquery, scoredDocs, appDefaultindexPath, corpusDefaultPath, SrcTrms, SynTrms, phraseSlop, intCntofChildren, strTypeSearch, getQuery());
srchResultForm.Owner = this;
srchResultForm.Show();
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.