Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame^] | 1 | var snippet = "<span title=\"cnx/l:meist\">" + |
| 2 | " <span title=\"cnx/p:ADV\">" + |
| 3 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 4 | " <span title=\"mate/l:meist\">" + |
| 5 | " <span title=\"mate/p:ADV\">" + |
| 6 | " <span title=\"opennlp/p:ADV\">meist</span>" + |
| 7 | " </span>" + |
| 8 | " </span>" + |
| 9 | " </span>" + |
| 10 | " </span>" + |
| 11 | "</span>" + |
| 12 | "<span title=\"cnx/l:deutlich\">" + |
| 13 | " <span title=\"cnx/p:A\">" + |
| 14 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 15 | " <span title=\"mate/l:deutlich\">" + |
| 16 | " <span title=\"mate/m:degree:pos\">" + |
| 17 | " <span title=\"mate/p:ADJD\">" + |
| 18 | " <span title=\"opennlp/p:ADJD\">deutlich</span>" + |
| 19 | " </span>" + |
| 20 | " </span>" + |
| 21 | " </span>" + |
| 22 | " </span>" + |
| 23 | " </span>" + |
| 24 | "</span>" + |
| 25 | "<span title=\"cnx/l:fähig\">" + |
| 26 | " <span title=\"cnx/l:leistung\">" + |
| 27 | " <span title=\"cnx/p:A\">" + |
| 28 | " <span title=\"cnx/syn:@NH\">" + |
| 29 | " <span title=\"mate/l:leistungsfähig\">" + |
| 30 | " <span title=\"mate/m:degree:comp\">" + |
| 31 | " <span title=\"mate/p:ADJD\">" + |
| 32 | " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" + |
| 33 | " </span>" + |
| 34 | " </span>" + |
| 35 | " </span>" + |
| 36 | " </span>" + |
| 37 | " </span>" + |
| 38 | " </span>" + |
| 39 | "</span>"; |
| 40 | |
| 41 | var treeSnippet = |
| 42 | "<span class=\"context-left\"></span>" + |
| 43 | "<span class=\"match\">" + |
| 44 | " <span title=\"xip/c:MC\">" + |
| 45 | " <span title=\"xip/c:TOP\">" + |
| 46 | " <span title=\"xip/c:PP\">" + |
| 47 | " <span title=\"xip/c:PREP\">Mit</span>" + |
| 48 | " <span title=\"xip/c:NP\">" + |
| 49 | " <span title=\"xip/c:DET\">dieser</span>" + |
| 50 | " <span title=\"xip/c:NPA\">" + |
| 51 | " <span title=\"xip/c:NOUN\">Methode</span>" + |
| 52 | " </span>" + |
| 53 | " </span>" + |
| 54 | " </span>" + |
| 55 | " <span title=\"xip/c:VERB\">ist</span>" + |
| 56 | " <span title=\"xip/c:NP\">" + |
| 57 | " <span title=\"xip/c:PRON\">es</span>" + |
| 58 | " </span>" + |
| 59 | " <span title=\"xip/c:AP\">" + |
| 60 | " <span title=\"xip/c:ADV\">nun</span>" + |
| 61 | " <span title=\"xip/c:ADJ\">möglich</span>" + |
| 62 | " </span>" + |
| 63 | " <span title=\"xip/c:ADV\">z. B.</span>" + |
| 64 | " <span title=\"xip/c:NPA\">" + |
| 65 | " <span title=\"xip/c:NP\">" + |
| 66 | " <span title=\"xip/c:NOUN\">Voice</span>" + |
| 67 | " </span>" + |
| 68 | " </span>" + "(" + |
| 69 | " <span title=\"xip/c:INS\">" + |
| 70 | " <span title=\"xip/c:NPA\">" + |
| 71 | " <span title=\"xip/c:NP\">" + |
| 72 | " <span title=\"xip/c:NOUN\">Sprache</span>" + |
| 73 | " </span>" + |
| 74 | " </span>" + |
| 75 | " </span>" + ")" + |
| 76 | " <span title=\"xip/c:VERB\">bevorzugt</span>" + |
| 77 | " <span title=\"xip/c:PP\">" + |
| 78 | " <span title=\"xip/c:PREP\">in</span>" + |
| 79 | " <span title=\"xip/c:NP\">" + |
| 80 | " <span title=\"xip/c:PRON\">der</span>" + |
| 81 | " </span>" + |
| 82 | " <span title=\"xip/c:NPA\">" + |
| 83 | " <span title=\"xip/c:NP\">" + |
| 84 | " <span title=\"xip/c:NOUN\">Bridge</span>" + |
| 85 | " </span>" + |
| 86 | " </span>" + |
| 87 | " </span>" + |
| 88 | " <span title=\"xip/c:INFC\">" + |
| 89 | " <span title=\"xip/c:INS\">" + |
| 90 | " <span title=\"xip/c:VERB\">weiterzugeben</span>" + |
| 91 | " </span>" + |
| 92 | " </span>" + |
| 93 | " </span>" + |
| 94 | " </span>" + |
| 95 | "</span>" + |
| 96 | "<span class=\"context-right\"></span>"; |
| 97 | |
| 98 | /* |
| 99 | var available =[ |
| 100 | 'base/s=spans', |
| 101 | 'corenlp/c=spans', |
| 102 | 'corenlp/ne=tokens', |
| 103 | 'corenlp/p=tokens', |
| 104 | 'corenlp/s=spans', |
| 105 | 'glemm/l=tokens', |
| 106 | 'mate/l=tokens', |
| 107 | 'mate/m=tokens', |
| 108 | 'mate/p=tokens', |
| 109 | 'opennlp/p=tokens', |
| 110 | 'opennlp/s=spans', |
| 111 | 'tt/l=tokens', |
| 112 | 'tt/p=tokens', |
| 113 | 'tt/s=spans' |
| 114 | ]; |
| 115 | */ |
| 116 | /* |
| 117 | var match = { |
| 118 | 'corpusID' : 'WPD', |
| 119 | 'docID' : 'UUU', |
| 120 | 'textID' : '01912', |
| 121 | 'matchID' : 'p121-122' |
| 122 | }; |
| 123 | */ |
| 124 | |
| 125 | var menuContent = [ |
| 126 | ['cnx/c', 'cnx', 'c'], |
| 127 | ['mate/c', 'mate', 'c'], |
| 128 | ['base/c', 'base', 'c'], |
| 129 | ['xip/c', 'xip', 'c'], |
| 130 | ['tt/c', 'tt', 'c'] |
| 131 | ]; |
| 132 | |
| 133 | // Parse and show the table |
| 134 | // Override getMatchInfo API call |
| 135 | KorAP.API.getMatchInfo = function(match, callObj) { |
| 136 | if (callObj["spans"] !== undefined && callObj["spans"] === true) { |
| 137 | return { "snippet": treeSnippet }; |
| 138 | } |
| 139 | else { |
| 140 | return { "snippet": snippet }; |
| 141 | } |
| 142 | }; |
| 143 | |
| 144 | /** |
| 145 | * Do some things at the beginning. |
| 146 | */ |
| 147 | window.onload = function () { |
| 148 | |
| 149 | // Decorate actions |
| 150 | KorAP.init(); |
| 151 | |
| 152 | var menu = KorAP.MatchTreeMenu.create( |
| 153 | undefined, |
| 154 | menuContent |
| 155 | ); |
| 156 | |
| 157 | // Don't hide!!! |
| 158 | menu.hide = function () {}; |
| 159 | document.getElementById('menu').appendChild(menu.element()); |
| 160 | menu.limit(3); |
| 161 | menu.show(); |
| 162 | menu.focus(); |
| 163 | /* |
| 164 | var e = KorAP.MatchInfo.create(match, available); |
| 165 | document.getElementById('WPD-WWW.03313-p102-103').children[0].appendChild(e.element()); |
| 166 | e.addTree('cnx', 'c'); |
| 167 | */ |
| 168 | }; |