Vocabulary/ModifierTrains
Modifier trains are sequences of words that combine without visible operators to produce adverbs and conjunctions.
Train Part of speech Interpretation Quick Search N0 V1 N2 executed to produce a noun NVN V0 V1 V2
N0 V1 V2verb creates a fork VVV
NVVV0 V1 C2 conj V0 V1 (u C2 v) VVC A0 V1 V2 adv (u A0) V1 V2 AVV C0 V1 V2 conj (u C0 v) V1 V2 CVV C0 V1 C2 conj (u C0 v) V1 (u C2 v) CVC A0 A1 V2 conj (u A0) (v A1) V2 AAV A0 A1 A2 adv ((u A0) A1) A2 AAA C0 A1 A2 conj ((u C0 v) A1) A2 CAA N0 C1 N2 executed to produce any part of speech NCN N0 C1 V2 executed to produce any part of speech NCV N0 C1 A2 adv N0 C1 (u A2) NCA N0 C1 C2 conj N0 C1 (u C2 v) NCC V0 C1 N2 executed to produce any part of speech VCN V0 C1 V2 executed to produce any part of speech VCV V0 C1 A2 adv V0 C1 (u A2) VCA V0 C1 C2 conj V0 C1 (u C2 v) VCC A0 C1 N2 adv (u A0) C1 N2 ACN A0 C1 V2 adv (u A0) C1 V2 ACV A0 C1 A2 conj (u A0) C1 (v A2) ACA A0 C1 C2 conj (u A0) C1 (u C2 v) ACC C0 C1 N2 conj (u C0 v) C1 N2 CCN C0 C1 V2 conj (u C0 v) C1 V2 CCV C0 C1 A2 conj (u C0 v) C1 (v A2) CCA C0 C1 C2 conj (u C0 v) C1 (u C2 v) CCC N0 A1 executed to produce any part of speech NA N0 C1 adv N0 C1 u NC V0 A1 executed to produce any part of speech VA V0 N1 executed to produce a noun VN V0 V1 verb creates a hook VV V0 C1 adv V0 C1 u VC A0 V1 adv (u A0) V1 AV A0 A1 adv (u A0) A1 AA A0 C1 adv (u A0) C1 u (adverbial hook) AC C0 N1 adv u C0 N1 CN C0 V1 adv u C0 V1 CV C0 A1 conj (u C0 v) A1 CA C0 C1 conj (u C0 v) (u C1 v) CC
Longer forks/trains
A non-modifier fork or hook (train) with 4 or more tines is grouped in 3 from right.
(v0 v1 v2 v3 v4) --> (v0 v1 (v2 v3 v4)) NB. implied parentheses
Modifier trains with 4 or more tines are explicitly grouped in 3 from left:
(+ ` ` `: 6) NB. --> (V C C C N) --> ((+ ` `) `: 6) is ((V C C) C N) --> ((V C (uCv)) C N) --> C C N --> uCv (C N)
(+ ` `) `: 6
Interpretation rules
Every part of speech (noun, verb, adverb, conjunction) takes between 0 and 2 operands. In the context of modifier trains, each word in a train can be thought of as having none, 1, or 2 slots where the operand(s) will be piped in.
Besides the trivial case (a partially-bound conjunction), there are two symmetric modifier train cases (up to modifier valence and directional orientation), and five ad-hoc ones.
Symmetric modifier trains (includes all 3-trains)
u [and v] go into the available slots in each side tine (i.e., 1st and 3rd terms), except for modifier trains ending with AA (CAA, AAA, AA), which successively apply their adverbs on the result of the leftmost modifier. A conjunction in a side-tine position takes u and v; left and right adverb tines take u and v, respectively.
NB. If a given side tine (1st or 3rd term) is C, it also takes in the corresponding bracketed operand as shown below. (A/C) C (C/A) NB. left A takes u; right A takes v; C always takes u and v / [\] [/] \ u [v] [u] v C C (V/N) NB. [V/N]CC is symmetric / \ u v A C (V/N) NB. [V/N]CA is symmetric | u
1. a. Modifier 3-trains with C(onj) middle tine: The middle tine conjunction takes as operands the two verbs derived from the side tines.
NB. V's below can also be replaced with N's NB. C's always take u and v C C C / \ / \ u v u v NB. left A takes u; right A takes v A C C C C A A C A | / \ / \ | | | u u v u v v u v A C V V C A | | u u NB. [V/N] side tine C C V V C C / \ / \ u v u v
1. b. Modifier 3-trains without C middle tine (CVC, VVC, CVV, AAV, AVV) yield forks. Unless they end with successive A's (CAA, AAA), which always denotes successively applying the A's to yield a simple verb.
C V C --> conj: derives fork (u C0 v) V1 (u C2 v) / \ / \ u v u v V V C C V V --> conj: derives fork with (u C v) as the missing tine / \ / \ u v u v A A V --> conj: derives fork (u A0) (v A1) V | | u v A V V --> adv: derives fork (u A0) V1 V2 | u
1. c. 2-trains involving a conjunction and operand (CV, CN, VC, NC) create an adverb.
C V C N V C N C --> simple verbs (u C V), (u C N), (V C u), (N C u) / / \ \ u u u u
2. Modifier trains ending with successive A's (CAA, AAA, AA) successively apply their A's to the result of the leftmost modifier to yield a simple verb.
C A A --> conj: derives simple verb (((u C0 v) A1) A2) / \ u v A A A --> adv: derives simple verb (((u A0) A1) A2) | u A A --> adv: derives simple verb ((u A0) A1) | u
Ad-hoc/asymmetric modifier trains
Ad-hoc modifier trains, for the most part, are not interpreted according to any broad rule. All are 2-trains.
3. AV (adv) yields a hook.
A V --> adv: derives hook (u A0) V | u
4. CC (conj) yields a hook.
C C --> conj: derives hook (u C0 v) (u C1 v) / \ / \ u v u v
5. CA (conj) yields a simple verb.
C A --> conj: simple verb (u C v) A / \ u v
6. AC (adv) yields a simple verb.
A C --> adv: simple verb (u A) C u (adverbial hook) | \ u u
Usage
- Tie (`) and Evoke Gerund (`:0) can be used to insert derived verbs anywhere within a verb train:
*((+ ` `) `: 6)- + * - 10(;((+ ` `) `: 6)-)3 ┌──┬─┐ │13│7│ └──┴─┘
- u (].(...modifier phrase...)[.) v is akin to x(...verb phrase...)~y; it swaps u and v.
- Ident (]:) isn't restricted to use in adverbs; it can be used to write conjunctions as well, using the conjunction-forming sequences ACC, CCA, ACA, AAV. It's useful when you want one operand as-is, and the other modified by an adverb, or when each operand is modified by a different adverb. For example, {{u@]^:v^:_"0}} can be written as [.@]^:].^:_"0, but can also be written as (@])^:]:^:_"0 (among several variants). It saves you from having to parenthesize CA subexpressions, e.g. (...([. A0)...(]. A1)...), allowing instead (...A0...A1...).
- Derived modifiers can be juxtaposed and nested to write arbitrarily complex modifiers, no differently than derived verb phrases within verb trains.
ipdd=: {{[:> [ u/@:(v&>)&.>/&:(<"1) 0&|:@]}} NB. APL's inner product ipmt=: [:`>` [` ((/@:(&>)&.>/)&:(<"1))` (0&|:@])`:6 NB. ACA for u/@:(V&>) (10+i.4 5) +ipdd* &:?. 10+i.5 3 95 233 305 97 202 275 323 504 719 161 285 445 (10+i.4 5) +ipmt* &:?. 10+i.5 3 95 233 305 97 202 275 323 504 719 161 285 445
Parsing rules for mixed modifier/traditional trains of longer length
Traditional verb/noun trains/forks can be combined within a modifier train. Long(er than 3) modifier trains will sometimes interrupt and sometimes allow the formation of verb phrases. It's simple to write any desired modifier train using parentheses to nest verb or modifier phrases; below are the rules for how non-parenthesized mixed trains are parsed.
- Modifier trains CC[V/N] and AC[V/N] always auto-group the first (i.e., leftmost) 3 terms to produce a derived entity.
- The other modifier trains with a V or N on one side within the first 3 terms can auto-verb-phrase-group on that side.
- Within modifier trains, verb trains always group themselves into the largest fork (i.e., odd-length train) possible.
- Interrupting verb phrase formation means greedily completing a 3-long modifier train.
- VC and AV will auto-group, preempting VVC or AVV formation, when their V side has an odd number of V's; the other 2-trains never auto-group themselves, and must be parenthesized.
@ @ + % # NB. Modifier start of train @@ must capture 3rd completing term. (CC) will never auto-group itself because it is only 2 terms long.
(@ @ +) % #
+/ % # @ @ NB. VVV to left will autogroup. VCC result.
(+/ % #) @ @
1 + = +-@: NB. Odd number of v/n to left a conjunction forms an adverb with verb fork as bound parameter
(1 + = + -)@:
@@+@- NB. uCn verb phrase +@- did not form because of 3rd item greed rule.
(@ @ +) @ -
but the train forming modifier trains (AV AAV AVV CVV VVC) "tend to" defer to VVV formation:
]: ]: -/%#
]: ]: (-/ % #)
]: -~ -/ % # NB. verb phrases allowed to freely form on AV or AVV "start" (left) of modifier train.
]: (-~) (-/ % #)
]: ]: -@^ %// NB. Equivalent here to (]: %// -@^). NB. (]: ]: -@^ %//) --> (A A V V) --> ((AAV)V) --> ((]: ]: -@^) %//) --> C V --> V binds as right operand to C --> ((u A0) (V1 A1) V0))
(]: ]: (-@^))(%//)
@@]: + - NB. CCA exists and has priority over to its right AVV
(@ @ ]:) + -
@@% + - NB. CCV has left priority over VVV (creates (CA)VV -> CVV)
(@ @ %) + -
@ + -~ % $ # NB. CVV not being prioritized. Instead VVV is prioritized. CVV is "leftover" binding
(@ + (-~))(% $ #)
@ - % $ # NB. Again VVV prioritized and leftover forms modifier train.
@ - (% $ #)
@: - + = +-# NB. VV(VVV) prioritized
@: - (+ = + - #)
@ @ ]: + - % $ #
(@ @ ]:)(+ - % $ #)
(@ @ ]:) + - % $
(@ @ ]:) + (- % $)
+ -/ % # @ NB. VVC with even number of verbs to left of Conj.
+ (-/ % #) @
+ -/ % # # @ NB. odd number of verbs to left forms an adverb fork@
(+ -/ % # #)@
+@- @ @ NB. verb phrases can be formed at start/left of modifier train. ie. if leftmost term is verb/noun
+@- @ @
+/ @ @
+/ @ @
@-@% NB. but if it doesn't start with verb/noun, verb phrases defer to greedy modifier rule.
(@ - @)%