[BlindRUG] Is there any substitution for word count add in?

JooYoung Seo jooyoung at psu.edu
Thu Sep 8 10:02:30 UTC 2016


	dear Henrik,

	Thank you very much for your kind reply.

	It is very  helpful.
	Yes, I think I need to ask them to consider the terminal as well.

	I will post the request.

	I really appreciate you again.

	Sincerely,

	JooYoung


       JooYoung Seo
--------------------
  Doctoral Student,
  Learning, Design, and Technology
  Learning and Performance Systems
  The Pennsylvania State University
  Phone: +1 (814) 777-5825
  E-mail: jzs323 at psu.edu


-----Original Message-----
From: Henrik Bengtsson [mailto:henrik.bengtsson at gmail.com] 
Sent: Wednesday, September 7, 2016 11:16 AM
To: Blind R Users Group <blindrug at nfbnet.org>
Cc: JooYoung Seo <jooyoung at psu.edu>
Subject: Re: [BlindRUG] Is there any substitution for word count add in?

Actually, here's a workaround.  These two functions uses the internals of wordcountaddin and returns summaries as Markdown tables (that's the best I could do; it seems hard to grab the underlying data frame).

text_stats_md <- function(text) {
  text <- paste(text, collapse="\n")
  wordcountaddin:::text_stats_fn(text)
}

readability_md <- function(text) {
  text <- paste(text, collapse="\n")
  wordcountaddin:::readability_fn(text)
}

Here's an example using the text_stats_md function:

> text <- readLines("https://cran.r-project.org/src/base/README")
> text_stats_md(text)

|Method          |koRpus      |stringi       |
|:---------------|:-----------|:-------------|
|Word count      |668         |649           |
|Character count |4131        |4130          |
|Sentence count  |46          |Not available |
|Reading time    |3.3 minutes |3.2 minutes   |

I hope this helps (but I think you should still post a feature request)

/Henrik

On Wed, Sep 7, 2016 at 8:05 AM, Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote:
> Just had a quick check at the code of the wordcountaddin package to 
> see if there're some internal functions that could be used to collect 
> the stats from a plain string.  Unfortunately, the code is hardwired 
> to assume you're using it in RStudio.
>
> However, it doesn't look too hard to tweak such that the package could 
> also provide a plain R API returning data frames of summaries given a 
> plain string as input.  Looking at the internal code, that is 
> basically what the package does with its functions.  For example, it 
> could provide an API something like:
>
>> text_stats_df(text)
>> readability_df(text)
>
> I suggest that you post a feature request at 
> https://github.com/benmarwick/wordcountaddin/issues explaining your 
> needs.  Hopefully, he'll add it.  I can see it could be very useful 
> for lots of people.
>
> Cheers,
>
> Henrik
>
> On Wed, Sep 7, 2016 at 7:39 AM, JooYoung Seo via BlindRUG 
> <blindrug at nfbnet.org> wrote:
>>                 Hello,
>>
>>
>>
>>                 I found that there is word count add in for R Studio 
>> retrieved from https://github.com/benmarwick/wordcountaddin
>>
>>
>>
>>                 Unfortunately, it appears to be dependent of R Studio.
>>
>>
>>
>>                 Is there any trick to use it in R terminal?
>>
>>                 Or, is there any similar package to get word count 
>> accessible for R Terminal?
>>
>>
>>
>>                 Any help would be so much appreciated.
>>
>>
>>
>>                 Sincerely,
>>
>>
>>
>>                 JooYoung
>>
>>
>>
>>        JooYoung Seo
>>
>> --------------------
>>
>>   Doctoral Student,
>>
>>   Learning, Design, and Technology
>>
>>   Learning and Performance Systems
>>
>>   The Pennsylvania State University
>>
>>   Phone: +1 (814) 777-5825
>>
>>   E-mail: jzs323 at psu.edu
>>
>>
>>
>>
>> _______________________________________________
>> BlindRUG mailing list
>> BlindRUG at nfbnet.org
>> http://nfbnet.org/mailman/listinfo/blindrug_nfbnet.org
>> To unsubscribe, change your list options or get your account info for
>> BlindRUG:
>> http://nfbnet.org/mailman/options/blindrug_nfbnet.org/henrik.bengtsso
>> n%40gmail.com
>> The list archive can be viewed at:
>> http://www.nfbnet.org/pipermail/blindrug_nfbnet.org
>> More information and useful links about using R as a blind person can 
>> be obtained at:
>> http://R-Resources.massey.ac.nz
>>
>> Look for help using R commands by reading the accessible e-book 
>> "Let's Use R Now" compiled by Jonathan Godfrey at:
>> http://R-Resources.massey.ac.nz/lurn/front.html
>>





More information about the BlindRUG mailing list