extracting text from wordnet using synonym()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

extracting text from wordnet using synonym()

Lamke
Dear group,

There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out.  Supposed I am pulling the synonyms of "help" using synonyms("help") from wordnet and get the followings:

> synonyms("help")
[1] "c(\"aid\", \"assist\", \"assistance\", \"help\")"    
[2] "c(\"aid\", \"assistance\", \"help\")"                

How can I get a one character string at the end that looks like this:

[1] "aid" "assist" "assistance" "help" "aid" "assist" "help"

Thanks for the help!!!!!

Kelvin
Reply | Threaded
Open this post in threaded view
|

Re: extracting text from wordnet using synonym()

Henrique Dallazuanna
Try this:

Str <- c("c(\"aid\", \"assist\", \"assistance\", \"help\")",
         "c(\"aid\", \"assistance\", \"help\")")
unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE))

On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam <[hidden email]> wrote:

>
> Dear group,
>
> There are postings on extracting partial string using sub()/gsub()/gsubfn()
> but I still couldn't figure this one out.  Supposed I am pulling the
> synonyms of "help" using synonyms("help") from wordnet and get the
> followings:
>
> > synonyms("help")
> [1] "c(\"aid\", \"assist\", \"assistance\", \"help\")"
> [2] "c(\"aid\", \"assistance\", \"help\")"
>
> How can I get a one character string at the end that looks like this:
>
> [1] "aid" "assist" "assistance" "help" "aid" "assist" "help"
>
> Thanks for the help!!!!!
>
> Kelvin
> --
> View this message in context:
> http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: extracting text from wordnet using synonym()

Gabor Grothendieck
Or a variation:

> unlist(lapply(parse(text = Str), eval))
[1] "aid"        "assist"     "assistance" "help"       "aid"
[6] "assistance" "help"

On Sat, Aug 15, 2009 at 5:55 PM, Henrique Dallazuanna<[hidden email]> wrote:

> Try this:
>
> Str <- c("c(\"aid\", \"assist\", \"assistance\", \"help\")",
>         "c(\"aid\", \"assistance\", \"help\")")
> unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE))
>
> On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam <[hidden email]> wrote:
>
>>
>> Dear group,
>>
>> There are postings on extracting partial string using sub()/gsub()/gsubfn()
>> but I still couldn't figure this one out.  Supposed I am pulling the
>> synonyms of "help" using synonyms("help") from wordnet and get the
>> followings:
>>
>> > synonyms("help")
>> [1] "c(\"aid\", \"assist\", \"assistance\", \"help\")"
>> [2] "c(\"aid\", \"assistance\", \"help\")"
>>
>> How can I get a one character string at the end that looks like this:
>>
>> [1] "aid" "assist" "assistance" "help" "aid" "assist" "help"
>>
>> Thanks for the help!!!!!
>>
>> Kelvin
>> --
>> View this message in context:
>> http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: extracting text from wordnet using synonym()

Lamke
Thank you both!  It works now.  (Need to check out the parsing .... )

Gabor Grothendieck wrote
Or a variation:

> unlist(lapply(parse(text = Str), eval))
[1] "aid"        "assist"     "assistance" "help"       "aid"
[6] "assistance" "help"

On Sat, Aug 15, 2009 at 5:55 PM, Henrique Dallazuanna<wwwhsd@gmail.com> wrote:
> Try this:
>
> Str <- c("c(\"aid\", \"assist\", \"assistance\", \"help\")",
>         "c(\"aid\", \"assistance\", \"help\")")
> unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE))
>
> On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam <lamkelf@gmail.com> wrote:
>
>>
>> Dear group,
>>
>> There are postings on extracting partial string using sub()/gsub()/gsubfn()
>> but I still couldn't figure this one out.  Supposed I am pulling the
>> synonyms of "help" using synonyms("help") from wordnet and get the
>> followings:
>>
>> > synonyms("help")
>> [1] "c(\"aid\", \"assist\", \"assistance\", \"help\")"
>> [2] "c(\"aid\", \"assistance\", \"help\")"
>>
>> How can I get a one character string at the end that looks like this:
>>
>> [1] "aid" "assist" "assistance" "help" "aid" "assist" "help"
>>
>> Thanks for the help!!!!!
>>
>> Kelvin
>> --
>> View this message in context:
>> http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.