Libraryless. Click here for Pure Java version (7037L/47K/156K).
!752 concept Node { S name; void attachPhrase(L<S> phrase) { print(name + ": phrase=" + phrase); } } Node > Is { void attachPhrase(L<S> phrase) { super.attachPhrase(phrase); if (eq(first(phrase), "*") && l(phrase) == 3) { S adjective = third(phrase); print(" Could call is_" + adjective); } } } static Node getNode(S name) { Node node = findConcept(Node, +name); if (node != null) ret node; Class<? extends Node> c = Node; if (eqic(name, "is")) c = Is; ret uniq(c, +name); } p { S s = "is the_button green?"; L<S> words = words(s); for i over words: { S word = words.get(i); Node node = getNode(word); L<S> phrase = replaceNthItem(words, i, "*"); node.attachPhrase(phrase); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006327 |
Snippet name: | Text 2 Graph [dev.] |
Eternal ID of this version: | #1006327/1 |
Text MD5: | 211c80221f6442b79dae77c4b4a3bfe6 |
Transpilation MD5: | 3eec821c37f7459429659166136c0943 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-28 21:37:34 |
Source code size: | 797 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 617 / 725 |
Referenced in: | -