Vocabulary/WordsNotes
Jump to navigation
Jump to search
Notes on the usage of "Words" (monadic ;:)
See Vocabulary/SequentialMachineNotes for notes on usage of dyadic (;:)
The monadic sequential machine implements lexical analysis to split a J sentence into words.
It works to some extent when breaking English sentences into words too.
Words (;:) has a defined obverse.
;: '.2' NB. Is .2 a number to J? +-+-+ |.|2| +-+-+ ;: 'Reserved:::...:.J...Words...' NB. How do inflections work? +----------------+----+--------+ |Reserved:::...:.|J...|Words...| +----------------+----+--------+ ;: 'f::g' NB. This is NOT an adverse specification +---+-+ |f::|g| +---+-+ ;: 'f :: g' NB. This IS an adverse specification +-+--+-+ |f|::|g| +-+--+-+ ;: '(+/ % #) 1 2 3 4 88.4' NB. the vector is a single word +-+-+-+-+-+-+------------+ |(|+|/|%|#|)|1 2 3 4 88.4| +-+-+-+-+-+-+------------+ a=: ' The sequential machine sometimes works with English. ' ;: a +---+----------+-------+---------+-----+----+--------+ |The|sequential|machine|sometimes|works|with|English.| +---+----------+-------+---------+-----+----+--------+ embed=: >@:{.@:[ , ] , >@:{:@:[ ('>>>';'<<<') embed a >>> The sequential machine sometimes works with English. <<< deb NB. delete extra blanks #~ (+. (1: |. (> </\)))@(' '&~:) NB. Use "Under" to demonstrate inverse. (deb -: ]&.:;:) a NB. The result is the same as for deb 1 (deb -: [&.:;:) 'These will, of course, differ.' 0 '><' embed [&.:;: a >The sequential machine sometimes works with English.< #book=: 1!:1 < 'A_Christmas_Carol_NT.txt' 166529 ts=: 6!:2 , 7!:2@] NB. (time , space) -from Help / Phr 14A) ts 'deb book' 0.002849 788224 ts '[&.: ;:book' NB. 10*slower and 2*space of deb (Use deb!) 0.033055 1.3343e7
Suppose you meet +/ .* in a fork. Or is it a hook? You must know whether there are an even or an odd number of verbs to distinguish hook from fork. This, in turn, determines the data routing.
;:'+/ .*' +-+-+-+-+ |+|/|.|*| +-+-+-+-+
Be aware that
- the adverb Insert (/) influences preceding: +
- Dot Product (.) binds +/ to * producing a single verb.-~
(contributed by DavidLambert)