nlp :: NLPProcessor :: defaultinit
# Natural Language Processor
#
# NLPProcessor provides natural language processing for input text and files.
# Analyzed documents can be manipulated through the resulting NLPDocument.
interface NLPProcessor
# Creates a new NLPDocument from a string
fun process(string: String): NLPDocument is abstract
# Creates a new NLPDocument from a file content
fun process_file(path: String): NLPDocument do
var content = path.to_path.read_all
return process(content)
end
# Creates a new NLPDocument from a list of files (batch mode)
#
# Returns a map of file path associated with their NLPDocument.
fun process_files(paths: Array[String]): Map[String, NLPDocument] do
var res = new HashMap[String, NLPDocument]
for file in paths do
res[file] = process_file(file)
end
return res
end
end
lib/nlp/stanford.nit:25,1--50,3