SCM

SCM Repository

[tm] Diff of /trunk/R/textmin/R/textrepo.R
ViewVC logotype

Diff of /trunk/R/textmin/R/textrepo.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 62, Tue Oct 24 10:08:58 2006 UTC revision 70, Tue Nov 7 18:18:51 2006 UTC
# Line 9  Line 9 
9                return(tr)                return(tr)
10            })            })
11    
12  setMethod("attachData",  setMethod("attach_data",
13            signature(object = "TextRepository", data = "TextDocCol"),            signature(object = "TextRepository", data = "TextDocCol"),
14            function(object, data) {            function(object, data) {
15                object@.Data <- as(c(object@.Data, data), "TextRepository")                object[[length(object)+1]] <- data
16                return(object)                return(object)
17            })            })
18    
19  setMethod("attachMetaData",  setMethod("attach_metadata",
20            signature(object = "TextRepository"),            signature(object = "TextRepository"),
21            function(object, name, metadata) {            function(object, name, metadata) {
22                object@RepresentationMetaData <- c(object@RepresentationMetaData, new = list(metadata))                object@RepresentationMetaData <- c(object@RepresentationMetaData, new = list(metadata))
# Line 24  Line 24 
24                return(object)                return(object)
25            })            })
26    
27    setMethod("remove_metadata",
28              signature(object = "TextRepository"),
29              function(object, name) {
30                  object@RepresentationMetaData <- RepresentationMetaData(object)[names(RepresentationMetaData(object)) != name]
31                  return(object)
32              })
33    
34    setMethod("modify_metadata",
35              signature(object = "TextRepository"),
36              function(object, name, metadata) {
37                  object@RepresentationMetaData[[name]] <- metadata
38                  return(object)
39              })
40    
41  setMethod("length",  setMethod("length",
42            signature(x = "TextRepository"),            signature(x = "TextRepository"),
43            function(x){            function(x){
# Line 33  Line 47 
47  setMethod("show",  setMethod("show",
48            signature(object = "TextRepository"),            signature(object = "TextRepository"),
49            function(object){            function(object){
50                cat("A text repository with", length(object), "text document collection")                 cat(sprintf(ngettext(length(object),
51                if (length(object) == 1)                                      "A text repository with %d text document collection\n",
52                    cat("\n")                                      "A text repository with %d text document collections\n"),
53                else                             length(object)))
                   cat("s\n")  
54      })      })
55    
56  setMethod("summary",  setMethod("summary",
# Line 45  Line 58 
58            function(object){            function(object){
59                show(object)                show(object)
60                if (length(RepresentationMetaData(object)) > 0) {                if (length(RepresentationMetaData(object)) > 0) {
61                    cat("\nThe representation metadata consists of", length(RepresentationMetaData(object)), "tag-value pair")                    cat(sprintf(ngettext(length(RepresentationMetaData(object)),
62                    if (length(RepresentationMetaData(object)) == 1)                                                "\nThe representation metadata consists of %d tag-value pair\n",
63                        cat(".\n")                                                "\nThe representation metadata consists of %d tag-value pairs\n"),
64                    else                                         length(RepresentationMetaData(object))))
                       cat("s.\n")  
65                    cat("Available tags are:\n")                    cat("Available tags are:\n")
66                    cat(names(RepresentationMetaData(object)), "\n")                    cat(names(RepresentationMetaData(object)), "\n")
67                }                }

Legend:
Removed from v.62  
changed lines
  Added in v.70

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