Comments (15)
It's a bit of a cat and mouse game with ngram - Google doesn't provide an API so it's all about scraping and keeping up with their obfuscation changes. I have to admit it's been a long time since I wrote this package so it might take me a while to get back up to speed and work out what's broken! I'll see what I can do - but no promises...
from ngramr.
Thanks again Sean! This package truly makes my life easier, and I'm really looking forward to using it!
from ngramr.
I have the same problem. Would be very grateful for a fix!!
from ngramr.
I have pushed a new version to GitHub (not yet to CRAN). Let me know if the problem has been resolved.
from ngramr.
Thanks for getting back to this. It still appears there is another issue now.
Error in pivot_longer(df, -Year, names_to = "Phrase", values_to = "Frequency") : could not find function "pivot_longer"
4. | ngram_single(phrases, corpus = corp, year_start = year_start, year_end = year_end, smoothing = smoothing, tag = tag, case_ins)
3. FUN(X[[i]], ...)
2. | lapply(corpus, function(corp) ngram_single(phrases, corpus = corp, year_start = year_start, year_end = year_end, smoothing = smoothing, tag = tag, case_ins))
1. | ngramr::ngram("dog")
from ngramr.
Hi - the package now requires tidyr, so try installing that package first and see if that helps.
Sean.
from ngramr.
I've also changed the way the tidyr function is called so you may need to reinstall ngramr too.
Sean.
from ngramr.
Thanks Sean - when explicitly loading "library(tidyr)" after loading library(ngramr) this was able to work!
library(devtools)
install_github("seancarmody/ngramr")
library(ngramr)
library(tidyr)
dog <- ngramr::ngrami("dog")
dog
There might be some point in your package where you can state tidyr as a dependency, so it loads automatically for your users.
In my package rhymebrainR, I have a devstuffs.R file, which contains the following dependencies of my package. Potentially stating tidyr in this fashion will allow the package to load with your ngramr package.
# Get the dependencies
use_package("httr")
use_package("jsonlite")
use_package("curl")
use_package("attempt")
use_package("purrr")
One last note I'll make, is on your package description page, the command you have to install/load your package from GitHub doesn't seem to work with my version of R (perhaps this was a previous method?).
To install the package from your GitHub account, I had to use the following code:
library(devtools)
install_github("seancarmody/ngramr")
Lastly Sean - thanks for providing this fix - assuming you're in the States, it should technically still be my birthday - and it is a sweet gift at that!
I'm looking forward to using this package in one of my hobby projects! Thanks so much for fixing it!
~ Final edit, noticed you're another Aussie! In that case, cheers!
from ngramr.
Thanks for the feedback! I thought I'd updated the dependency on tidyr but my R package skills are a bit rusty so I did it in the wrong place. I'm hoping it works now without the explicit call to library(tidyr)
. If there are still problems, do let me know.
On the install_github
, you're right, the syntax for the function has changed, so I've updated the README.
Enjoy and a belated Happy Birthday.
from ngramr.
from ngramr.
Sorry about that! Result of poorly executed switch from the (old) ddply
to dplyr
Should be fixed now.
from ngramr.
from ngramr.
Note: I've redeveloped a lot of the underlying code which will (hopefully) make it more robust and provide better warnings. If you have a chance, have a look at the development version and let me know if it causes any problems (note if you use the "tag" argument in ngram that won't work anymore - I've removed it). When I'm confident it's stable I plan to replace the master version and republish on CRAN.
from ngramr.
from ngramr.
I'm glad it's working for you. I've just pushed an update to the development version with a new function chunk
that could be helpful to speed up your process a bit. Here's how I'd use it:
tokens <- c("asynchronously","barware","bender", etc... )
ng <- bind_rows(lapply(chunk(tokens, 12), function(c, ...) {Sys.sleep(2); ngram(c, ...)}, year_start = 1960))
Googe's Ngram Viewer will allow up to 12 tokens and this chunks your bigger list into a list of chunks of length 12 to work on.
from ngramr.
Related Issues (20)
- Install instructions should read install_github("seancarmody/ngramr") HOT 1
- ngramw doesn't work HOT 1
- 2012 and 2019 corpus counts the same HOT 1
- ngram case-sensitive output HOT 1
- Has the wildcard syntax changed? HOT 5
- Error in open.connection(x, "rb") HOT 4
- Could not get ng <- ngram(c("hacker", "programmer"), year_start = 1950) example to work HOT 4
- Counts question HOT 10
- R and Google plots not lining up HOT 4
- problem with stringr HOT 9
- Not getting an answer from google HOT 5
- Ngram Viewer not working HOT 2
- ngramr not working behind corporate proxy
- ngramr error in r: 'subscript out of bounds' or 'NULL' in environment HOT 6
- Apparent new problem. HOT 5
- NGRAM fails to install osx 12.6 HOT 3
- "Error parsing ngram data, please contact package maintainer." HOT 4
- ngramr not working HOT 3
- Recent versions of ngramr failing simple example test 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 ngramr.