zensols.nlparse.feature.lang

Feature utility functions. In this library, all references to panon stand for parsed annotation, which is returned from zensols.nlparse.parse/parse.

first-propbank-label

(first-propbank-label anon)

Find the first propbank label across all .

first-sent-propbank-label

(first-sent-propbank-label anon)

Find the first propbank label for a sentence.

mentions-feature-metas

(mentions-feature-metas entities)

Return the feature metadata for mentions-features.

mentions-features

(mentions-features panon tokens entities)(mentions-features panon tokens entities mentions-keys)

Return mentions features for panon with defaults of 0 for all named entities. The parameter mentions-keys are a list of mentions keys (defaults to :mentions) and can include custom mentions (i.e. token regular expression entities). Features are computed on the top level mentions comments returned include

  • :mentions-count-E number of times entity E has occurred
  • :mentions-ratio-E number of times entity E has occured / total tokens.

pos-tag-feature-metas

(pos-tag-feature-metas)

pos-tag-features

(pos-tag-features tokens)

Return POS tag features computed all tokens, which include:

  • :pos-first-tag The first POS tag.
  • :pos-last-tag The last POS tag.
  • :pos-tag-count-adjective: The number of adjectives found.
  • :pos-tag-ratio-adjective: The ratio of adjectives to other POS tags.
  • :pos-tag-count-adverb: The number of adverbs found.
  • :pos-tag-ratio-adverb: The ratio of adverbs to other POS tags.
  • :pos-tag-count-noun: The number of nouns found.
  • :pos-tag-ratio-noun: The ratio of nouns to other POS tags.
  • :pos-tag-count-verb: The number of verbs found.
  • :pos-tag-ratio-verb: The ratio of verbs to other POS tags.
  • :pos-tag-count-wh: The number of what/when/where type questions POS tags.
  • :pos-tag-ratio-wh: The ratio of what/when/where type question POS tags to other POS tags.
  • :pos-tag-count-adjective: The number of adjectives found.
  • :pos-tag-ratio-adjective: The ratio of adjectives to other POS tags.

sentiment-feature-metas

(sentiment-feature-metas)

Return the feature metadata for sentiment-features.

sentiment-features

(sentiment-features panon)

Return sentiment features for parsed annotation panon, which include:

  • :sentiment-utterance The utterance level sentimment score.
  • :sentiment-sentence-sum The utterance sum across sentences.
  • :sentiment-sentence-mean The sentiment mean across sentences.
  • :sentiment-sentence-variance The sentiment variance across sentences.

srl-feature-metas

(srl-feature-metas)

srl-features

(srl-features toks)

tree-feature-metas

(tree-feature-metas)

tree-features

(tree-features panon)

verb-feature-metas

(verb-feature-metas)

verb-features

(verb-features sent)

Find the most probable key head verb in sentence sent.