SCM

SCM Repository

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

Annotation of /trunk/tm/R/textrepo.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (view) (download)
Original Path: trunk/R/textmin/R/textrepo.R

1 : feinerer 52 # Author: Ingo Feinerer
2 :    
3 :     setGeneric("TextRepository", function(object, metaname = "created", meta = date()) standardGeneric("TextRepository"))
4 :     setMethod("TextRepository",
5 :     c("TextDocCol"),
6 :     function(object, metaname, meta) {
7 :     tr <- new("TextRepository", .Data = list(object), RepresentationMetaData = list(created = meta))
8 :     names(tr@RepresentationMetaData) <- metaname
9 :     return(tr)
10 :     })
11 :    
12 :     setMethod("attachData",
13 :     c("TextRepository","TextDocCol"),
14 :     function(object, data) {
15 :     object@.Data <- as(c(object@.Data, data), "TextRepository")
16 :     return(object)
17 :     })
18 :    
19 :     setMethod("attachMetaData",
20 :     c("TextRepository"),
21 :     function(object, name, metadata) {
22 :     object@RepresentationMetaData <- c(object@RepresentationMetaData, new = list(metadata))
23 :     names(object@RepresentationMetaData)[length(names(object@RepresentationMetaData))] <- name
24 :     return(object)
25 :     })
26 : feinerer 54
27 :     setMethod("length",
28 :     signature(x = "TextRepository"),
29 :     function(x){
30 :     return(length(as(x, "list")))
31 :     })
32 :    
33 :     setMethod("show",
34 :     signature(object = "TextRepository"),
35 :     function(object){
36 :     cat("A text repository with", length(object), "text document collection")
37 :     if (length(object) == 1)
38 :     cat("\n")
39 :     else
40 :     cat("s\n")
41 :     })
42 :    
43 :     setMethod("summary",
44 :     signature(object = "TextRepository"),
45 :     function(object){
46 :     show(object)
47 :     if (length(RepresentationMetaData(object)) > 0) {
48 :     cat("\nThe representation metadata consists of", length(RepresentationMetaData(object)), "tag-value pair")
49 :     if (length(RepresentationMetaData(object)) == 1)
50 :     cat(".\n")
51 :     else
52 :     cat("s.\n")
53 :     cat("Available tags are:\n")
54 :     cat(names(RepresentationMetaData(object)), "\n")
55 :     }
56 :     })

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