Re: [R] Using regular expressions to detect clusters of consonants in a string

2009-07-01 Thread Gabor Grothendieck
> > > -Ursprüngliche Nachricht- > Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] > Gesendet: Dienstag, 30. Juni 2009 18:31 > An: Mark Heckmann > Cc: r-help@r-project.org > Betreff: Re: [R] Using regular expressions to detect clusters of consonants > in a st

Re: [R] Using regular expressions to detect clusters of consonants in a string

2009-07-01 Thread Mark Heckmann
expressions to detect clusters of consonants in a string Try this: library(gsubfn) s <- "mystring" strapply(s, "[bcdfghjklmnpqrstvwxyz]+", nchar)[[1]] which returns a vector of consonant string lengths. Now apply your algorithm to that. See http://gsubfn.googlecode.com fo

Re: [R] Using regular expressions to detect clusters of consonants in a string

2009-06-30 Thread Gabor Grothendieck
Try this: library(gsubfn) s <- "mystring" strapply(s, "[bcdfghjklmnpqrstvwxyz]+", nchar)[[1]] which returns a vector of consonant string lengths. Now apply your algorithm to that. See http://gsubfn.googlecode.com for more. On Tue, Jun 30, 2009 at 11:30 AM, Mark Heckmann wrote: > Hi, > > I want t

Re: [R] Using regular expressions to detect clusters of consonants in a string

2009-06-30 Thread Greg Hirson
Mark, "Abstraction" also has a valid two consonant cluster ("ct"). Some logic could be added to reject words that have valid twos if they also have longer strings of consonants. This may work as a starting off point, using strsplit: twocons = function(word){ chars = strsplit(word, "[aeiou

[R] Using regular expressions to detect clusters of consonants in a string

2009-06-30 Thread Mark Heckmann
Hi, I want to parse a string extracting the number of occurrences where two consonants clump together. Consider for example the word "hallo". Here I want the algorithm to return 1. For "chess" if want it to return 2. For the word "screw" the result should be negative as it is a clump of three cons