SCM

SCM Repository

[tm] Annotation of /trunk/tm/R/distmeasure.R
ViewVC logotype

Annotation of /trunk/tm/R/distmeasure.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 63 - (view) (download)
Original Path: trunk/R/textmin/R/distmeasure.R

1 : feinerer 52 # Author: Ingo Feinerer
2 :    
3 : feinerer 53 setGeneric("dissimilarity", function(x, y, method) standardGeneric("dissimilarity"))
4 :     setMethod("dissimilarity",
5 :     signature(x = "TermDocMatrix", y = "ANY", method = "character"),
6 : feinerer 63 function(x, y = NULL, method) {
7 :     # Until factored out in a seperate package
8 :     # use the \code{dists} function from the \pkg{cba} package
9 :     dists(x, y, method)
10 : feinerer 53 })
11 :     setMethod("dissimilarity",
12 :     c("TextDocument", "TextDocument", "character"),
13 :     function(x, y, method) {
14 :     tdm <- TermDocMatrix(as(list(x,y), "TextDocCol"))
15 :     dissim <- dissimilarity(tdm, method = method)
16 :     class(dissim) <- "dist"
17 :     return(dissim)
18 :     })

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge