Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 1 | requirejs.config({ |
| 2 | baseUrl: '../js/src', |
| 3 | paths : { |
| 4 | 'lib': '../lib' |
| 5 | } |
| 6 | }); |
| 7 | |
| 8 | // Parse and show the table |
| 9 | // Override getMatchInfo API call |
| 10 | require(['init'], function () { |
| 11 | |
Nils Diewald | 4347ee9 | 2015-05-04 20:32:48 +0000 | [diff] [blame] | 12 | var snippet = "<span title=\"cnx/l:meist\">" + |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 13 | " <span title=\"cnx/p:ADV\">" + |
| 14 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 15 | " <span title=\"mate/l:meist\">" + |
| 16 | " <span title=\"mate/p:ADV\">" + |
| 17 | " <span title=\"opennlp/p:ADV\">meist</span>" + |
| 18 | " </span>" + |
| 19 | " </span>" + |
| 20 | " </span>" + |
| 21 | " </span>" + |
| 22 | "</span>" + |
| 23 | "<span title=\"cnx/l:deutlich\">" + |
| 24 | " <span title=\"cnx/p:A\">" + |
| 25 | " <span title=\"cnx/syn:@PREMOD\">" + |
| 26 | " <span title=\"mate/l:deutlich\">" + |
| 27 | " <span title=\"mate/m:degree:pos\">" + |
| 28 | " <span title=\"mate/p:ADJD\">" + |
| 29 | " <span title=\"opennlp/p:ADJD\">deutlich</span>" + |
| 30 | " </span>" + |
| 31 | " </span>" + |
| 32 | " </span>" + |
| 33 | " </span>" + |
| 34 | " </span>" + |
| 35 | "</span>" + |
| 36 | "<span title=\"cnx/l:fähig\">" + |
| 37 | " <span title=\"cnx/l:leistung\">" + |
| 38 | " <span title=\"cnx/p:A\">" + |
| 39 | " <span title=\"cnx/syn:@NH\">" + |
| 40 | " <span title=\"mate/l:leistungsfähig\">" + |
| 41 | " <span title=\"mate/m:degree:comp\">" + |
| 42 | " <span title=\"mate/p:ADJD\">" + |
| 43 | " <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" + |
| 44 | " </span>" + |
| 45 | " </span>" + |
| 46 | " </span>" + |
| 47 | " </span>" + |
| 48 | " </span>" + |
| 49 | " </span>" + |
| 50 | "</span>"; |
| 51 | |
Akron | 98a933f | 2016-08-11 00:19:17 +0200 | [diff] [blame] | 52 | var treeSnippet = |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 53 | "<span class=\"context-left\"></span>" + |
| 54 | "<span class=\"match\">" + |
| 55 | " <span title=\"xip/c:MC\">" + |
| 56 | " <span title=\"xip/c:TOP\">" + |
| 57 | " <span title=\"xip/c:PP\">" + |
| 58 | " <span title=\"xip/c:PREP\">Mit</span>" + |
| 59 | " <span title=\"xip/c:NP\">" + |
| 60 | " <span title=\"xip/c:DET\">dieser</span>" + |
| 61 | " <span title=\"xip/c:NPA\">" + |
| 62 | " <span title=\"xip/c:NOUN\">Methode</span>" + |
| 63 | " </span>" + |
| 64 | " </span>" + |
| 65 | " </span>" + |
| 66 | " <span title=\"xip/c:VERB\">ist</span>" + |
Akron | 98a933f | 2016-08-11 00:19:17 +0200 | [diff] [blame] | 67 | " <mark>" + |
| 68 | " <span title=\"xip/c:NP\">" + |
| 69 | " <span title=\"xip/c:PRON\">es</span>" + |
| 70 | " </span>" + |
| 71 | " <span title=\"xip/c:AP\">" + |
| 72 | " <span title=\"xip/c:ADV\">nun</span>" + |
| 73 | " <span title=\"xip/c:ADJ\">möglich</span>" + |
| 74 | " </span>" + |
| 75 | " </mark>" + |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 76 | " <span title=\"xip/c:ADV\">z. B.</span>" + |
| 77 | " <span title=\"xip/c:NPA\">" + |
| 78 | " <span title=\"xip/c:NP\">" + |
| 79 | " <span title=\"xip/c:NOUN\">Voice</span>" + |
| 80 | " </span>" + |
| 81 | " </span>" + "(" + |
| 82 | " <span title=\"xip/c:INS\">" + |
| 83 | " <span title=\"xip/c:NPA\">" + |
| 84 | " <span title=\"xip/c:NP\">" + |
| 85 | " <span title=\"xip/c:NOUN\">Sprache</span>" + |
| 86 | " </span>" + |
| 87 | " </span>" + |
| 88 | " </span>" + ")" + |
| 89 | " <span title=\"xip/c:VERB\">bevorzugt</span>" + |
| 90 | " <span title=\"xip/c:PP\">" + |
| 91 | " <span title=\"xip/c:PREP\">in</span>" + |
| 92 | " <span title=\"xip/c:NP\">" + |
| 93 | " <span title=\"xip/c:PRON\">der</span>" + |
| 94 | " </span>" + |
| 95 | " <span title=\"xip/c:NPA\">" + |
| 96 | " <span title=\"xip/c:NP\">" + |
| 97 | " <span title=\"xip/c:NOUN\">Bridge</span>" + |
| 98 | " </span>" + |
| 99 | " </span>" + |
| 100 | " </span>" + |
| 101 | " <span title=\"xip/c:INFC\">" + |
| 102 | " <span title=\"xip/c:INS\">" + |
| 103 | " <span title=\"xip/c:VERB\">weiterzugeben</span>" + |
| 104 | " </span>" + |
| 105 | " </span>" + |
| 106 | " </span>" + |
| 107 | " </span>" + |
| 108 | "</span>" + |
| 109 | "<span class=\"context-right\"></span>"; |
| 110 | |
Akron | aa01dca | 2018-02-05 19:51:28 +0100 | [diff] [blame] | 111 | |
| 112 | var relSnippet = |
| 113 | "<span class=\"context-left\"></span>"+ |
| 114 | "<span class=\"match\">"+ |
| 115 | " <span xml:id=\"token-WDD17/982/72848-p15836-15839\">"+ |
| 116 | " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>"+ |
| 117 | " "+ |
| 118 | " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>"+ |
| 119 | " "+ |
| 120 | " <span xml:id=\"token-WDD17/982/72848-p15838\">"+ |
| 121 | // s1464_n2 "ein" -> ":" |
| 122 | " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>"+ |
| 123 | " </span>"+ |
| 124 | ": "+ |
| 125 | " <span xml:id=\"token-WDD17/982/72848-p15839-15840\">"+ |
| 126 | " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>"+ |
| 127 | " </span>"+ |
| 128 | " </span>"+ |
| 129 | " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">"+ |
| 130 | ":"+ |
| 131 | " <span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+ |
| 132 | " <span xml:id=\"token-WDD17/982/72848-p15840\">"+ |
| 133 | " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>"+ |
| 134 | " </span>"+ |
| 135 | " </span>"+ |
| 136 | " </span>"+ |
| 137 | " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">"+ |
| 138 | " "+ |
| 139 | " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>"+ |
| 140 | " "+ |
| 141 | " <span xml:id=\"token-WDD17/982/72848-p15842\">"+ |
| 142 | " <span xlink:title=\"lwc/d:OA\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>"+ |
| 143 | " </span>"+ |
| 144 | " "+ |
| 145 | " <span xml:id=\"token-WDD17/982/72848-p15843\">"+ |
| 146 | " <span xlink:title=\"lwc/d:PD\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>"+ |
| 147 | " </span>"+ |
| 148 | ", "+ |
| 149 | " <mark>"+ |
| 150 | " <span xlink:title=\"lwc/d:MO\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>"+ |
| 151 | " "+ |
| 152 | " <span xml:id=\"token-WDD17/982/72848-p15845\">"+ |
| 153 | " <span xlink:title=\"lwc/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>"+ |
| 154 | " </span>"+ |
| 155 | " </mark>"+ |
| 156 | " </span>"+ |
| 157 | "</span>"+ |
| 158 | "<span class=\"context-right\"></span>"; |
| 159 | |
Akron | 0ad7cd2 | 2018-02-08 18:03:06 +0100 | [diff] [blame] | 160 | var meta = {"messages":[["Response format is temporary"]],"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{},"document":{"@type":"koral:document","fields":[{"@type":"koral:field","type":"type:store","key":"ref","value":"My reference"},{"@type":"koral:field","type":"type:text","key":"title","value":"Der Name der Rose"},{"@type":"koral:field","type":"type:string","key":"textSigle","value":"a/b/c"},{"@type":"koral:field","type":"type:string","key":"keyword","value":["baum","wald"]},{"@type":"koral:field","type":"type:number","key":"zahl1","value":56},{"@type":"koral:field","type":"type:string","key":"name","value":"Peter"}]}}; |
| 161 | |
| 162 | meta = {"messages":[["Response format is temporary"]],"@context":"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld","meta":{},"document":{"@type":"koral:document","fields":[{"@type":"koral:field","type":"type:number","key":"pubDate","value":20170701},{"@type":"koral:field","type":"type:string","key":"textSigle","value":"WDD17/982/72848"},{"@type":"koral:field","type":"type:string","key":"foundries","value":"dereko dereko/structure dereko/structure/base-sentences-paragraphs-pagebreaks lwc lwc/dependency treetagger treetagger/morpho"},{"@type":"koral:field","type":"type:string","key":"corpusSigle","value":"WDD17"},{"@type":"koral:field","type":"type:string","key":"docSigle","value":"WDD17/982"},{"@type":"koral:field","type":"type:store","key":"reference","value":"Diskussion:99 Namen Allahs/Archiv/1, In: Wikipedia - URL:http://de.wikipedia.org/wiki/Diskussion:99_Namen_Allahs/Archiv/1: Wikipedia, 2017"},{"@type":"koral:field","type":"type:text","key":"author","value":"ArchivBot, u.a."},{"@type":"koral:field","type":"type:number","key":"creationDate","value":20140609},{"@type":"koral:field","type":"type:string","key":"textTypeArt","value":"Diskussion"},{"@type":"koral:field","type":"type:store","key":"editor","value":"wikipedia.org"},{"@type":"koral:field","type":"type:text","key":"title","value":"Diskussion:99 Namen Allahs/Archiv/1"},{"@type":"koral:field","type":"type:store","key":"tokenSource","value":"base#tokens"},{"@type":"koral:field","type":"type:store","key":"layerInfos","value":"dereko/s=spans lwc/d=rels tt/l=tokens tt/p=tokens"},{"@type":"koral:field","type":"type:string","key":"textClass","value":"staat-gesellschaft biographien-interviews"},{"@type":"koral:field","type":"type:string","key":"availability","value":"CC-BY-SA"}]}} |
| 163 | |
| 164 | |
Akron | 98a933f | 2016-08-11 00:19:17 +0200 | [diff] [blame] | 165 | // var treeSnippet = "<span class=\"context-left\"><\/span><span class=\"match\">In diesem <span title=\"cnx\/c:np\">Sinne<\/span> schrieb <span title=\"cnx\/c:np\">Brunschwicg<\/span>:"In <span title=\"cnx\/c:np\">Euklids<\/span> <span title=\"cnx\/c:np\">Elementen<\/span> <span title=\"cnx\/c:np\">spiegel<\/span> sich die <span title=\"cnx\/c:np\">Resultate<\/span> der <span title=\"cnx\/c:np\">Arbeit von Generationen vor Aristoteles<\/span> wider, nicht nur die <span title=\"cnx\/c:np\">technische Arbeit<\/span> der <span title=\"cnx\/c:np\">Entdecklung<\/span>, sondern auch die <span title=\"cnx\/c:np\">methodologische Arbeit<\/span> der <span title=\"cnx\/c:np\">Verbindung<\/span> und des <span title=\"cnx\/c:np\">Beweises<\/span>, die, in der <span title=\"cnx\/c:np\">Schule<\/span> des <span title=\"cnx\/c:np\">Phythagoras<\/span> begonnen, ihre <span title=\"cnx\/c:np\">Vollendung in den Schulen von Eudoxos von Cnidus<\/span> und <span title=\"cnx\/c:np\">Platon<\/span> gefunden hat"(5<\/span><span class=\"context-right\"><\/span>"; |
Nils Diewald | 4347ee9 | 2015-05-04 20:32:48 +0000 | [diff] [blame] | 166 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 167 | KorAP.API.getMatchInfo = function(match, callObj, cb) { |
Akron | 7f613e0 | 2016-11-07 02:50:44 +0100 | [diff] [blame] | 168 | console.dir(callObj); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 169 | if (callObj["spans"] !== undefined && callObj["spans"] === true) { |
Akron | aa01dca | 2018-02-05 19:51:28 +0100 | [diff] [blame] | 170 | if (callObj["layer"] === "d") { |
| 171 | return cb({ "snippet": relSnippet }); |
| 172 | } |
| 173 | else { |
| 174 | return cb({ "snippet": treeSnippet }); |
| 175 | } |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 176 | } |
| 177 | else { |
| 178 | return cb({ "snippet": snippet }); |
| 179 | } |
| 180 | }; |
Akron | 0ad7cd2 | 2018-02-08 18:03:06 +0100 | [diff] [blame] | 181 | |
| 182 | KorAP.API.getTextInfo = function(doc, callObj, cb) { |
| 183 | return cb(meta); |
| 184 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 185 | }); |