Ejemplo n.º 1
0
        public double TFIDFSimilarity(Document <T> query, Corpus <T> corpus)
        {
            double[] queryWeights    = corpus.Select(term => query.TFIDF(term, corpus)).ToArray();
            double[] documentWeights = corpus.Select(term => TFIDF(term, corpus)).ToArray();

            var vectorSpaceModel = new VectorSpaceModel(queryWeights, documentWeights);

            return(vectorSpaceModel.CalculateCosineSimilarity());
        }
Ejemplo n.º 2
0
 public double TFIDF(T term, Corpus <T> corpus)
 {
     return(TFIDF(term, corpus, AugmentedTermFrequency));
 }
Ejemplo n.º 3
0
 public double TFIDF(T term, Corpus <T> corpus, Func <T, double> termFrequencyFunction)
 {
     return(termFrequencyFunction(term) * corpus.IDF(term));
 }