Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text<-'this is a long text. its not an email'
- text0<-'another piece of text'
- text1<-'last sentence of nonsense'
- all.text<-list(text,text0,text1)
- features1<-data.frame(start=c(1,3,5,7),end=c(2,5,9,12),type=c('na','person','person','location'))
- features2<-data.frame(start=c(1,3,5,7),end=c(2,5,9,12),type=c('na','person','person','location'))
- features3<-data.frame(start=c(7,8,10,12),end=c(9,9,11,15),type=c('na','person','person','location'))
- all.features<-list(features1,features2, features3)
- one.text<-NULL for (i in 1:nrow(features1)) one.text[i]<-((substr(text,features1[i,1],features1[i,2])))
- features1$word<-one.text
- named.get<-function(text.list,features.list){
- named.entities<-substr(text.list,features.list[,1],features.list[,2])
- }
- all<-sapply(all.text,named.get,all.features)
- one.obj<-NULL
- two.obj<-NULL
- for(i in 1:length(all.text)){
- for (j in 1:length(all.features)){
- one.obj[j]<-list([i]<-((substr(all.text[i],all.features[[i]][j,1],all.features[[i]][j,2]))))
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement