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 831, Wed Mar 12 09:10:46 2008 UTC revision 833, Fri Mar 21 10:55:11 2008 UTC
# Line 168  Line 168 
168                        db[[id]] <- FUN(object[[i]], ..., DMetaData = DMetaData(object))                        db[[id]] <- FUN(object[[i]], ..., DMetaData = DMetaData(object))
169                        i <- i + 1                        i <- i + 1
170                    }                    }
171                      # Suggested by Christian Buchta
172                      dbReorganize(db)
173                }                }
174                else {                else {
175                    # Lazy mapping                    # Lazy mapping
# Line 190  Line 192 
192            })            })
193    
194  # Materialize lazy mappings  # Materialize lazy mappings
195    # Improvements by Christian Buchta
196  materialize <- function(corpus, range = seq_along(corpus)) {  materialize <- function(corpus, range = seq_along(corpus)) {
197      lazyTmMap <- meta(corpus, tag = "lazyTmMap", type = "corpus")      lazyTmMap <- meta(corpus, tag = "lazyTmMap", type = "corpus")
198      if (!is.null(lazyTmMap)) {      if (!is.null(lazyTmMap)) {
199          for (i in range)         # Make valid and lazy index
200              if (lazyTmMap$index[i]) {         idx <- (seq_along(corpus) %in% range) & lazyTmMap$index
201                  res <- loadDoc(corpus@.Data[[i]])         if (any(idx)) {
202               res <- lapply(corpus@.Data[idx], loadDoc)
203                  for (m in lazyTmMap$maps)                  for (m in lazyTmMap$maps)
204                      res <- m(res, DMetaData = DMetaData(corpus))                 res <- lapply(res, m, DMetaData = DMetaData(corpus))
205                  corpus@.Data[[i]] <- res             corpus@.Data[idx] <- res
206                  lazyTmMap$index[i] <- FALSE             lazyTmMap$index[idx] <- FALSE
207              }              }
208      }      }
209      # Clean up if everything is materialized      # Clean up if everything is materialized

Legend:
Removed from v.831  
changed lines
  Added in v.833

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