zensols.nlparse.feature.util

Utility functions for feature creation

beginning-of-sentence-label

Beginning of sentence marker.

end-of-sentence-label

End of sentence marker.

lc-null

(lc-null str)

Return the lower case version of a string or nil if nil given.

none-label

Value used for missing features.

or-0

(or-0 val)(or-0 check val-fn)

Call and return the value given by val-fn iff check is non-nil, otherwise return 0.

or-empty-0

(or-empty-0 seq afn)

If sequence seq is non-empty, apply afn to seq. Otherwise return 0.

or-none

(or-none str)

Return str if non-nil or otherwise the sepcial none-label.

ratio-0-if-empty

(ratio-0-if-empty a b)

Return a ratio or 0 if b is 0 to guard against divide by zero.

ratio-neg-if-empty

(ratio-neg-if-empty a b)

Return a ratio or -1 if b is 0 to guard against divide by zero.

ratio-true

(ratio-true items true-fn)

Return the ratio of items whose evaluation of true-fn is true. If items is empty return 0.

upper-case?

(upper-case? text)