SCM

SCM Repository

[tm] Diff of /trunk/tm/R/textdoccol.R
ViewVC logotype

Diff of /trunk/tm/R/textdoccol.R

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

revision 715, Wed Mar 14 15:16:27 2007 UTC revision 717, Fri Mar 16 11:13:04 2007 UTC
# Line 2  Line 2 
2    
3  # The "..." are additional arguments for the FunctionGenerator parser  # The "..." are additional arguments for the FunctionGenerator parser
4  setGeneric("TextDocCol", function(object,  setGeneric("TextDocCol", function(object,
5                                    parser = readPlain,                                    parserControl = list(parser = readPlain, language = "en_US", load = FALSE),
                                   load = FALSE,  
6                                    dbControl = list(useDb = FALSE, dbName = "", dbType = "DB1"),                                    dbControl = list(useDb = FALSE, dbName = "", dbType = "DB1"),
7                                    ...) standardGeneric("TextDocCol"))                                    ...) standardGeneric("TextDocCol"))
8  setMethod("TextDocCol",  setMethod("TextDocCol",
9            signature(object = "Source"),            signature(object = "Source"),
10            function(object, parser = readPlain, load = FALSE, dbControl = list(useDb = FALSE, dbName = "", dbType = "DB1"), ...) {            function(object,
11                if (inherits(parser, "FunctionGenerator"))                     parserControl = list(parser = readPlain, language = "en_US", load = FALSE),
12                    parser <- parser(...)                     dbControl = list(useDb = FALSE, dbName = "", dbType = "DB1"),
13                       ...) {
14                  if (inherits(parserControl$parser, "FunctionGenerator"))
15                      parserControl$parser <- parserControl$parser(...)
16    
17                if (dbControl$useDb) {                if (dbControl$useDb) {
18                    if (!dbCreate(dbControl$dbName, dbControl$dbType))                    if (!dbCreate(dbControl$dbName, dbControl$dbType))
# Line 26  Line 28 
28                    # If there is no Load on Demand support                    # If there is no Load on Demand support
29                    # we need to load the corpus into memory at startup                    # we need to load the corpus into memory at startup
30                    if (!object@LoDSupport)                    if (!object@LoDSupport)
31                        load <- TRUE                        parserControl$load <- TRUE
32                    doc <- parser(elem, load, as.character(counter))                    doc <- parserControl$parser(elem, parserControl$load, parserControl$language, as.character(counter))
33                    if (dbControl$useDb) {                    if (dbControl$useDb) {
34                        dbInsert(db, ID(doc), doc)                        dbInsert(db, ID(doc), doc)
35                        tdl <- c(tdl, ID(doc))                        tdl <- c(tdl, ID(doc))
# Line 104  Line 106 
106                }                }
107            })            })
108    
109    # TODO: Check regarding new TextDocCol signature
110  setGeneric("tmUpdate", function(object, origin, parser = readPlain, ...) standardGeneric("tmUpdate"))  setGeneric("tmUpdate", function(object, origin, parser = readPlain, ...) standardGeneric("tmUpdate"))
111  # Update is only supported for directories  # Update is only supported for directories
112  # At the moment no other LoD devices are available anyway  # At the moment no other LoD devices are available anyway

Legend:
Removed from v.715  
changed lines
  Added in v.717

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