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