SCM

SCM Repository

[rqda] Diff of /pkg/RQDAtm/R/RQDAtm.R
ViewVC logotype

Diff of /pkg/RQDAtm/R/RQDAtm.R

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

revision 311, Wed Apr 21 03:38:01 2010 UTC revision 312, Mon Apr 26 05:10:56 2010 UTC
# Line 157  Line 157 
157          return(z)          return(z)
158  }  }
159    
160  RQDA2tm <- function(Code,language="french"){  RQDA2tm <- function(Code,language="eng"){
161    ## require("tm", quietly = TRUE)    ## require("tm", quietly = TRUE)
162    retrieval <- NULL    retrieval <- NULL
163    currentCode <- Code    currentCode <- Code
164    if (length(currentCode)!=0)    if (length(currentCode)!=0)
165      {      {
166        Encoding(currentCode) <- "UTF-8"        Encoding(currentCode) <- "UTF-8"
167        currentCid <- dbGetQuery(.rqda$qdacon,sprintf("select id from freecode where name== '%s' ",currentCode))[1,1]          currentCid <- RQDAQuery(sprintf("select id from freecode where name== '%s' ",currentCode))[1,1]
168        ## reliable is more important        ## reliable is more important
169        if(!is.null(currentCid))        if(!is.null(currentCid))
170          {          {
171            retrieval <- dbGetQuery(.rqda$qdacon,sprintf("select cid,fid, selfirst, selend,seltext from coding where status==1 and cid=%i",as.numeric(currentCid)))              retrieval <- RQDAQuery(sprintf("select cid,fid, selfirst, selend,seltext from coding where status==1 and cid=%i",as.numeric(currentCid)))
172            if (nrow(retrieval)!=0)            if (nrow(retrieval)!=0)
173                                  {                                  {
174                                    retrieval <-  retrieval[order( retrieval$fid),]                                    retrieval <-  retrieval[order( retrieval$fid),]
# Line 176  Line 176 
176                                    retrieval$fname <-""                                    retrieval$fname <-""
177                                    for (i in fid)                                    for (i in fid)
178                                          {                                          {
179                                            FileName <- dbGetQuery(.rqda$qdacon,sprintf("select name from source where status==1 and id==%i",i))[['name']]                      FileName <- RQDAQuery(sprintf("select name from source where status==1 and id==%i",i))[['name']]
180                                            tryCatch(Encoding(FileName) <- "UTF-8",error=function(e){})                                            tryCatch(Encoding(FileName) <- "UTF-8",error=function(e){})
181                                            retrieval$fname[retrieval$fid==i] <- FileName                                            retrieval$fname[retrieval$fid==i] <- FileName
182                                          }                                          }
# Line 184  Line 184 
184                                  }                                  }
185          }          }
186      }      }
187    retrived <- tm:::Corpus(tm:::VectorSource(retrieval$seltext), readerControl = list( language = language))      retrived <- tm:::Corpus(tm::VectorSource(retrieval$seltext), readerControl = list( language = language))
188    retrieval$seltext <- NULL    retrieval$seltext <- NULL
189    retrived <- tm:::appendMeta(retrived, dmeta = retrieval)      meta(retrived,tag=names(retrieval)) <- retrieval
190    return(retrived)    return(retrived)
191  }  }
192    

Legend:
Removed from v.311  
changed lines
  Added in v.312

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