/*
* tf/idf implementation
* Author: Thanh Dao, thanh.dao@gmx.net
*/
using System;
using System.Collections;
using System.Collections.Generic;
using WawaSoft.Search.Common;
namespace WawaSoft.Search.Common
{
/// <summary>
/// Summary description for TF_IDFLib.
/// </summary>
public class TFIDFMeasure
{
private string[] _docs;
private string[][] _ngramDoc;
private int _numDocs=0;
private int _numTerms=0;
private ArrayList _terms;
private int[][] _termFreq;
private float[][] _termWeight;
private int[] _maxTermFreq;
private int[] _docFreq;
private float[] GetTermVector(int doc)
{
float[] w=new float[NumTerms] ;
for (int i=0; i < NumTerms; i++)
w=_termWeight[doc];
return w;
}
public double [] GetTermVector2(int doc)
{
double [] ret = new double[NumTerms];
float[] w = GetTermVector(doc);
for (int i = 0; i < ret.Length; i++ )
{
ret = w;
}
return ret;
}
public double GetSimilarity(int doc_i, int doc_j)
{
double [] vector1=GetTermVector2 (doc_i);
double [] vector2=GetTermVector2 (doc_j);