Comments (4)
Try the dev branch rather than the cran version. And why start with tm at all? Will look at this in more detail next week.
Ken
Sent from my iPhone
On 1 May 2015, at 13:38, adamramey <[email protected]mailto:[email protected]> wrote:
I've tried to get a directory of texts in to a quanteda corpus with some issues. First, I make a VCorpus using the DirSource function in tm. Second, I try to make the object a quanteda corpus. However, I get the error "no applicable method for 'corpus' applied to an object of class "list."" But it's not a list; I've checked the files and everything seems sound.
library(quanteda)
library(tm)
Loading required package: NLP
Attaching package: 'tm'
The following objects are masked from 'package:quanteda':
as.DocumentTermMatrix, stopwords
ds <- VCorpus(DirSource("~/Desktop/Speeches/House/2000/"))
##make it a quanteda object
txts <- corpus(ds)
Error in UseMethod("corpus") :
no applicable method for 'corpus' applied to an object of class "list"
class(ds)
[1] "VCorpus" "Corpus"
Reply to this email directly or view it on GitHubhttps://github.com//issues/37.
from quanteda.
Was using the dev branch...there used to be a directory function in
quanteda to get a directory of text in, but it seems to be gone. Is there a
new way to do that?
On Fri, May 1, 2015 at 4:46 PM, Kenneth Benoit [email protected]
wrote:
Try the dev branch rather than the cran version. And why start with tm at
all? Will look at this in more detail next week.Ken
Sent from my iPhone
On 1 May 2015, at 13:38, adamramey <[email protected]<mailto:
[email protected]>> wrote:I've tried to get a directory of texts in to a quanteda corpus with some
issues. First, I make a VCorpus using the DirSource function in tm. Second,
I try to make the object a quanteda corpus. However, I get the error "no
applicable method for 'corpus' applied to an object of class "list."" But
it's not a list; I've checked the files and everything seems sound.library(quanteda)
library(tm)
Loading required package: NLPAttaching package: 'tm'
The following objects are masked from 'package:quanteda':
as.DocumentTermMatrix, stopwords
ds <- VCorpus(DirSource("~/Desktop/Speeches/House/2000/"))
##make it a quanteda object
txts <- corpus(ds)
Error in UseMethod("corpus") :
no applicable method for 'corpus' applied to an object of class "list"
class(ds)
[1] "VCorpus" "Corpus"Reply to this email directly or view it on GitHub<
https://github.com/kbenoit/quanteda/issues/37>.Reply to this email directly or view it on GitHub
#37 (comment).
Adam Ramey, Ph.D.
Assistant Professor of Politics
New York University Abu Dhabi
Saadiyat Island
Social Sciences Building (A5) - Room 141
PO Box 129188
Abu Dhabi, United Arab Emirates
Office: +971 2 628 5036
Cell: +971 56 194 5001
E-mail: [email protected]
Website: http://www.adamramey.com
N.B. Abu Dhabi is EST+8 from April-October and EST+9 from November-March.
from quanteda.
Yes ?textfile much better than the old method.
Sent from my iPhone
On 1 May 2015, at 14:49, adamramey <[email protected]mailto:[email protected]> wrote:
Was using the dev branch...there used to be a directory function in
quanteda to get a directory of text in, but it seems to be gone. Is there a
new way to do that?
On Fri, May 1, 2015 at 4:46 PM, Kenneth Benoit <[email protected]mailto:[email protected]>
wrote:
Try the dev branch rather than the cran version. And why start with tm at
all? Will look at this in more detail next week.Ken
Sent from my iPhone
On 1 May 2015, at 13:38, adamramey <[email protected]mailto:[email protected]<mailto:
[email protected]mailto:[email protected]>> wrote:I've tried to get a directory of texts in to a quanteda corpus with some
issues. First, I make a VCorpus using the DirSource function in tm. Second,
I try to make the object a quanteda corpus. However, I get the error "no
applicable method for 'corpus' applied to an object of class "list."" But
it's not a list; I've checked the files and everything seems sound.library(quanteda)
library(tm)
Loading required package: NLPAttaching package: 'tm'
The following objects are masked from 'package:quanteda':
as.DocumentTermMatrix, stopwords
ds <- VCorpus(DirSource("~/Desktop/Speeches/House/2000/"))
##make it a quanteda object
txts <- corpus(ds)
Error in UseMethod("corpus") :
no applicable method for 'corpus' applied to an object of class "list"
class(ds)
[1] "VCorpus" "Corpus"Reply to this email directly or view it on GitHub<
https://github.com/kbenoit/quanteda/issues/37>.Reply to this email directly or view it on GitHub
#37 (comment).
Adam Ramey, Ph.D.
Assistant Professor of Politics
New York University Abu Dhabi
Saadiyat Island
Social Sciences Building (A5) - Room 141
PO Box 129188
Abu Dhabi, United Arab Emirates
Office: +971 2 628 5036
Cell: +971 56 194 5001
E-mail: [email protected]:[email protected]
Website: http://www.adamramey.com
N.B. Abu Dhabi is EST+8 from April-October and EST+9 from November-March.
Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-98126349.
from quanteda.
Hi Adam, thanks for this feedback. We re-wrote this section substantially a couple of months ago and the directory import is not properly documented. The best way to do it currently is to use a filepath with a wildcard expression (a glob),for example this works:
library(quanteda)
myCorp <- corpus(textfile(file='~/Dropbox/QUANTESS/corpora/amicus/balanced/*'))
summary(myCorp)
You should also be able to use the wildcard to select only certain filetypes, e.g. /*.txt
I was also able to reproduce the first problem you mention, which seems to be a bug in our VCorpus import method - the extracted texts weren't typed as a character vector. I've made a change and pushed it, this now works on my system.
ds <- VCorpus(DirSource('~/Dropbox/QUANTESS/corpora/amicus/balanced/'))
corpus(ds)
Let me know if it works for you if you re-install the dev branch from github now.
from quanteda.
Related Issues (20)
- Deprecations and removals for 4.0
- UBSAN issues on CRAN from tbb HOT 2
- Incompatibility Issue with docnames Function in corpus and tokens dfm Objects HOT 4
- Erreur dans if (...length() && any(...names() == "Dimnames")) .Object@Dimnames <- fixupDN(.Object@Dimnames) : valeur manquante lร oรน TRUE / FALSE est requis HOT 1
- Performance issues with quanteda.textstats and tokens
- Extend support for dfm() to accept matrix/dataframe-like objects HOT 1
- Can't plot a comparison word cloud on grouped DFM with TF-IDF weighting HOT 4
- Chapter 3 Look Up Dictionary HOT 1
- error with tokens() in v4.0 HOT 1
- Warning in asMethod(object) : sparse->dense coercion: allocating vector of size 13.0 GiB HOT 4
- Build failure, Debian Linux: both CRAN and github master branch HOT 3
- 'meta' data is lost when using '+' to concatenate corpus objects HOT 6
- Spell checker HOT 1
- Word count: is performance an issue (compared to counting sentences/characters) ? HOT 14
- Error when combining more than 3 tokens objects
- Replace %>% with |>
- Documentation issues that need solving HOT 4
- Elapsted time seems wrong
- Inconsistency in what in oject meta
- Can't install (or load) Quanteda correctly HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quanteda.