Poisson
Poisson

Reputation: 1623

Using koRpus function treetagger with R

As I am a starter trying out the korpus to work with R, any advice will be great.

I installer TreeTagger on my windows machine, then I installed koRpus package. My question is how Can I use treetagger using koRpus with R?

Is there any settings to add?

I try with this command :

writeLines(text = 'All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.', con = "myfile.txt"); treetag("myfile.txt")
Error: could not find function "treetag"

Thank you very much for your help

Bests

Upvotes: 0

Views: 749

Answers (2)

teebs
teebs

Reputation: 51

When using TreeTagger with koRpus you also need to set information on the koRpus environment (i.e. tell it where to find TreeTagger on your computer etc.) you can do that with the set.kRp.env function. Here is an example which you will have to tailor to the paths on your computer and your requirements:

set.kRp.env(TT.cmd="C:/Program Files/TreeTagger/bin/tag-english.bat", lang="en", 
            TT.options=list(path="C:/Program Files/TreeTagger", preset="en"), validate=TRUE)

You might also want to try out whether TreeTagger works outside of R before using it in R.

Upvotes: 0

Greg Thatcher
Greg Thatcher

Reputation: 1443

I'm not familiar with koRpus, but you might try calling the function like this:

koRpus::treetag("test")

or like this:

library(koRpus)
writeLines(text = 'All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.', con = "myfile.txt"); treetag("myfile.txt")

Upvotes: 0

Related Questions