1 # Nit wrapper for Stanford CoreNLP
3 Stanford CoreNLP provides a set of natural language analysis tools which can take
4 raw text input and give the base forms of words, their parts of speech, whether
5 they are names of companies, people, etc., normalize dates, times, and numeric
6 quantities, and mark up the structure of sentences in terms of phrases and word
7 dependencies, indicate which noun phrases refer to the same entities, indicate
10 This wrapper needs the Stanford CoreNLP jars that run on Java 1.8+.
12 See http://nlp.stanford.edu/software/corenlp.shtml.
17 var proc = new NLPProcessor("path/to/StanfordCoreNLP/jars")
19 var doc = proc.process("String to analyze")
21 for sentence in doc.sentences do
22 for token in sentence.tokens do
23 print "{token.lemma}: {token.pos}"
30 For ease of use, this wrapper introduce a Nit model to handle CoreNLP XML results.
36 [[doc: nlp::NLPDocument::from_xml]]
37 [[doc: nlp::NLPDocument::from_xml_file]]
38 [[doc: nlp::NLPDocument::sentences]]
44 [[doc: nlp::NLPSentence::tokens]]
50 [[doc: nlp::NLPToken::word]]
51 [[doc: nlp::NLPToken::lemma]]
52 [[doc: nlp::NLPToken::pos]]
58 [[doc: nlp::NLPProcessor::java_cp]]
60 [[doc: nlp::NLPProcessor::process]]
61 [[doc: nlp::NLPProcessor::process_file]]
62 [[doc: nlp::NLPProcessor::process_files]]
70 [[doc: nlp::NLPVector::cosine_similarity]]
74 The `nitnlp` binary is given as an example of NitNLP client.
75 It compares two strings and display ther cosine similarity value.
80 nitnlp --cp "/path/to/jars" "sort" "Sorting array data"
87 * Use options to choose CoreNLP analyzers
88 * Analyze sentences dependencies