zensols.nlparse.parse

Parse an utterance using the Stanford CoreNLP and the ClearNLP SRL.

This is the main client entry point to the package. A default out of the box parser works that comes with components listed in zensols.nlparse.config/all-components.

If you want to customzie or add your own parser plug in, see the zensols.nlparse.config namespace.

in-range?

(in-range? outter inner)

Return whether inner range sits in inclusive range outter. Both parameters have the form: [start end].

mention-for-token

(mention-for-token panon token)

Return a mention for token tok (if any).

mentions

(mentions panon & {:keys [mention-keys], :or {mention-keys [:mentions :tok-re-mentions]}})

Get all mentions from parse annotation panon.

Keys

  • :mention-keys top level keys of mentions to use and defaults to [:mentions :tok-re-mentions]

overlap?

(overlap? a b)

Return whether two ranges overlap inclusively. Both parameters have the form: [start end].

parse

(parse utterance)

Parse natural language utterance returning a symbol expression tree of it’s meaning.

This returns a symbolic expression (map of maps). A definition of these and structure of these annotations are given here.

See test token-regex for example of entity-tag.

penn-treebank-pos-tags

Alphabetical list of part-of-speech tags used in the Penn Treebank Project.

pos-description

(pos-description pos-tag)

Get a human readable description of pos-tag.

pos-tag-type

(pos-tag-type tag)

Return the POS tag type (ie. verb yeilds VB).

The return (function range) is the input to pos-tags.

pos-tag-types

(pos-tag-types)

Return types of POS tags (i.e. noun, verb, etc).

See pos-tags.

pos-tags

(pos-tags type)(pos-tags)

Get a sequence of POS tags based on type (if given) and all otherwise.

type is a symbol and one of noun, verb, adjective, adverb, and wh.

See pos-tag-types.

root-dependency

(root-dependency sent)

Get the text of the root node of the dependency tree.

sent

(sent panon index)

Get the 0-based indexth sentence.

sentiment-score-to-label

(sentiment-score-to-label sentiment-score)

Create a human readable tag from the sentiment score.

See sentimnet-labels.

sentimnet-labels

All labels returned by sentiment-score-to-label in order of positive to negative.

token

(token panon index)

Get the 0-based indexth token.

token-in-range?

(token-in-range? token range)

Return whether token tok is in tuple range.

token-mentions

(token-mentions panon)(token-mentions panon mentions)

Return mentions with a :tokens key that includes token maps from the sentence level.

tokens

(tokens panon)

Get all tokens across all sentences.

tokens-by-sentence

(tokens-by-sentence panon sent-index token-range)

Return the tokens for sent-index in the token-range.

tokens-for-mention

(tokens-for-mention panon mention)

Return tokens for mention.