Uses 911K of libraries. Click here for Pure Java version (17867L/101K).
1 | !7 |
2 | |
3 | sclass Line {
|
4 | S text, interpretation; |
5 | |
6 | sS _fieldOrder = "text interpretation"; |
7 | } |
8 | |
9 | cmodule SimpleWikipediaSentences > DynTableWithInput<Line> {
|
10 | S topic; |
11 | |
12 | start {
|
13 | set fieldsInOrder; |
14 | dm_vmBus_onMessage_q('gazelleRulesChanged, r forceUpdate);
|
15 | } |
16 | |
17 | afterVisualize {
|
18 | tablePopupMenuItemsThreaded(table(), |
19 | "Ignore", r ignoreLine, |
20 | "Make rule...", r makeRule); |
21 | } |
22 | |
23 | void update(S topic) {
|
24 | topic = trim(topic); |
25 | setField(+topic); |
26 | setModuleName(topic + " - Simple Wikipedia"); |
27 | final L<Line> data = cloneList_putInField Line('text, simpleWikipedia_sentencesForTopic(topic));
|
28 | |
29 | fS _topic = topic; |
30 | time "Interpret Lines" {
|
31 | //showText("Profile", poorMansProfileToString(r {
|
32 | LPair<S, Int> ignore = dm_gazelle_linesToIgnoreForSimpleWikipediaTopic(_topic); |
33 | GazelleEvalContext ctx = dm_gazelle_stdEvalContext(); |
34 | for i over data: {
|
35 | Line l = data.get(i); |
36 | if (contains(ignore, pair(l.text, i))) |
37 | continue with l.interpretation = 'ignore; |
38 | |
39 | GazelleTree tree = new(l.text); |
40 | tree.ctx = ctx; |
41 | dm_gazelle_getChildren(tree); |
42 | if (nempty(tree.children)) |
43 | l.interpretation = first(tree.children).line; |
44 | } |
45 | setData(data); |
46 | //})); |
47 | } |
48 | } |
49 | |
50 | void ignoreLine {
|
51 | int i = selectedIndex(); |
52 | Line line = selected(); |
53 | if (line == null) ret; |
54 | LS context = collect text(subList(data(), 0, i)); |
55 | LS comments = ll( |
56 | "out = action", |
57 | "from simple wikipedia topic " + optQuote(topic), |
58 | "previous lines = " + quote(lines_rtrim(context))); |
59 | dm_gazelle_addRuleWithComment(line.text + "\n=> ignore", lines_rtrim(comments)); |
60 | } |
61 | |
62 | void makeRule {
|
63 | Line line = selected(); |
64 | if (line == null) ret; |
65 | dm_gazelle_newRuleDialog_3(line.text); |
66 | } |
67 | } |
Began life as a copy of #1021503
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1021516 |
| Snippet name: | Sentences from Simple Wikipedia (as list, with Gazelle analysis, dev.) |
| Eternal ID of this version: | #1021516/18 |
| Text MD5: | b67057d7bce955cc882f34ff6397c8bf |
| Transpilation MD5: | 8dd7c7189ccb3f4279396f9d91d2b159 |
| Author: | stefan |
| Category: | javax / stefan's os / a.i. |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-02-17 15:48:07 |
| Source code size: | 1890 bytes / 67 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 540 / 1012 |
| Version history: | 17 change(s) |
| Referenced in: | [show references] |