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 19, Sun Nov 6 15:38:48 2005 UTC revision 20, Tue Nov 8 16:40:52 2005 UTC
# Line 2  Line 2 
2    
3  # S4 class definition  # S4 class definition
4  # Text document collection  # Text document collection
 # TODO: Define proper S4 term-document matrix  
5  setClass("textdoccol", representation(docs = "list",  setClass("textdoccol", representation(docs = "list",
6                                        tdm = "matrix"))                                        tdm = "termdocmatrix"))
7    
8  # Accessor function  # Accessor function
9  if (!isGeneric("docs")) {  if (!isGeneric("docs")) {
# Line 22  Line 21 
21      require(XML)      require(XML)
22    
23      tree <- xmlTreeParse(object)      tree <- xmlTreeParse(object)
24      new("textdoccol", docs = xmlApply(xmlRoot(tree), parseNewsItem), tdm = matrix())      new("textdoccol", docs = xmlApply(xmlRoot(tree), parseNewsItem))
25  })  })
26    
27  # TODO: Implement lacking fields.  # TODO: Implement lacking fields.
# Line 40  Line 39 
39      new("textdocument", author = author, timestamp = timestamp, description = description,      new("textdocument", author = author, timestamp = timestamp, description = description,
40          id = id, origin = origin, corpus = corpus, heading = heading)          id = id, origin = origin, corpus = corpus, heading = heading)
41  }  }
42    
43    # If necessary build the term-document matrix for a given text document collection
44    setGeneric("buildTDM", function(object) standardGeneric("buildTDM"))
45    setMethod("buildTDM", "textdoccol", function(object) {
46        termdocmatrix(docs(object))
47    })

Legend:
Removed from v.19  
changed lines
  Added in v.20

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