clj-duckling.util.core
compare-intervals
(compare-intervals [a b] [c d])
Compares two intervals. i1 > i2 if i1 recovers i2.
hash-match
(hash-match pattern input)
Matching hashmap over hashmap. Keys can be functions.
WARNING THIS IS NOT RECURSIVE FOR THE MOMENT
keep-max
(keep-max fmax coll)
Returns the sublist of elem for which f is maxed
merge-according-to
(merge-according-to fn-map & maps)
Merges a list of maps from left to right.
When 2 conflicting keys are found, lookup the merging function to use.
If the merging function can't be found, right (new) value is used.
Merging functions are called as (f left right).
separated-substring?
(separated-substring? sentence pos end)
Since we match regexes without whitespace delimitator, we have to check
the reasonability of the match to actually be a word
January19this is my birthday => OK
Cameroun (as Camero + 'un') => NOT OK
split-by-partial-max
(split-by-partial-max partial-order-fn coll base-coll)
Splits coll into two colls. The first one contains the items in coll that do
not have any elem greater than them in base-coll according the given partial
order function. The second contains the other items in coll.
(When the partial order returns nil, it means the 2 elems
cannot be compared.)
split-by-partial-max-test
spprint
(spprint m)
Pretty-prints to a string (useful to print hashmaps)
valid-limit?
(valid-limit? char1 char2)
Decide if two adjacent chars are reasonably separated
ab => false
aR => true
a1 => true
-) => true etc.