SCM

SCM Repository

[tm] Diff of /pkg/R/corpus.R
ViewVC logotype

Diff of /pkg/R/corpus.R

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

revision 689, Fri Dec 8 14:21:46 2006 UTC revision 690, Sat Dec 16 17:22:56 2006 UTC
# Line 1  Line 1 
1  # Author: Ingo Feinerer  # Author: Ingo Feinerer
2    
3  # The "..." are additional arguments for the function_generator parser  # The "..." are additional arguments for the function_generator parser
4  setGeneric("TextDocCol", function(object, parser = plaintext_parser, ...) standardGeneric("TextDocCol"))  setGeneric("TextDocCol", function(object, parser = read_plain, ...) standardGeneric("TextDocCol"))
5  setMethod("TextDocCol",  setMethod("TextDocCol",
6            signature(object = "Source"),            signature(object = "Source"),
7            function(object, parser = plaintext_parser, ...) {            function(object, parser = read_plain, ...) {
8                if (inherits(parser, "function_generator"))                if (inherits(parser, "function_generator"))
9                    parser <- parser(...)                    parser <- parser(...)
10    
# Line 82  Line 82 
82                }                }
83            })            })
84    
85  setGeneric("tm_update", function(object, origin, parser = plaintext_parser, ...) standardGeneric("tm_update"))  setGeneric("tm_update", function(object, origin, parser = read_plain, ...) standardGeneric("tm_update"))
86  # Update is only supported for directories  # Update is only supported for directories
87  # At the moment no other LoD devices are available anyway  # At the moment no other LoD devices are available anyway
88  setMethod("tm_update",  setMethod("tm_update",
89            signature(object = "TextDocCol", origin = "DirSource"),            signature(object = "TextDocCol", origin = "DirSource"),
90            function(object, origin, parser = plaintext_parser, ...) {            function(object, origin, parser = read_plain, ...) {
91                if (inherits(parser, "function_generator"))                if (inherits(parser, "function_generator"))
92                    parser <- parser(...)                    parser <- parser(...)
93    
# Line 103  Line 103 
103                return(object)                return(object)
104            })            })
105    
106  setGeneric("tm_transform", function(object, FUN, ...) standardGeneric("tm_transform"))  setGeneric("tm_map", function(object, FUN, ...) standardGeneric("tm_map"))
107  setMethod("tm_transform",  setMethod("tm_map",
108            signature(object = "TextDocCol", FUN = "function"),            signature(object = "TextDocCol", FUN = "function"),
109            function(object, FUN, ...) {            function(object, FUN, ...) {
110                result <- object                result <- object
# Line 113  Line 113 
113                return(result)                return(result)
114            })            })
115    
116  setGeneric("as.plaintext_doc", function(object, FUN, ...) standardGeneric("as.plaintext_doc"))  setGeneric("as.plain", function(object, FUN, ...) standardGeneric("as.plain"))
117  setMethod("as.plaintext_doc",  setMethod("as.plain",
118            signature(object = "PlainTextDocument"),            signature(object = "PlainTextDocument"),
119            function(object, FUN, ...) {            function(object, FUN, ...) {
120                return(object)                return(object)
121            })            })
122  setMethod("as.plaintext_doc",  setMethod("as.plain",
123            signature(object = "XMLTextDocument", FUN = "function"),            signature(object = "XMLTextDocument", FUN = "function"),
124            function(object, FUN, ...) {            function(object, FUN, ...) {
125                corpus <- Corpus(object)                corpus <- Corpus(object)
# Line 247  Line 247 
247      return(result)      return(result)
248  }  }
249    
250  setGeneric("fulltext_search_filter", function(object, pattern, ...) standardGeneric("fulltext_search_filter"))  setGeneric("search_fulltext", function(object, pattern, ...) standardGeneric("search_fulltext"))
251  setMethod("fulltext_search_filter",  setMethod("search_fulltext",
252            signature(object = "PlainTextDocument", pattern = "character"),            signature(object = "PlainTextDocument", pattern = "character"),
253            function(object, pattern, ...) {            function(object, pattern, ...) {
254                return(any(grep(pattern, Corpus(object))))                return(any(grep(pattern, Corpus(object))))
# Line 350  Line 350 
350            })            })
351    
352  # Update \code{NodeID}s of a DCMetaData tree  # Update \code{NodeID}s of a DCMetaData tree
 # TODO: Avoid global variables outside of update_id function  
353  update_id <- function(object) {  update_id <- function(object) {
354      id <<- 0      id <<- 0
355      mapping <<- left.mapping <<- NULL      mapping <<- left.mapping <<- NULL

Legend:
Removed from v.689  
changed lines
  Added in v.690

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge