43
44
45
46
47
48
49
50
51
52
|
43
44
45
46
47
48
49
50
51
52
53
|
+
|
series-folder
images-folder
articles-pagetree
series-pagetree
first-words
normalize
build-note-id
notes->last-disposition-values
disposition-values
)
|
259
260
261
262
263
264
265
266
267
268
|
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
+
+
+
+
+
+
|
(check-equal? (first-words txs-punc+split-elems 5) "Stop! she called. She was")
(check-equal? (first-words txs-dashes 5) "One and only one. That")
(check-equal? (first-words txs-dashes 4) "One and only one.")
(check-equal? (first-words txs-parens-commas 5) "She counted one two silently")
(check-equal? (first-words txs-short 5) "Not much here!"))
;; Convert a string into all lowercase, replace all non-alphanum chars with ‘-’
(define (normalize str)
(~> (regexp-replace* #rx"[^A-Za-z0-9 ]" str "")
string-downcase
(string-normalize-spaces #px"\\s+" "-")))
;; Convert, e.g., "* thoroughly recanted" into (values "*" "thoroughly recanted")
(define (disposition-values str)
(cond [(string=? "" str) (values "" "")]
[else (let ([splut (string-split str)])
|