tnf.Rd
Learnable Name Finder
tnf_(model, sentences, output = NULL) tnf(model, sentences)
model | |
---|---|
sentences | Sentences containing entities to find, a character vector or full path to file, usually |
output | An output file, generally |
Full path to the output
if specified.
name tagging:
<END>.
is invalid
<END> .
is valid
Use check_tags
# NOT RUN { # get working directory # need to pass full path wd <- getwd() # Training to find "WEF" data <- paste("This organisation is called the <START:wef> World Economic Forum <END>", "It is often referred to as <START:wef> Davos <END> or the <START:wef> WEF <END> .") # train the model model <- tnf_train(model = paste0(wd, "/wef.bin"), lang = "en", data = data, type = "wef") # Create sentences to test our model sentences <- paste("This sentence mentions the World Economic Forum the annual meeting", "of which takes place in Davos. Note that the forum is often called the WEF.") # run model on sentences results <- tnf(model = model, sentences = sentences) # same with text files # Save the above as file write(data, file = "input.txt") # Trains the model and returns the full path to the model model <- tnf_train_(model = paste0(wd, "/wef.bin"), lang = "en", data = paste0(wd, "/input.txt"), type = "wef") # Create sentences to test our model sentences <- paste("This sentence mentions the World Economic Forum the annual meeting", "of which takes place in Davos. Note that the forum is often called the WEF.") # Save sentences write(data, file = "sentences.txt") # Extract names # Without specifying an output file the extracted names appear in the console tnf(model = model, sentences = paste0(wd, "/sentences.txt")) # returns path to output file output <- tnf_(model = model, sentences = paste0(wd, "/sentences.txt"), output = paste0(wd, "/output.txt")) # }