on master help sign in
parsing: don't crash on parsing
a2a97f9Hunter Miller
desk/desk.docket-0+1−1
@@ -4,7 +4,7 @@
4 image+'https://nyc3.digitaloceanspaces.com/hmillerdev/nocsyx-lassul/2022.7.16..04.35.22-sphinx-web-shifted.svg'
4 image+'https://nyc3.digitaloceanspaces.com/hmillerdev/nocsyx-lassul/2022.7.16..04.35.22-sphinx-web-shifted.svg'
5 glob-http+['https://nyc3.digitaloceanspaces.com/hmillerdev/sphinx/glob-0v7.folii.k685s.mjn1b.46up6.but26.glob' 0v7.folii.k685s.mjn1b.46up6.but26]
5 glob-http+['https://nyc3.digitaloceanspaces.com/hmillerdev/sphinx/glob-0v7.folii.k685s.mjn1b.46up6.but26.glob' 0v7.folii.k685s.mjn1b.46up6.but26]
6 base+'sphinx'
6 base+'sphinx'
7− version+[0 4 5]
7+ version+[0 4 6]
8 website+'https://github.com'
8 website+'https://github.com'
9 license+'MIT'
9 license+'MIT'
10==
10==
desk/lib/sift.hoon+34−19
@@ -3,42 +3,57 @@
3 |= corpus=@t
3 |= corpus=@t
4 ^- (list @t)
4 ^- (list @t)
5 ?: =(corpus '') ~
5 ?: =(corpus '') ~
6+ =/ parts (split corpus)
7+ ?~ parts ~
6 %+ skip
8 %+ skip
7− (split corpus)
9+ (need parts)
8 |= word=@t
10 |= word=@t
9 (~(has in words) word)
11 (~(has in words) word)
10++ norm
12++ norm
11 |= corpus=@t
13 |= corpus=@t
12 ^- @t
14 ^- @t
13 ?: =(corpus '') ''
15 ?: =(corpus '') ''
16+ =/ cleaned (trimall (weave (expunge (weave (trimall `corpus)))))
17+ ?~ cleaned ''
18+ (crip (cass (need cleaned)))
19+++ weave
20+ |= corpus=(unit tape)
21+ ^- (unit @t)
22+ ?~ corpus ~
14− (crip (cass (expunge (crip (trimall corpus)))))
23+ (some (crip (need corpus)))
15++ split
24++ split
16 |= corpus=@t
25 |= corpus=@t
17− ^- (list @t)
26+ ^- (unit (list @t))
18 ?: =(corpus '') ~
27 ?: =(corpus '') ~
19 =/ test (norm corpus)
28 =/ test (norm corpus)
20− %+ rash test
29+ %+ rush test
21 (more (plus ws) (cook crip (plus ;~(pose aln hep))))
30 (more (plus ws) (cook crip (plus ;~(pose aln hep))))
22++ allowed ;~(pose aln hep ace)
31++ allowed ;~(pose aln hep ace)
23++ banned ;~(less allowed next)
32++ banned ;~(less allowed next)
24++ ws (mask " \0a\0d\09")
33++ ws (mask " \0a\0d\09")
25++ expunge
34++ expunge
26− |= corpus=@t
35+ |= corpus=(unit @t)
27− ^- tape
36+ ^- (unit tape)
28− ?: =(corpus '') ~
37+ ?~ corpus ~
29− %- zing
38+ =/ text (need corpus)
30− %+ rash corpus
39+ ?: =(text '') ~
40+ =/ parsed
41+ %+ rush text
31− %- plus
42+ %- plus
32− ;~ pose
43+ ;~ pose
33− ;~(pfix (plus banned) (star allowed))
44+ ;~(pfix (plus banned) (star allowed))
34− ;~(sfix (star allowed) (plus banned))
45+ ;~(sfix (star allowed) (plus banned))
35− (plus allowed)
46+ (plus allowed)
36− ==
47+ ==
48+ ?~ parsed ~
49+ `(zing (need parsed))
37++ trimall
50++ trimall
38− |= corpus=@t
51+ |= corpus=(unit @t)
39− ^- tape
52+ ^- (unit tape)
40− ?: =(corpus '') ~
53+ ?~ corpus ~
41− %+ rash corpus
54+ =/ text (need corpus)
55+ ?: =(text '') ~
56+ %+ rush text
42 %+ ifix [(star ws) (star ws)]
57 %+ ifix [(star ws) (star ws)]
43 %- star
58 %- star
44 ;~ less
59 ;~ less