SCM

SCM Repository

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

Diff of /pkg/R/reader.R

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

revision 1480, Fri Apr 28 15:13:08 2017 UTC revision 1481, Sat May 20 10:28:00 2017 UTC
# Line 10  Line 10 
10    
11  getReaders <-  getReaders <-
12  function()  function()
13      c("readDOC", "readPDF", "readPlain", "readRCV1", "readRCV1asPlain",      c("readDataframe", "readDOC", "readPDF", "readPlain", "readRCV1",
14        "readReut21578XML", "readReut21578XMLasPlain", "readTabular",        "readRCV1asPlain", "readReut21578XML", "readReut21578XMLasPlain",
15        "readTagged", "readXML")        "readTagged", "readXML")
16    
17  prepareReader <-  prepareReader <-
# Line 35  Line 35 
35      uri      uri
36  }  }
37    
38    readDataframe <-
39    function(elem, language, id) {
40        PlainTextDocument(elem$content[, "text"],
41                          id = elem$content[, "doc_id"],
42                          language = language)
43    }
44    
45  # readDOC needs antiword installed to be able to extract the text  # readDOC needs antiword installed to be able to extract the text
46  readDOC <-  readDOC <-
47  function(engine = c("antiword", "executable"),  function(engine = c("antiword", "executable"),
# Line 189  Line 196 
196                   list(content = list("node", "/REUTERS/TEXT/BODY"))),                   list(content = list("node", "/REUTERS/TEXT/BODY"))),
197          doc = PlainTextDocument())          doc = PlainTextDocument())
198    
 readTabular <-  
 function(mapping)  
 {  
     stopifnot(is.list(mapping))  
     function(elem, language, id) {  
         meta <- lapply(mapping[setdiff(names(mapping), "content")],  
                        function(m) elem$content[, m])  
         if (is.null(meta$id))  
             meta$id <- as.character(id)  
         if (is.null(meta$language))  
             meta$language <- as.character(language)  
         PlainTextDocument(elem$content[, mapping$content], meta = meta)  
     }  
 }  
 class(readTabular) <- c("FunctionGenerator", "function")  
   
199  readTagged <-  readTagged <-
200  function(...)  function(...)
201  {  {

Legend:
Removed from v.1480  
changed lines
  Added in v.1481

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