Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>MatchInfo demo</title> |
| 5 | <meta charset="utf-8" /> |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 6 | <script src="../lib/dagre/dagre.min.js"></script> |
| 7 | <script src="../src/menu.js"></script> |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 8 | <script src="../src/matchInfo.js"></script> |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 9 | <link type="text/css" rel="stylesheet" href="../../css/font-awesome.min.css"></link> |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame^] | 10 | <link type="text/css" rel="stylesheet" href="../../css/build/kalamar.css"></link> |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 11 | <style type="text/css" rel="stylesheet"> |
| 12 | |
| 13 | body { |
| 14 | background-color: #ffa500; |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | body, text { |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 18 | font-family: tahoma, verdana, arial; |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 19 | color: #444; |
| 20 | } |
| 21 | |
| 22 | text { |
| 23 | fill: #444; |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | </style> |
| 27 | </head> |
| 28 | <body> |
| 29 | |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 30 | <script> |
| 31 | var snippet = "<span title=\"cnx/l:meist\">" + |
| 32 | " <span title=\"cnx/p:ADV\">" + |
| 33 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 34 | " <span title=\"mate/l:meist\">" + |
| 35 | " <span title=\"mate/p:ADV\">" + |
| 36 | " <span title=\"opennlp/p:ADV\">meist</span>" + |
| 37 | " </span>" + |
| 38 | " </span>" + |
| 39 | " </span>" + |
| 40 | " </span>" + |
| 41 | "</span>" + |
| 42 | "<span title=\"cnx/l:deutlich\">" + |
| 43 | " <span title=\"cnx/p:A\">" + |
| 44 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 45 | " <span title=\"mate/l:deutlich\">" + |
| 46 | " <span title=\"mate/m:degree:pos\">" + |
| 47 | " <span title=\"mate/p:ADJD\">" + |
| 48 | " <span title=\"opennlp/p:ADJD\">deutlich</span>" + |
| 49 | " </span>" + |
| 50 | " </span>" + |
| 51 | " </span>" + |
| 52 | " </span>" + |
| 53 | " </span>" + |
| 54 | "</span>" + |
| 55 | "<span title=\"cnx/l:fähig\">" + |
| 56 | " <span title=\"cnx/l:leistung\">" + |
| 57 | " <span title=\"cnx/p:A\">" + |
| 58 | " <span title=\"cnx/syn:@NH\">" + |
| 59 | " <span title=\"mate/l:leistungsfähig\">" + |
| 60 | " <span title=\"mate/m:degree:comp\">" + |
| 61 | " <span title=\"mate/p:ADJD\">" + |
| 62 | " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" + |
| 63 | " </span>" + |
| 64 | " </span>" + |
| 65 | " </span>" + |
| 66 | " </span>" + |
| 67 | " </span>" + |
| 68 | " </span>" + |
| 69 | "</span>"; |
| 70 | |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 71 | var treeSnippet = |
| 72 | "<span class=\"context-left\"></span>" + |
| 73 | "<span class=\"match\">" + |
| 74 | " <span title=\"xip/c:MC\">" + |
| 75 | " <span title=\"xip/c:TOP\">" + |
| 76 | " <span title=\"xip/c:PP\">" + |
| 77 | " <span title=\"xip/c:PREP\">Mit</span>" + |
| 78 | " <span title=\"xip/c:NP\">" + |
| 79 | " <span title=\"xip/c:DET\">dieser</span>" + |
| 80 | " <span title=\"xip/c:NPA\">" + |
| 81 | " <span title=\"xip/c:NOUN\">Methode</span>" + |
| 82 | " </span>" + |
| 83 | " </span>" + |
| 84 | " </span>" + |
| 85 | " <span title=\"xip/c:VERB\">ist</span>" + |
| 86 | " <span title=\"xip/c:NP\">" + |
| 87 | " <span title=\"xip/c:PRON\">es</span>" + |
| 88 | " </span>" + |
| 89 | " <span title=\"xip/c:AP\">" + |
| 90 | " <span title=\"xip/c:ADV\">nun</span>" + |
| 91 | " <span title=\"xip/c:ADJ\">möglich</span>" + |
| 92 | " </span>" + |
| 93 | " <span title=\"xip/c:ADV\">z. B.</span>" + |
| 94 | " <span title=\"xip/c:NPA\">" + |
| 95 | " <span title=\"xip/c:NP\">" + |
| 96 | " <span title=\"xip/c:NOUN\">Voice</span>" + |
| 97 | " </span>" + |
| 98 | " </span>" + "(" + |
| 99 | " <span title=\"xip/c:INS\">" + |
| 100 | " <span title=\"xip/c:NPA\">" + |
| 101 | " <span title=\"xip/c:NP\">" + |
| 102 | " <span title=\"xip/c:NOUN\">Sprache</span>" + |
| 103 | " </span>" + |
| 104 | " </span>" + |
| 105 | " </span>" + ")" + |
| 106 | " <span title=\"xip/c:VERB\">bevorzugt</span>" + |
| 107 | " <span title=\"xip/c:PP\">" + |
| 108 | " <span title=\"xip/c:PREP\">in</span>" + |
| 109 | " <span title=\"xip/c:NP\">" + |
| 110 | " <span title=\"xip/c:PRON\">der</span>" + |
| 111 | " </span>" + |
| 112 | " <span title=\"xip/c:NPA\">" + |
| 113 | " <span title=\"xip/c:NP\">" + |
| 114 | " <span title=\"xip/c:NOUN\">Bridge</span>" + |
| 115 | " </span>" + |
| 116 | " </span>" + |
| 117 | " </span>" + |
| 118 | " <span title=\"xip/c:INFC\">" + |
| 119 | " <span title=\"xip/c:INS\">" + |
| 120 | " <span title=\"xip/c:VERB\">weiterzugeben</span>" + |
| 121 | " </span>" + |
| 122 | " </span>" + |
| 123 | " </span>" + |
| 124 | " </span>" + |
| 125 | "</span>" + |
| 126 | "<span class=\"context-right\"></span>"; |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 127 | |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 128 | var available =[ |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 129 | 'base/s=spans', |
| 130 | 'corenlp/c=spans', |
| 131 | 'corenlp/ne=tokens', |
| 132 | 'corenlp/p=tokens', |
| 133 | 'corenlp/s=spans', |
| 134 | 'glemm/l=tokens', |
| 135 | 'mate/l=tokens', |
| 136 | 'mate/m=tokens', |
| 137 | 'mate/p=tokens', |
| 138 | 'opennlp/p=tokens', |
| 139 | 'opennlp/s=spans', |
| 140 | 'tt/l=tokens', |
| 141 | 'tt/p=tokens', |
| 142 | 'tt/s=spans' |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 143 | ]; |
| 144 | |
| 145 | var match = { |
| 146 | 'corpusID' : 'WPD', |
| 147 | 'docID' : 'UUU', |
| 148 | 'textID' : '01912', |
| 149 | 'pos' : 'p121-122' |
| 150 | }; |
| 151 | |
| 152 | // Parse and show the table |
| 153 | // Override getMatchInfo API call |
| 154 | KorAP.API.getMatchInfo = function(match, callObj) { |
| 155 | if (callObj["spans"] !== undefined && callObj["spans"] === true) { |
| 156 | return { "snippet": treeSnippet }; |
| 157 | } |
| 158 | else { |
| 159 | return { "snippet": snippet }; |
| 160 | } |
| 161 | }; |
| 162 | |
Nils Diewald | ea23674 | 2015-03-26 21:55:36 +0000 | [diff] [blame^] | 163 | var e = KorAP.MatchInfo.create(match, available); |
| 164 | |
| 165 | document.getElementsByTagName('body')[0].appendChild(e.element()); |
| 166 | |
| 167 | |
| 168 | e.addTree('cnx', 'c'); |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 169 | |
| 170 | /* |
| 171 | var t = KorAP.MatchInfo.create(match, available).getTable(); |
| 172 | document.getElementsByClassName('matchtable')[0] |
| 173 | .appendChild(t.element()); |
| 174 | |
| 175 | // parse and show the tree |
| 176 | KorAP.API.getMatchInfo = function() { |
| 177 | return { "snippet": treeSnippet }; |
| 178 | }; |
| 179 | |
| 180 | var tree = KorAP.MatchInfo.create(match, available).getTree(); |
| 181 | document.getElementsByClassName('matchtree')[0] |
| 182 | .getElementsByTagName('div')[0] |
| 183 | .appendChild(tree.element()); |
| 184 | |
| 185 | tree.center(); |
| 186 | */ |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 187 | </script> |
| 188 | |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 189 | <!-- |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 190 | <div class="matchinfo"> |
| 191 | <div class="matchtable"> |
| 192 | <table> |
| 193 | <thead> |
| 194 | <tr> |
| 195 | <th>Foundry</th> |
| 196 | <th>Layer</th> |
| 197 | <th>Ich</th> |
| 198 | <th>Du</th> |
| 199 | <th>Er</th> |
| 200 | </tr> |
| 201 | </thead> |
| 202 | <tbody> |
| 203 | <tr tabindex="0"> |
| 204 | <th>Hallo</th> |
| 205 | <th>X</th> |
| 206 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 207 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ<br />ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 208 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 209 | </tr> |
| 210 | <tr tabindex="0"> |
| 211 | <th>geht</th> |
| 212 | <th>y</th> |
| 213 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 214 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 215 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ<br />ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ<br />ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 216 | </tr> |
| 217 | <tr tabindex="0"> |
| 218 | <th>es</th> |
| 219 | <th>z</th> |
| 220 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
Nils Diewald | 6e43ffd | 2015-03-25 18:55:39 +0000 | [diff] [blame] | 221 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 222 | <td>ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ<br />ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ<br />ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU VWX YZ</td> |
| 223 | </tr> |
| 224 | </tbody> |
| 225 | </table> |
| 226 | </div> |
| 227 | </div> |
| 228 | --> |
Nils Diewald | 8bc7e41 | 2015-03-19 22:08:27 +0000 | [diff] [blame] | 229 | |
| 230 | </body> |
| 231 | </html> |