Commit b493dfd9d6ac2b2a67dbbbe41b3c93e8cd0ab8ae
0 parents
Initial commit
Showing
201 changed files
with
16423 additions
and
0 deletions
Too many changes to show.
To preserve performance only 54 of 201 files are displayed.
.gitignore
0 → 100644
doc/llncs.cls
0 → 100755
1 | +++ a/doc/llncs.cls | |
1 | +% LLNCS DOCUMENT CLASS -- version 2.17 (12-Jul-2010) | |
2 | +% Springer Verlag LaTeX2e support for Lecture Notes in Computer Science | |
3 | +% | |
4 | +%% | |
5 | +%% \CharacterTable | |
6 | +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z | |
7 | +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z | |
8 | +%% Digits \0\1\2\3\4\5\6\7\8\9 | |
9 | +%% Exclamation \! Double quote \" Hash (number) \# | |
10 | +%% Dollar \$ Percent \% Ampersand \& | |
11 | +%% Acute accent \' Left paren \( Right paren \) | |
12 | +%% Asterisk \* Plus \+ Comma \, | |
13 | +%% Minus \- Point \. Solidus \/ | |
14 | +%% Colon \: Semicolon \; Less than \< | |
15 | +%% Equals \= Greater than \> Question mark \? | |
16 | +%% Commercial at \@ Left bracket \[ Backslash \\ | |
17 | +%% Right bracket \] Circumflex \^ Underscore \_ | |
18 | +%% Grave accent \` Left brace \{ Vertical bar \| | |
19 | +%% Right brace \} Tilde \~} | |
20 | +%% | |
21 | +\NeedsTeXFormat{LaTeX2e}[1995/12/01] | |
22 | +\ProvidesClass{llncs}[2010/07/12 v2.17 | |
23 | +^^J LaTeX document class for Lecture Notes in Computer Science] | |
24 | +% Options | |
25 | +\let\if@envcntreset\iffalse | |
26 | +\DeclareOption{envcountreset}{\let\if@envcntreset\iftrue} | |
27 | +\DeclareOption{citeauthoryear}{\let\citeauthoryear=Y} | |
28 | +\DeclareOption{oribibl}{\let\oribibl=Y} | |
29 | +\let\if@custvec\iftrue | |
30 | +\DeclareOption{orivec}{\let\if@custvec\iffalse} | |
31 | +\let\if@envcntsame\iffalse | |
32 | +\DeclareOption{envcountsame}{\let\if@envcntsame\iftrue} | |
33 | +\let\if@envcntsect\iffalse | |
34 | +\DeclareOption{envcountsect}{\let\if@envcntsect\iftrue} | |
35 | +\let\if@runhead\iffalse | |
36 | +\DeclareOption{runningheads}{\let\if@runhead\iftrue} | |
37 | + | |
38 | +\let\if@openright\iftrue | |
39 | +\let\if@openbib\iffalse | |
40 | +\DeclareOption{openbib}{\let\if@openbib\iftrue} | |
41 | + | |
42 | +% languages | |
43 | +\let\switcht@@therlang\relax | |
44 | +\def\ds@deutsch{\def\switcht@@therlang{\switcht@deutsch}} | |
45 | +\def\ds@francais{\def\switcht@@therlang{\switcht@francais}} | |
46 | + | |
47 | +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} | |
48 | + | |
49 | +\ProcessOptions | |
50 | + | |
51 | +\LoadClass[twoside]{article} | |
52 | +\RequirePackage{multicol} % needed for the list of participants, index | |
53 | +\RequirePackage{aliascnt} | |
54 | + | |
55 | +\setlength{\textwidth}{12.2cm} | |
56 | +\setlength{\textheight}{19.3cm} | |
57 | +\renewcommand\@pnumwidth{2em} | |
58 | +\renewcommand\@tocrmarg{3.5em} | |
59 | +% | |
60 | +\def\@dottedtocline#1#2#3#4#5{% | |
61 | + \ifnum #1>\c@tocdepth \else | |
62 | + \vskip \z@ \@plus.2\p@ | |
63 | + {\leftskip #2\relax \rightskip \@tocrmarg \advance\rightskip by 0pt plus 2cm | |
64 | + \parfillskip -\rightskip \pretolerance=10000 | |
65 | + \parindent #2\relax\@afterindenttrue | |
66 | + \interlinepenalty\@M | |
67 | + \leavevmode | |
68 | + \@tempdima #3\relax | |
69 | + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip | |
70 | + {#4}\nobreak | |
71 | + \leaders\hbox{$\m@th | |
72 | + \mkern \@dotsep mu\hbox{.}\mkern \@dotsep | |
73 | + mu$}\hfill | |
74 | + \nobreak | |
75 | + \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}% | |
76 | + \par}% | |
77 | + \fi} | |
78 | +% | |
79 | +\def\switcht@albion{% | |
80 | +\def\abstractname{Abstract.} | |
81 | +\def\ackname{Acknowledgement.} | |
82 | +\def\andname{and} | |
83 | +\def\lastandname{\unskip, and} | |
84 | +\def\appendixname{Appendix} | |
85 | +\def\chaptername{Chapter} | |
86 | +\def\claimname{Claim} | |
87 | +\def\conjecturename{Conjecture} | |
88 | +\def\contentsname{Table of Contents} | |
89 | +\def\corollaryname{Corollary} | |
90 | +\def\definitionname{Definition} | |
91 | +\def\examplename{Example} | |
92 | +\def\exercisename{Exercise} | |
93 | +\def\figurename{Fig.} | |
94 | +\def\keywordname{{\bf Keywords:}} | |
95 | +\def\indexname{Index} | |
96 | +\def\lemmaname{Lemma} | |
97 | +\def\contriblistname{List of Contributors} | |
98 | +\def\listfigurename{List of Figures} | |
99 | +\def\listtablename{List of Tables} | |
100 | +\def\mailname{{\it Correspondence to\/}:} | |
101 | +\def\noteaddname{Note added in proof} | |
102 | +\def\notename{Note} | |
103 | +\def\partname{Part} | |
104 | +\def\problemname{Problem} | |
105 | +\def\proofname{Proof} | |
106 | +\def\propertyname{Property} | |
107 | +\def\propositionname{Proposition} | |
108 | +\def\questionname{Question} | |
109 | +\def\remarkname{Remark} | |
110 | +\def\seename{see} | |
111 | +\def\solutionname{Solution} | |
112 | +\def\subclassname{{\it Subject Classifications\/}:} | |
113 | +\def\tablename{Table} | |
114 | +\def\theoremname{Theorem}} | |
115 | +\switcht@albion | |
116 | +% Names of theorem like environments are already defined | |
117 | +% but must be translated if another language is chosen | |
118 | +% | |
119 | +% French section | |
120 | +\def\switcht@francais{%\typeout{On parle francais.}% | |
121 | + \def\abstractname{R\'esum\'e.}% | |
122 | + \def\ackname{Remerciements.}% | |
123 | + \def\andname{et}% | |
124 | + \def\lastandname{ et}% | |
125 | + \def\appendixname{Appendice} | |
126 | + \def\chaptername{Chapitre}% | |
127 | + \def\claimname{Pr\'etention}% | |
128 | + \def\conjecturename{Hypoth\`ese}% | |
129 | + \def\contentsname{Table des mati\`eres}% | |
130 | + \def\corollaryname{Corollaire}% | |
131 | + \def\definitionname{D\'efinition}% | |
132 | + \def\examplename{Exemple}% | |
133 | + \def\exercisename{Exercice}% | |
134 | + \def\figurename{Fig.}% | |
135 | + \def\keywordname{{\bf Mots-cl\'e:}} | |
136 | + \def\indexname{Index} | |
137 | + \def\lemmaname{Lemme}% | |
138 | + \def\contriblistname{Liste des contributeurs} | |
139 | + \def\listfigurename{Liste des figures}% | |
140 | + \def\listtablename{Liste des tables}% | |
141 | + \def\mailname{{\it Correspondence to\/}:} | |
142 | + \def\noteaddname{Note ajout\'ee \`a l'\'epreuve}% | |
143 | + \def\notename{Remarque}% | |
144 | + \def\partname{Partie}% | |
145 | + \def\problemname{Probl\`eme}% | |
146 | + \def\proofname{Preuve}% | |
147 | + \def\propertyname{Caract\'eristique}% | |
148 | +%\def\propositionname{Proposition}% | |
149 | + \def\questionname{Question}% | |
150 | + \def\remarkname{Remarque}% | |
151 | + \def\seename{voir} | |
152 | + \def\solutionname{Solution}% | |
153 | + \def\subclassname{{\it Subject Classifications\/}:} | |
154 | + \def\tablename{Tableau}% | |
155 | + \def\theoremname{Th\'eor\`eme}% | |
156 | +} | |
157 | +% | |
158 | +% German section | |
159 | +\def\switcht@deutsch{%\typeout{Man spricht deutsch.}% | |
160 | + \def\abstractname{Zusammenfassung.}% | |
161 | + \def\ackname{Danksagung.}% | |
162 | + \def\andname{und}% | |
163 | + \def\lastandname{ und}% | |
164 | + \def\appendixname{Anhang}% | |
165 | + \def\chaptername{Kapitel}% | |
166 | + \def\claimname{Behauptung}% | |
167 | + \def\conjecturename{Hypothese}% | |
168 | + \def\contentsname{Inhaltsverzeichnis}% | |
169 | + \def\corollaryname{Korollar}% | |
170 | +%\def\definitionname{Definition}% | |
171 | + \def\examplename{Beispiel}% | |
172 | + \def\exercisename{\"Ubung}% | |
173 | + \def\figurename{Abb.}% | |
174 | + \def\keywordname{{\bf Schl\"usselw\"orter:}} | |
175 | + \def\indexname{Index} | |
176 | +%\def\lemmaname{Lemma}% | |
177 | + \def\contriblistname{Mitarbeiter} | |
178 | + \def\listfigurename{Abbildungsverzeichnis}% | |
179 | + \def\listtablename{Tabellenverzeichnis}% | |
180 | + \def\mailname{{\it Correspondence to\/}:} | |
181 | + \def\noteaddname{Nachtrag}% | |
182 | + \def\notename{Anmerkung}% | |
183 | + \def\partname{Teil}% | |
184 | +%\def\problemname{Problem}% | |
185 | + \def\proofname{Beweis}% | |
186 | + \def\propertyname{Eigenschaft}% | |
187 | +%\def\propositionname{Proposition}% | |
188 | + \def\questionname{Frage}% | |
189 | + \def\remarkname{Anmerkung}% | |
190 | + \def\seename{siehe} | |
191 | + \def\solutionname{L\"osung}% | |
192 | + \def\subclassname{{\it Subject Classifications\/}:} | |
193 | + \def\tablename{Tabelle}% | |
194 | +%\def\theoremname{Theorem}% | |
195 | +} | |
196 | + | |
197 | +% Ragged bottom for the actual page | |
198 | +\def\thisbottomragged{\def\@textbottom{\vskip\z@ plus.0001fil | |
199 | +\global\let\@textbottom\relax}} | |
200 | + | |
201 | +\renewcommand\small{% | |
202 | + \@setfontsize\small\@ixpt{11}% | |
203 | + \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@ | |
204 | + \abovedisplayshortskip \z@ \@plus2\p@ | |
205 | + \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@ | |
206 | + \def\@listi{\leftmargin\leftmargini | |
207 | + \parsep 0\p@ \@plus1\p@ \@minus\p@ | |
208 | + \topsep 8\p@ \@plus2\p@ \@minus4\p@ | |
209 | + \itemsep0\p@}% | |
210 | + \belowdisplayskip \abovedisplayskip | |
211 | +} | |
212 | + | |
213 | +\frenchspacing | |
214 | +\widowpenalty=10000 | |
215 | +\clubpenalty=10000 | |
216 | + | |
217 | +\setlength\oddsidemargin {63\p@} | |
218 | +\setlength\evensidemargin {63\p@} | |
219 | +\setlength\marginparwidth {90\p@} | |
220 | + | |
221 | +\setlength\headsep {16\p@} | |
222 | + | |
223 | +\setlength\footnotesep{7.7\p@} | |
224 | +\setlength\textfloatsep{8mm\@plus 2\p@ \@minus 4\p@} | |
225 | +\setlength\intextsep {8mm\@plus 2\p@ \@minus 2\p@} | |
226 | + | |
227 | +\setcounter{secnumdepth}{2} | |
228 | + | |
229 | +\newcounter {chapter} | |
230 | +\renewcommand\thechapter {\@arabic\c@chapter} | |
231 | + | |
232 | +\newif\if@mainmatter \@mainmattertrue | |
233 | +\newcommand\frontmatter{\cleardoublepage | |
234 | + \@mainmatterfalse\pagenumbering{Roman}} | |
235 | +\newcommand\mainmatter{\cleardoublepage | |
236 | + \@mainmattertrue\pagenumbering{arabic}} | |
237 | +\newcommand\backmatter{\if@openright\cleardoublepage\else\clearpage\fi | |
238 | + \@mainmatterfalse} | |
239 | + | |
240 | +\renewcommand\part{\cleardoublepage | |
241 | + \thispagestyle{empty}% | |
242 | + \if@twocolumn | |
243 | + \onecolumn | |
244 | + \@tempswatrue | |
245 | + \else | |
246 | + \@tempswafalse | |
247 | + \fi | |
248 | + \null\vfil | |
249 | + \secdef\@part\@spart} | |
250 | + | |
251 | +\def\@part[#1]#2{% | |
252 | + \ifnum \c@secnumdepth >-2\relax | |
253 | + \refstepcounter{part}% | |
254 | + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% | |
255 | + \else | |
256 | + \addcontentsline{toc}{part}{#1}% | |
257 | + \fi | |
258 | + \markboth{}{}% | |
259 | + {\centering | |
260 | + \interlinepenalty \@M | |
261 | + \normalfont | |
262 | + \ifnum \c@secnumdepth >-2\relax | |
263 | + \huge\bfseries \partname~\thepart | |
264 | + \par | |
265 | + \vskip 20\p@ | |
266 | + \fi | |
267 | + \Huge \bfseries #2\par}% | |
268 | + \@endpart} | |
269 | +\def\@spart#1{% | |
270 | + {\centering | |
271 | + \interlinepenalty \@M | |
272 | + \normalfont | |
273 | + \Huge \bfseries #1\par}% | |
274 | + \@endpart} | |
275 | +\def\@endpart{\vfil\newpage | |
276 | + \if@twoside | |
277 | + \null | |
278 | + \thispagestyle{empty}% | |
279 | + \newpage | |
280 | + \fi | |
281 | + \if@tempswa | |
282 | + \twocolumn | |
283 | + \fi} | |
284 | + | |
285 | +\newcommand\chapter{\clearpage | |
286 | + \thispagestyle{empty}% | |
287 | + \global\@topnum\z@ | |
288 | + \@afterindentfalse | |
289 | + \secdef\@chapter\@schapter} | |
290 | +\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne | |
291 | + \if@mainmatter | |
292 | + \refstepcounter{chapter}% | |
293 | + \typeout{\@chapapp\space\thechapter.}% | |
294 | + \addcontentsline{toc}{chapter}% | |
295 | + {\protect\numberline{\thechapter}#1}% | |
296 | + \else | |
297 | + \addcontentsline{toc}{chapter}{#1}% | |
298 | + \fi | |
299 | + \else | |
300 | + \addcontentsline{toc}{chapter}{#1}% | |
301 | + \fi | |
302 | + \chaptermark{#1}% | |
303 | + \addtocontents{lof}{\protect\addvspace{10\p@}}% | |
304 | + \addtocontents{lot}{\protect\addvspace{10\p@}}% | |
305 | + \if@twocolumn | |
306 | + \@topnewpage[\@makechapterhead{#2}]% | |
307 | + \else | |
308 | + \@makechapterhead{#2}% | |
309 | + \@afterheading | |
310 | + \fi} | |
311 | +\def\@makechapterhead#1{% | |
312 | +% \vspace*{50\p@}% | |
313 | + {\centering | |
314 | + \ifnum \c@secnumdepth >\m@ne | |
315 | + \if@mainmatter | |
316 | + \large\bfseries \@chapapp{} \thechapter | |
317 | + \par\nobreak | |
318 | + \vskip 20\p@ | |
319 | + \fi | |
320 | + \fi | |
321 | + \interlinepenalty\@M | |
322 | + \Large \bfseries #1\par\nobreak | |
323 | + \vskip 40\p@ | |
324 | + }} | |
325 | +\def\@schapter#1{\if@twocolumn | |
326 | + \@topnewpage[\@makeschapterhead{#1}]% | |
327 | + \else | |
328 | + \@makeschapterhead{#1}% | |
329 | + \@afterheading | |
330 | + \fi} | |
331 | +\def\@makeschapterhead#1{% | |
332 | +% \vspace*{50\p@}% | |
333 | + {\centering | |
334 | + \normalfont | |
335 | + \interlinepenalty\@M | |
336 | + \Large \bfseries #1\par\nobreak | |
337 | + \vskip 40\p@ | |
338 | + }} | |
339 | + | |
340 | +\renewcommand\section{\@startsection{section}{1}{\z@}% | |
341 | + {-18\p@ \@plus -4\p@ \@minus -4\p@}% | |
342 | + {12\p@ \@plus 4\p@ \@minus 4\p@}% | |
343 | + {\normalfont\large\bfseries\boldmath | |
344 | + \rightskip=\z@ \@plus 8em\pretolerance=10000 }} | |
345 | +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% | |
346 | + {-18\p@ \@plus -4\p@ \@minus -4\p@}% | |
347 | + {8\p@ \@plus 4\p@ \@minus 4\p@}% | |
348 | + {\normalfont\normalsize\bfseries\boldmath | |
349 | + \rightskip=\z@ \@plus 8em\pretolerance=10000 }} | |
350 | +\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% | |
351 | + {-18\p@ \@plus -4\p@ \@minus -4\p@}% | |
352 | + {-0.5em \@plus -0.22em \@minus -0.1em}% | |
353 | + {\normalfont\normalsize\bfseries\boldmath}} | |
354 | +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% | |
355 | + {-12\p@ \@plus -4\p@ \@minus -4\p@}% | |
356 | + {-0.5em \@plus -0.22em \@minus -0.1em}% | |
357 | + {\normalfont\normalsize\itshape}} | |
358 | +\renewcommand\subparagraph[1]{\typeout{LLNCS warning: You should not use | |
359 | + \string\subparagraph\space with this class}\vskip0.5cm | |
360 | +You should not use \verb|\subparagraph| with this class.\vskip0.5cm} | |
361 | + | |
362 | +\DeclareMathSymbol{\Gamma}{\mathalpha}{letters}{"00} | |
363 | +\DeclareMathSymbol{\Delta}{\mathalpha}{letters}{"01} | |
364 | +\DeclareMathSymbol{\Theta}{\mathalpha}{letters}{"02} | |
365 | +\DeclareMathSymbol{\Lambda}{\mathalpha}{letters}{"03} | |
366 | +\DeclareMathSymbol{\Xi}{\mathalpha}{letters}{"04} | |
367 | +\DeclareMathSymbol{\Pi}{\mathalpha}{letters}{"05} | |
368 | +\DeclareMathSymbol{\Sigma}{\mathalpha}{letters}{"06} | |
369 | +\DeclareMathSymbol{\Upsilon}{\mathalpha}{letters}{"07} | |
370 | +\DeclareMathSymbol{\Phi}{\mathalpha}{letters}{"08} | |
371 | +\DeclareMathSymbol{\Psi}{\mathalpha}{letters}{"09} | |
372 | +\DeclareMathSymbol{\Omega}{\mathalpha}{letters}{"0A} | |
373 | + | |
374 | +\let\footnotesize\small | |
375 | + | |
376 | +\if@custvec | |
377 | +\def\vec#1{\mathchoice{\mbox{\boldmath$\displaystyle#1$}} | |
378 | +{\mbox{\boldmath$\textstyle#1$}} | |
379 | +{\mbox{\boldmath$\scriptstyle#1$}} | |
380 | +{\mbox{\boldmath$\scriptscriptstyle#1$}}} | |
381 | +\fi | |
382 | + | |
383 | +\def\squareforqed{\hbox{\rlap{$\sqcap$}$\sqcup$}} | |
384 | +\def\qed{\ifmmode\squareforqed\else{\unskip\nobreak\hfil | |
385 | +\penalty50\hskip1em\null\nobreak\hfil\squareforqed | |
386 | +\parfillskip=0pt\finalhyphendemerits=0\endgraf}\fi} | |
387 | + | |
388 | +\def\getsto{\mathrel{\mathchoice {\vcenter{\offinterlineskip | |
389 | +\halign{\hfil | |
390 | +$\displaystyle##$\hfil\cr\gets\cr\to\cr}}} | |
391 | +{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr\gets | |
392 | +\cr\to\cr}}} | |
393 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr\gets | |
394 | +\cr\to\cr}}} | |
395 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr | |
396 | +\gets\cr\to\cr}}}}} | |
397 | +\def\lid{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil | |
398 | +$\displaystyle##$\hfil\cr<\cr\noalign{\vskip1.2pt}=\cr}}} | |
399 | +{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr<\cr | |
400 | +\noalign{\vskip1.2pt}=\cr}}} | |
401 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr<\cr | |
402 | +\noalign{\vskip1pt}=\cr}}} | |
403 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr | |
404 | +<\cr | |
405 | +\noalign{\vskip0.9pt}=\cr}}}}} | |
406 | +\def\gid{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil | |
407 | +$\displaystyle##$\hfil\cr>\cr\noalign{\vskip1.2pt}=\cr}}} | |
408 | +{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr>\cr | |
409 | +\noalign{\vskip1.2pt}=\cr}}} | |
410 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr>\cr | |
411 | +\noalign{\vskip1pt}=\cr}}} | |
412 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr | |
413 | +>\cr | |
414 | +\noalign{\vskip0.9pt}=\cr}}}}} | |
415 | +\def\grole{\mathrel{\mathchoice {\vcenter{\offinterlineskip | |
416 | +\halign{\hfil | |
417 | +$\displaystyle##$\hfil\cr>\cr\noalign{\vskip-1pt}<\cr}}} | |
418 | +{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr | |
419 | +>\cr\noalign{\vskip-1pt}<\cr}}} | |
420 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr | |
421 | +>\cr\noalign{\vskip-0.8pt}<\cr}}} | |
422 | +{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr | |
423 | +>\cr\noalign{\vskip-0.3pt}<\cr}}}}} | |
424 | +\def\bbbr{{\rm I\!R}} %reelle Zahlen | |
425 | +\def\bbbm{{\rm I\!M}} | |
426 | +\def\bbbn{{\rm I\!N}} %natuerliche Zahlen | |
427 | +\def\bbbf{{\rm I\!F}} | |
428 | +\def\bbbh{{\rm I\!H}} | |
429 | +\def\bbbk{{\rm I\!K}} | |
430 | +\def\bbbp{{\rm I\!P}} | |
431 | +\def\bbbone{{\mathchoice {\rm 1\mskip-4mu l} {\rm 1\mskip-4mu l} | |
432 | +{\rm 1\mskip-4.5mu l} {\rm 1\mskip-5mu l}}} | |
433 | +\def\bbbc{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm C$}\hbox{\hbox | |
434 | +to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}} | |
435 | +{\setbox0=\hbox{$\textstyle\rm C$}\hbox{\hbox | |
436 | +to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}} | |
437 | +{\setbox0=\hbox{$\scriptstyle\rm C$}\hbox{\hbox | |
438 | +to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}} | |
439 | +{\setbox0=\hbox{$\scriptscriptstyle\rm C$}\hbox{\hbox | |
440 | +to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}}}} | |
441 | +\def\bbbq{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm | |
442 | +Q$}\hbox{\raise | |
443 | +0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.8\ht0\hss}\box0}} | |
444 | +{\setbox0=\hbox{$\textstyle\rm Q$}\hbox{\raise | |
445 | +0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.8\ht0\hss}\box0}} | |
446 | +{\setbox0=\hbox{$\scriptstyle\rm Q$}\hbox{\raise | |
447 | +0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.7\ht0\hss}\box0}} | |
448 | +{\setbox0=\hbox{$\scriptscriptstyle\rm Q$}\hbox{\raise | |
449 | +0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.7\ht0\hss}\box0}}}} | |
450 | +\def\bbbt{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm | |
451 | +T$}\hbox{\hbox to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}} | |
452 | +{\setbox0=\hbox{$\textstyle\rm T$}\hbox{\hbox | |
453 | +to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}} | |
454 | +{\setbox0=\hbox{$\scriptstyle\rm T$}\hbox{\hbox | |
455 | +to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}} | |
456 | +{\setbox0=\hbox{$\scriptscriptstyle\rm T$}\hbox{\hbox | |
457 | +to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}}}} | |
458 | +\def\bbbs{{\mathchoice | |
459 | +{\setbox0=\hbox{$\displaystyle \rm S$}\hbox{\raise0.5\ht0\hbox | |
460 | +to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\hbox | |
461 | +to0pt{\kern0.55\wd0\vrule height0.5\ht0\hss}\box0}} | |
462 | +{\setbox0=\hbox{$\textstyle \rm S$}\hbox{\raise0.5\ht0\hbox | |
463 | +to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\hbox | |
464 | +to0pt{\kern0.55\wd0\vrule height0.5\ht0\hss}\box0}} | |
465 | +{\setbox0=\hbox{$\scriptstyle \rm S$}\hbox{\raise0.5\ht0\hbox | |
466 | +to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\raise0.05\ht0\hbox | |
467 | +to0pt{\kern0.5\wd0\vrule height0.45\ht0\hss}\box0}} | |
468 | +{\setbox0=\hbox{$\scriptscriptstyle\rm S$}\hbox{\raise0.5\ht0\hbox | |
469 | +to0pt{\kern0.4\wd0\vrule height0.45\ht0\hss}\raise0.05\ht0\hbox | |
470 | +to0pt{\kern0.55\wd0\vrule height0.45\ht0\hss}\box0}}}} | |
471 | +\def\bbbz{{\mathchoice {\hbox{$\mathsf\textstyle Z\kern-0.4em Z$}} | |
472 | +{\hbox{$\mathsf\textstyle Z\kern-0.4em Z$}} | |
473 | +{\hbox{$\mathsf\scriptstyle Z\kern-0.3em Z$}} | |
474 | +{\hbox{$\mathsf\scriptscriptstyle Z\kern-0.2em Z$}}}} | |
475 | + | |
476 | +\let\ts\, | |
477 | + | |
478 | +\setlength\leftmargini {17\p@} | |
479 | +\setlength\leftmargin {\leftmargini} | |
480 | +\setlength\leftmarginii {\leftmargini} | |
481 | +\setlength\leftmarginiii {\leftmargini} | |
482 | +\setlength\leftmarginiv {\leftmargini} | |
483 | +\setlength \labelsep {.5em} | |
484 | +\setlength \labelwidth{\leftmargini} | |
485 | +\addtolength\labelwidth{-\labelsep} | |
486 | + | |
487 | +\def\@listI{\leftmargin\leftmargini | |
488 | + \parsep 0\p@ \@plus1\p@ \@minus\p@ | |
489 | + \topsep 8\p@ \@plus2\p@ \@minus4\p@ | |
490 | + \itemsep0\p@} | |
491 | +\let\@listi\@listI | |
492 | +\@listi | |
493 | +\def\@listii {\leftmargin\leftmarginii | |
494 | + \labelwidth\leftmarginii | |
495 | + \advance\labelwidth-\labelsep | |
496 | + \topsep 0\p@ \@plus2\p@ \@minus\p@} | |
497 | +\def\@listiii{\leftmargin\leftmarginiii | |
498 | + \labelwidth\leftmarginiii | |
499 | + \advance\labelwidth-\labelsep | |
500 | + \topsep 0\p@ \@plus\p@\@minus\p@ | |
501 | + \parsep \z@ | |
502 | + \partopsep \p@ \@plus\z@ \@minus\p@} | |
503 | + | |
504 | +\renewcommand\labelitemi{\normalfont\bfseries --} | |
505 | +\renewcommand\labelitemii{$\m@th\bullet$} | |
506 | + | |
507 | +\setlength\arraycolsep{1.4\p@} | |
508 | +\setlength\tabcolsep{1.4\p@} | |
509 | + | |
510 | +\def\tableofcontents{\chapter*{\contentsname\@mkboth{{\contentsname}}% | |
511 | + {{\contentsname}}} | |
512 | + \def\authcount##1{\setcounter{auco}{##1}\setcounter{@auth}{1}} | |
513 | + \def\lastand{\ifnum\value{auco}=2\relax | |
514 | + \unskip{} \andname\ | |
515 | + \else | |
516 | + \unskip \lastandname\ | |
517 | + \fi}% | |
518 | + \def\and{\stepcounter{@auth}\relax | |
519 | + \ifnum\value{@auth}=\value{auco}% | |
520 | + \lastand | |
521 | + \else | |
522 | + \unskip, | |
523 | + \fi}% | |
524 | + \@starttoc{toc}\if@restonecol\twocolumn\fi} | |
525 | + | |
526 | +\def\l@part#1#2{\addpenalty{\@secpenalty}% | |
527 | + \addvspace{2em plus\p@}% % space above part line | |
528 | + \begingroup | |
529 | + \parindent \z@ | |
530 | + \rightskip \z@ plus 5em | |
531 | + \hrule\vskip5pt | |
532 | + \large % same size as for a contribution heading | |
533 | + \bfseries\boldmath % set line in boldface | |
534 | + \leavevmode % TeX command to enter horizontal mode. | |
535 | + #1\par | |
536 | + \vskip5pt | |
537 | + \hrule | |
538 | + \vskip1pt | |
539 | + \nobreak % Never break after part entry | |
540 | + \endgroup} | |
541 | + | |
542 | +\def\@dotsep{2} | |
543 | + | |
544 | +\let\phantomsection=\relax | |
545 | + | |
546 | +\def\hyperhrefextend{\ifx\hyper@anchor\@undefined\else | |
547 | +{}\fi} | |
548 | + | |
549 | +\def\addnumcontentsmark#1#2#3{% | |
550 | +\addtocontents{#1}{\protect\contentsline{#2}{\protect\numberline | |
551 | + {\thechapter}#3}{\thepage}\hyperhrefextend}}% | |
552 | +\def\addcontentsmark#1#2#3{% | |
553 | +\addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}\hyperhrefextend}}% | |
554 | +\def\addcontentsmarkwop#1#2#3{% | |
555 | +\addtocontents{#1}{\protect\contentsline{#2}{#3}{0}\hyperhrefextend}}% | |
556 | + | |
557 | +\def\@adcmk[#1]{\ifcase #1 \or | |
558 | +\def\@gtempa{\addnumcontentsmark}% | |
559 | + \or \def\@gtempa{\addcontentsmark}% | |
560 | + \or \def\@gtempa{\addcontentsmarkwop}% | |
561 | + \fi\@gtempa{toc}{chapter}% | |
562 | +} | |
563 | +\def\addtocmark{% | |
564 | +\phantomsection | |
565 | +\@ifnextchar[{\@adcmk}{\@adcmk[3]}% | |
566 | +} | |
567 | + | |
568 | +\def\l@chapter#1#2{\addpenalty{-\@highpenalty} | |
569 | + \vskip 1.0em plus 1pt \@tempdima 1.5em \begingroup | |
570 | + \parindent \z@ \rightskip \@tocrmarg | |
571 | + \advance\rightskip by 0pt plus 2cm | |
572 | + \parfillskip -\rightskip \pretolerance=10000 | |
573 | + \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip | |
574 | + {\large\bfseries\boldmath#1}\ifx0#2\hfil\null | |
575 | + \else | |
576 | + \nobreak | |
577 | + \leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern | |
578 | + \@dotsep mu$}\hfill | |
579 | + \nobreak\hbox to\@pnumwidth{\hss #2}% | |
580 | + \fi\par | |
581 | + \penalty\@highpenalty \endgroup} | |
582 | + | |
583 | +\def\l@title#1#2{\addpenalty{-\@highpenalty} | |
584 | + \addvspace{8pt plus 1pt} | |
585 | + \@tempdima \z@ | |
586 | + \begingroup | |
587 | + \parindent \z@ \rightskip \@tocrmarg | |
588 | + \advance\rightskip by 0pt plus 2cm | |
589 | + \parfillskip -\rightskip \pretolerance=10000 | |
590 | + \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip | |
591 | + #1\nobreak | |
592 | + \leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern | |
593 | + \@dotsep mu$}\hfill | |
594 | + \nobreak\hbox to\@pnumwidth{\hss #2}\par | |
595 | + \penalty\@highpenalty \endgroup} | |
596 | + | |
597 | +\def\l@author#1#2{\addpenalty{\@highpenalty} | |
598 | + \@tempdima=15\p@ %\z@ | |
599 | + \begingroup | |
600 | + \parindent \z@ \rightskip \@tocrmarg | |
601 | + \advance\rightskip by 0pt plus 2cm | |
602 | + \pretolerance=10000 | |
603 | + \leavevmode \advance\leftskip\@tempdima %\hskip -\leftskip | |
604 | + \textit{#1}\par | |
605 | + \penalty\@highpenalty \endgroup} | |
606 | + | |
607 | +\setcounter{tocdepth}{0} | |
608 | +\newdimen\tocchpnum | |
609 | +\newdimen\tocsecnum | |
610 | +\newdimen\tocsectotal | |
611 | +\newdimen\tocsubsecnum | |
612 | +\newdimen\tocsubsectotal | |
613 | +\newdimen\tocsubsubsecnum | |
614 | +\newdimen\tocsubsubsectotal | |
615 | +\newdimen\tocparanum | |
616 | +\newdimen\tocparatotal | |
617 | +\newdimen\tocsubparanum | |
618 | +\tocchpnum=\z@ % no chapter numbers | |
619 | +\tocsecnum=15\p@ % section 88. plus 2.222pt | |
620 | +\tocsubsecnum=23\p@ % subsection 88.8 plus 2.222pt | |
621 | +\tocsubsubsecnum=27\p@ % subsubsection 88.8.8 plus 1.444pt | |
622 | +\tocparanum=35\p@ % paragraph 88.8.8.8 plus 1.666pt | |
623 | +\tocsubparanum=43\p@ % subparagraph 88.8.8.8.8 plus 1.888pt | |
624 | +\def\calctocindent{% | |
625 | +\tocsectotal=\tocchpnum | |
626 | +\advance\tocsectotal by\tocsecnum | |
627 | +\tocsubsectotal=\tocsectotal | |
628 | +\advance\tocsubsectotal by\tocsubsecnum | |
629 | +\tocsubsubsectotal=\tocsubsectotal | |
630 | +\advance\tocsubsubsectotal by\tocsubsubsecnum | |
631 | +\tocparatotal=\tocsubsubsectotal | |
632 | +\advance\tocparatotal by\tocparanum} | |
633 | +\calctocindent | |
634 | + | |
635 | +\def\l@section{\@dottedtocline{1}{\tocchpnum}{\tocsecnum}} | |
636 | +\def\l@subsection{\@dottedtocline{2}{\tocsectotal}{\tocsubsecnum}} | |
637 | +\def\l@subsubsection{\@dottedtocline{3}{\tocsubsectotal}{\tocsubsubsecnum}} | |
638 | +\def\l@paragraph{\@dottedtocline{4}{\tocsubsubsectotal}{\tocparanum}} | |
639 | +\def\l@subparagraph{\@dottedtocline{5}{\tocparatotal}{\tocsubparanum}} | |
640 | + | |
641 | +\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn | |
642 | + \fi\section*{\listfigurename\@mkboth{{\listfigurename}}{{\listfigurename}}} | |
643 | + \@starttoc{lof}\if@restonecol\twocolumn\fi} | |
644 | +\def\l@figure{\@dottedtocline{1}{0em}{1.5em}} | |
645 | + | |
646 | +\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn | |
647 | + \fi\section*{\listtablename\@mkboth{{\listtablename}}{{\listtablename}}} | |
648 | + \@starttoc{lot}\if@restonecol\twocolumn\fi} | |
649 | +\let\l@table\l@figure | |
650 | + | |
651 | +\renewcommand\listoffigures{% | |
652 | + \section*{\listfigurename | |
653 | + \@mkboth{\listfigurename}{\listfigurename}}% | |
654 | + \@starttoc{lof}% | |
655 | + } | |
656 | + | |
657 | +\renewcommand\listoftables{% | |
658 | + \section*{\listtablename | |
659 | + \@mkboth{\listtablename}{\listtablename}}% | |
660 | + \@starttoc{lot}% | |
661 | + } | |
662 | + | |
663 | +\ifx\oribibl\undefined | |
664 | +\ifx\citeauthoryear\undefined | |
665 | +\renewenvironment{thebibliography}[1] | |
666 | + {\section*{\refname} | |
667 | + \def\@biblabel##1{##1.} | |
668 | + \small | |
669 | + \list{\@biblabel{\@arabic\c@enumiv}}% | |
670 | + {\settowidth\labelwidth{\@biblabel{#1}}% | |
671 | + \leftmargin\labelwidth | |
672 | + \advance\leftmargin\labelsep | |
673 | + \if@openbib | |
674 | + \advance\leftmargin\bibindent | |
675 | + \itemindent -\bibindent | |
676 | + \listparindent \itemindent | |
677 | + \parsep \z@ | |
678 | + \fi | |
679 | + \usecounter{enumiv}% | |
680 | + \let\p@enumiv\@empty | |
681 | + \renewcommand\theenumiv{\@arabic\c@enumiv}}% | |
682 | + \if@openbib | |
683 | + \renewcommand\newblock{\par}% | |
684 | + \else | |
685 | + \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}% | |
686 | + \fi | |
687 | + \sloppy\clubpenalty4000\widowpenalty4000% | |
688 | + \sfcode`\.=\@m} | |
689 | + {\def\@noitemerr | |
690 | + {\@latex@warning{Empty `thebibliography' environment}}% | |
691 | + \endlist} | |
692 | +\def\@lbibitem[#1]#2{\item[{[#1]}\hfill]\if@filesw | |
693 | + {\let\protect\noexpand\immediate | |
694 | + \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces} | |
695 | +\newcount\@tempcntc | |
696 | +\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi | |
697 | + \@tempcnta\z@\@tempcntb\m@ne\def\@citea{}\@cite{\@for\@citeb:=#2\do | |
698 | + {\@ifundefined | |
699 | + {b@\@citeb}{\@citeo\@tempcntb\m@ne\@citea\def\@citea{,}{\bfseries | |
700 | + ?}\@warning | |
701 | + {Citation `\@citeb' on page \thepage \space undefined}}% | |
702 | + {\setbox\z@\hbox{\global\@tempcntc0\csname b@\@citeb\endcsname\relax}% | |
703 | + \ifnum\@tempcntc=\z@ \@citeo\@tempcntb\m@ne | |
704 | + \@citea\def\@citea{,}\hbox{\csname b@\@citeb\endcsname}% | |
705 | + \else | |
706 | + \advance\@tempcntb\@ne | |
707 | + \ifnum\@tempcntb=\@tempcntc | |
708 | + \else\advance\@tempcntb\m@ne\@citeo | |
709 | + \@tempcnta\@tempcntc\@tempcntb\@tempcntc\fi\fi}}\@citeo}{#1}} | |
710 | +\def\@citeo{\ifnum\@tempcnta>\@tempcntb\else | |
711 | + \@citea\def\@citea{,\,\hskip\z@skip}% | |
712 | + \ifnum\@tempcnta=\@tempcntb\the\@tempcnta\else | |
713 | + {\advance\@tempcnta\@ne\ifnum\@tempcnta=\@tempcntb \else | |
714 | + \def\@citea{--}\fi | |
715 | + \advance\@tempcnta\m@ne\the\@tempcnta\@citea\the\@tempcntb}\fi\fi} | |
716 | +\else | |
717 | +\renewenvironment{thebibliography}[1] | |
718 | + {\section*{\refname} | |
719 | + \small | |
720 | + \list{}% | |
721 | + {\settowidth\labelwidth{}% | |
722 | + \leftmargin\parindent | |
723 | + \itemindent=-\parindent | |
724 | + \labelsep=\z@ | |
725 | + \if@openbib | |
726 | + \advance\leftmargin\bibindent | |
727 | + \itemindent -\bibindent | |
728 | + \listparindent \itemindent | |
729 | + \parsep \z@ | |
730 | + \fi | |
731 | + \usecounter{enumiv}% | |
732 | + \let\p@enumiv\@empty | |
733 | + \renewcommand\theenumiv{}}% | |
734 | + \if@openbib | |
735 | + \renewcommand\newblock{\par}% | |
736 | + \else | |
737 | + \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}% | |
738 | + \fi | |
739 | + \sloppy\clubpenalty4000\widowpenalty4000% | |
740 | + \sfcode`\.=\@m} | |
741 | + {\def\@noitemerr | |
742 | + {\@latex@warning{Empty `thebibliography' environment}}% | |
743 | + \endlist} | |
744 | + \def\@cite#1{#1}% | |
745 | + \def\@lbibitem[#1]#2{\item[]\if@filesw | |
746 | + {\def\protect##1{\string ##1\space}\immediate | |
747 | + \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces} | |
748 | + \fi | |
749 | +\else | |
750 | +\@cons\@openbib@code{\noexpand\small} | |
751 | +\fi | |
752 | + | |
753 | +\def\idxquad{\hskip 10\p@}% space that divides entry from number | |
754 | + | |
755 | +\def\@idxitem{\par\hangindent 10\p@} | |
756 | + | |
757 | +\def\subitem{\par\setbox0=\hbox{--\enspace}% second order | |
758 | + \noindent\hangindent\wd0\box0}% index entry | |
759 | + | |
760 | +\def\subsubitem{\par\setbox0=\hbox{--\,--\enspace}% third | |
761 | + \noindent\hangindent\wd0\box0}% order index entry | |
762 | + | |
763 | +\def\indexspace{\par \vskip 10\p@ plus5\p@ minus3\p@\relax} | |
764 | + | |
765 | +\renewenvironment{theindex} | |
766 | + {\@mkboth{\indexname}{\indexname}% | |
767 | + \thispagestyle{empty}\parindent\z@ | |
768 | + \parskip\z@ \@plus .3\p@\relax | |
769 | + \let\item\par | |
770 | + \def\,{\relax\ifmmode\mskip\thinmuskip | |
771 | + \else\hskip0.2em\ignorespaces\fi}% | |
772 | + \normalfont\small | |
773 | + \begin{multicols}{2}[\@makeschapterhead{\indexname}]% | |
774 | + } | |
775 | + {\end{multicols}} | |
776 | + | |
777 | +\renewcommand\footnoterule{% | |
778 | + \kern-3\p@ | |
779 | + \hrule\@width 2truecm | |
780 | + \kern2.6\p@} | |
781 | + \newdimen\fnindent | |
782 | + \fnindent1em | |
783 | +\long\def\@makefntext#1{% | |
784 | + \parindent \fnindent% | |
785 | + \leftskip \fnindent% | |
786 | + \noindent | |
787 | + \llap{\hb@xt@1em{\hss\@makefnmark\ }}\ignorespaces#1} | |
788 | + | |
789 | +\long\def\@makecaption#1#2{% | |
790 | + \small | |
791 | + \vskip\abovecaptionskip | |
792 | + \sbox\@tempboxa{{\bfseries #1.} #2}% | |
793 | + \ifdim \wd\@tempboxa >\hsize | |
794 | + {\bfseries #1.} #2\par | |
795 | + \else | |
796 | + \global \@minipagefalse | |
797 | + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% | |
798 | + \fi | |
799 | + \vskip\belowcaptionskip} | |
800 | + | |
801 | +\def\fps@figure{htbp} | |
802 | +\def\fnum@figure{\figurename\thinspace\thefigure} | |
803 | +\def \@floatboxreset {% | |
804 | + \reset@font | |
805 | + \small | |
806 | + \@setnobreak | |
807 | + \@setminipage | |
808 | +} | |
809 | +\def\fps@table{htbp} | |
810 | +\def\fnum@table{\tablename~\thetable} | |
811 | +\renewenvironment{table} | |
812 | + {\setlength\abovecaptionskip{0\p@}% | |
813 | + \setlength\belowcaptionskip{10\p@}% | |
814 | + \@float{table}} | |
815 | + {\end@float} | |
816 | +\renewenvironment{table*} | |
817 | + {\setlength\abovecaptionskip{0\p@}% | |
818 | + \setlength\belowcaptionskip{10\p@}% | |
819 | + \@dblfloat{table}} | |
820 | + {\end@dblfloat} | |
821 | + | |
822 | +\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname | |
823 | + ext@#1\endcsname}{#1}{\protect\numberline{\csname | |
824 | + the#1\endcsname}{\ignorespaces #2}}\begingroup | |
825 | + \@parboxrestore | |
826 | + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par | |
827 | + \endgroup} | |
828 | + | |
829 | +% LaTeX does not provide a command to enter the authors institute | |
830 | +% addresses. The \institute command is defined here. | |
831 | + | |
832 | +\newcounter{@inst} | |
833 | +\newcounter{@auth} | |
834 | +\newcounter{auco} | |
835 | +\newdimen\instindent | |
836 | +\newbox\authrun | |
837 | +\newtoks\authorrunning | |
838 | +\newtoks\tocauthor | |
839 | +\newbox\titrun | |
840 | +\newtoks\titlerunning | |
841 | +\newtoks\toctitle | |
842 | + | |
843 | +\def\clearheadinfo{\gdef\@author{No Author Given}% | |
844 | + \gdef\@title{No Title Given}% | |
845 | + \gdef\@subtitle{}% | |
846 | + \gdef\@institute{No Institute Given}% | |
847 | + \gdef\@thanks{}% | |
848 | + \global\titlerunning={}\global\authorrunning={}% | |
849 | + \global\toctitle={}\global\tocauthor={}} | |
850 | + | |
851 | +\def\institute#1{\gdef\@institute{#1}} | |
852 | + | |
853 | +\def\institutename{\par | |
854 | + \begingroup | |
855 | + \parskip=\z@ | |
856 | + \parindent=\z@ | |
857 | + \setcounter{@inst}{1}% | |
858 | + \def\and{\par\stepcounter{@inst}% | |
859 | + \noindent$^{\the@inst}$\enspace\ignorespaces}% | |
860 | + \setbox0=\vbox{\def\thanks##1{}\@institute}% | |
861 | + \ifnum\c@@inst=1\relax | |
862 | + \gdef\fnnstart{0}% | |
863 | + \else | |
864 | + \xdef\fnnstart{\c@@inst}% | |
865 | + \setcounter{@inst}{1}% | |
866 | + \noindent$^{\the@inst}$\enspace | |
867 | + \fi | |
868 | + \ignorespaces | |
869 | + \@institute\par | |
870 | + \endgroup} | |
871 | + | |
872 | +\def\@fnsymbol#1{\ensuremath{\ifcase#1\or\star\or{\star\star}\or | |
873 | + {\star\star\star}\or \dagger\or \ddagger\or | |
874 | + \mathchar "278\or \mathchar "27B\or \|\or **\or \dagger\dagger | |
875 | + \or \ddagger\ddagger \else\@ctrerr\fi}} | |
876 | + | |
877 | +\def\inst#1{\unskip$^{#1}$} | |
878 | +\def\fnmsep{\unskip$^,$} | |
879 | +\def\email#1{{\tt#1}} | |
880 | +\AtBeginDocument{\@ifundefined{url}{\def\url#1{#1}}{}% | |
881 | +\@ifpackageloaded{babel}{% | |
882 | +\@ifundefined{extrasenglish}{}{\addto\extrasenglish{\switcht@albion}}% | |
883 | +\@ifundefined{extrasfrenchb}{}{\addto\extrasfrenchb{\switcht@francais}}% | |
884 | +\@ifundefined{extrasgerman}{}{\addto\extrasgerman{\switcht@deutsch}}% | |
885 | +}{\switcht@@therlang}% | |
886 | +\providecommand{\keywords}[1]{\par\addvspace\baselineskip | |
887 | +\noindent\keywordname\enspace\ignorespaces#1}% | |
888 | +} | |
889 | +\def\homedir{\~{ }} | |
890 | + | |
891 | +\def\subtitle#1{\gdef\@subtitle{#1}} | |
892 | +\clearheadinfo | |
893 | +% | |
894 | +%%% to avoid hyperref warnings | |
895 | +\providecommand*{\toclevel@author}{999} | |
896 | +%%% to make title-entry parent of section-entries | |
897 | +\providecommand*{\toclevel@title}{0} | |
898 | +% | |
899 | +\renewcommand\maketitle{\newpage | |
900 | +\phantomsection | |
901 | + \refstepcounter{chapter}% | |
902 | + \stepcounter{section}% | |
903 | + \setcounter{section}{0}% | |
904 | + \setcounter{subsection}{0}% | |
905 | + \setcounter{figure}{0} | |
906 | + \setcounter{table}{0} | |
907 | + \setcounter{equation}{0} | |
908 | + \setcounter{footnote}{0}% | |
909 | + \begingroup | |
910 | + \parindent=\z@ | |
911 | + \renewcommand\thefootnote{\@fnsymbol\c@footnote}% | |
912 | + \if@twocolumn | |
913 | + \ifnum \col@number=\@ne | |
914 | + \@maketitle | |
915 | + \else | |
916 | + \twocolumn[\@maketitle]% | |
917 | + \fi | |
918 | + \else | |
919 | + \newpage | |
920 | + \global\@topnum\z@ % Prevents figures from going at top of page. | |
921 | + \@maketitle | |
922 | + \fi | |
923 | + \thispagestyle{empty}\@thanks | |
924 | +% | |
925 | + \def\\{\unskip\ \ignorespaces}\def\inst##1{\unskip{}}% | |
926 | + \def\thanks##1{\unskip{}}\def\fnmsep{\unskip}% | |
927 | + \instindent=\hsize | |
928 | + \advance\instindent by-\headlineindent | |
929 | + \if!\the\toctitle!\addcontentsline{toc}{title}{\@title}\else | |
930 | + \addcontentsline{toc}{title}{\the\toctitle}\fi | |
931 | + \if@runhead | |
932 | + \if!\the\titlerunning!\else | |
933 | + \edef\@title{\the\titlerunning}% | |
934 | + \fi | |
935 | + \global\setbox\titrun=\hbox{\small\rm\unboldmath\ignorespaces\@title}% | |
936 | + \ifdim\wd\titrun>\instindent | |
937 | + \typeout{Title too long for running head. Please supply}% | |
938 | + \typeout{a shorter form with \string\titlerunning\space prior to | |
939 | + \string\maketitle}% | |
940 | + \global\setbox\titrun=\hbox{\small\rm | |
941 | + Title Suppressed Due to Excessive Length}% | |
942 | + \fi | |
943 | + \xdef\@title{\copy\titrun}% | |
944 | + \fi | |
945 | +% | |
946 | + \if!\the\tocauthor!\relax | |
947 | + {\def\and{\noexpand\protect\noexpand\and}% | |
948 | + \protected@xdef\toc@uthor{\@author}}% | |
949 | + \else | |
950 | + \def\\{\noexpand\protect\noexpand\newline}% | |
951 | + \protected@xdef\scratch{\the\tocauthor}% | |
952 | + \protected@xdef\toc@uthor{\scratch}% | |
953 | + \fi | |
954 | + \addtocontents{toc}{\noexpand\protect\noexpand\authcount{\the\c@auco}}% | |
955 | + \addcontentsline{toc}{author}{\toc@uthor}% | |
956 | + \if@runhead | |
957 | + \if!\the\authorrunning! | |
958 | + \value{@inst}=\value{@auth}% | |
959 | + \setcounter{@auth}{1}% | |
960 | + \else | |
961 | + \edef\@author{\the\authorrunning}% | |
962 | + \fi | |
963 | + \global\setbox\authrun=\hbox{\small\unboldmath\@author\unskip}% | |
964 | + \ifdim\wd\authrun>\instindent | |
965 | + \typeout{Names of authors too long for running head. Please supply}% | |
966 | + \typeout{a shorter form with \string\authorrunning\space prior to | |
967 | + \string\maketitle}% | |
968 | + \global\setbox\authrun=\hbox{\small\rm | |
969 | + Authors Suppressed Due to Excessive Length}% | |
970 | + \fi | |
971 | + \xdef\@author{\copy\authrun}% | |
972 | + \markboth{\@author}{\@title}% | |
973 | + \fi | |
974 | + \endgroup | |
975 | + \setcounter{footnote}{\fnnstart}% | |
976 | + \clearheadinfo} | |
977 | +% | |
978 | +\def\@maketitle{\newpage | |
979 | + \markboth{}{}% | |
980 | + \def\lastand{\ifnum\value{@inst}=2\relax | |
981 | + \unskip{} \andname\ | |
982 | + \else | |
983 | + \unskip \lastandname\ | |
984 | + \fi}% | |
985 | + \def\and{\stepcounter{@auth}\relax | |
986 | + \ifnum\value{@auth}=\value{@inst}% | |
987 | + \lastand | |
988 | + \else | |
989 | + \unskip, | |
990 | + \fi}% | |
991 | + \begin{center}% | |
992 | + \let\newline\\ | |
993 | + {\Large \bfseries\boldmath | |
994 | + \pretolerance=10000 | |
995 | + \@title \par}\vskip .8cm | |
996 | +\if!\@subtitle!\else {\large \bfseries\boldmath | |
997 | + \vskip -.65cm | |
998 | + \pretolerance=10000 | |
999 | + \@subtitle \par}\vskip .8cm\fi | |
1000 | + \setbox0=\vbox{\setcounter{@auth}{1}\def\and{\stepcounter{@auth}}% | |
1001 | + \def\thanks##1{}\@author}% | |
1002 | + \global\value{@inst}=\value{@auth}% | |
1003 | + \global\value{auco}=\value{@auth}% | |
1004 | + \setcounter{@auth}{1}% | |
1005 | +{\lineskip .5em | |
1006 | +\noindent\ignorespaces | |
1007 | +\@author\vskip.35cm} | |
1008 | + {\small\institutename} | |
1009 | + \end{center}% | |
1010 | + } | |
1011 | + | |
1012 | +% definition of the "\spnewtheorem" command. | |
1013 | +% | |
1014 | +% Usage: | |
1015 | +% | |
1016 | +% \spnewtheorem{env_nam}{caption}[within]{cap_font}{body_font} | |
1017 | +% or \spnewtheorem{env_nam}[numbered_like]{caption}{cap_font}{body_font} | |
1018 | +% or \spnewtheorem*{env_nam}{caption}{cap_font}{body_font} | |
1019 | +% | |
1020 | +% New is "cap_font" and "body_font". It stands for | |
1021 | +% fontdefinition of the caption and the text itself. | |
1022 | +% | |
1023 | +% "\spnewtheorem*" gives a theorem without number. | |
1024 | +% | |
1025 | +% A defined spnewthoerem environment is used as described | |
1026 | +% by Lamport. | |
1027 | +% | |
1028 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1029 | + | |
1030 | +\def\@thmcountersep{} | |
1031 | +\def\@thmcounterend{.} | |
1032 | + | |
1033 | +\def\spnewtheorem{\@ifstar{\@sthm}{\@Sthm}} | |
1034 | + | |
1035 | +% definition of \spnewtheorem with number | |
1036 | + | |
1037 | +\def\@spnthm#1#2{% | |
1038 | + \@ifnextchar[{\@spxnthm{#1}{#2}}{\@spynthm{#1}{#2}}} | |
1039 | +\def\@Sthm#1{\@ifnextchar[{\@spothm{#1}}{\@spnthm{#1}}} | |
1040 | + | |
1041 | +\def\@spxnthm#1#2[#3]#4#5{\expandafter\@ifdefinable\csname #1\endcsname | |
1042 | + {\@definecounter{#1}\@addtoreset{#1}{#3}% | |
1043 | + \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand | |
1044 | + \csname the#3\endcsname \noexpand\@thmcountersep \@thmcounter{#1}}% | |
1045 | + \expandafter\xdef\csname #1name\endcsname{#2}% | |
1046 | + \global\@namedef{#1}{\@spthm{#1}{\csname #1name\endcsname}{#4}{#5}}% | |
1047 | + \global\@namedef{end#1}{\@endtheorem}}} | |
1048 | + | |
1049 | +\def\@spynthm#1#2#3#4{\expandafter\@ifdefinable\csname #1\endcsname | |
1050 | + {\@definecounter{#1}% | |
1051 | + \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}% | |
1052 | + \expandafter\xdef\csname #1name\endcsname{#2}% | |
1053 | + \global\@namedef{#1}{\@spthm{#1}{\csname #1name\endcsname}{#3}{#4}}% | |
1054 | + \global\@namedef{end#1}{\@endtheorem}}} | |
1055 | + | |
1056 | +\def\@spothm#1[#2]#3#4#5{% | |
1057 | + \@ifundefined{c@#2}{\@latexerr{No theorem environment `#2' defined}\@eha}% | |
1058 | + {\expandafter\@ifdefinable\csname #1\endcsname | |
1059 | + {\newaliascnt{#1}{#2}% | |
1060 | + \expandafter\xdef\csname #1name\endcsname{#3}% | |
1061 | + \global\@namedef{#1}{\@spthm{#1}{\csname #1name\endcsname}{#4}{#5}}% | |
1062 | + \global\@namedef{end#1}{\@endtheorem}}}} | |
1063 | + | |
1064 | +\def\@spthm#1#2#3#4{\topsep 7\p@ \@plus2\p@ \@minus4\p@ | |
1065 | +\refstepcounter{#1}% | |
1066 | +\@ifnextchar[{\@spythm{#1}{#2}{#3}{#4}}{\@spxthm{#1}{#2}{#3}{#4}}} | |
1067 | + | |
1068 | +\def\@spxthm#1#2#3#4{\@spbegintheorem{#2}{\csname the#1\endcsname}{#3}{#4}% | |
1069 | + \ignorespaces} | |
1070 | + | |
1071 | +\def\@spythm#1#2#3#4[#5]{\@spopargbegintheorem{#2}{\csname | |
1072 | + the#1\endcsname}{#5}{#3}{#4}\ignorespaces} | |
1073 | + | |
1074 | +\def\@spbegintheorem#1#2#3#4{\trivlist | |
1075 | + \item[\hskip\labelsep{#3#1\ #2\@thmcounterend}]#4} | |
1076 | + | |
1077 | +\def\@spopargbegintheorem#1#2#3#4#5{\trivlist | |
1078 | + \item[\hskip\labelsep{#4#1\ #2}]{#4(#3)\@thmcounterend\ }#5} | |
1079 | + | |
1080 | +% definition of \spnewtheorem* without number | |
1081 | + | |
1082 | +\def\@sthm#1#2{\@Ynthm{#1}{#2}} | |
1083 | + | |
1084 | +\def\@Ynthm#1#2#3#4{\expandafter\@ifdefinable\csname #1\endcsname | |
1085 | + {\global\@namedef{#1}{\@Thm{\csname #1name\endcsname}{#3}{#4}}% | |
1086 | + \expandafter\xdef\csname #1name\endcsname{#2}% | |
1087 | + \global\@namedef{end#1}{\@endtheorem}}} | |
1088 | + | |
1089 | +\def\@Thm#1#2#3{\topsep 7\p@ \@plus2\p@ \@minus4\p@ | |
1090 | +\@ifnextchar[{\@Ythm{#1}{#2}{#3}}{\@Xthm{#1}{#2}{#3}}} | |
1091 | + | |
1092 | +\def\@Xthm#1#2#3{\@Begintheorem{#1}{#2}{#3}\ignorespaces} | |
1093 | + | |
1094 | +\def\@Ythm#1#2#3[#4]{\@Opargbegintheorem{#1} | |
1095 | + {#4}{#2}{#3}\ignorespaces} | |
1096 | + | |
1097 | +\def\@Begintheorem#1#2#3{#3\trivlist | |
1098 | + \item[\hskip\labelsep{#2#1\@thmcounterend}]} | |
1099 | + | |
1100 | +\def\@Opargbegintheorem#1#2#3#4{#4\trivlist | |
1101 | + \item[\hskip\labelsep{#3#1}]{#3(#2)\@thmcounterend\ }} | |
1102 | + | |
1103 | +\if@envcntsect | |
1104 | + \def\@thmcountersep{.} | |
1105 | + \spnewtheorem{theorem}{Theorem}[section]{\bfseries}{\itshape} | |
1106 | +\else | |
1107 | + \spnewtheorem{theorem}{Theorem}{\bfseries}{\itshape} | |
1108 | + \if@envcntreset | |
1109 | + \@addtoreset{theorem}{section} | |
1110 | + \else | |
1111 | + \@addtoreset{theorem}{chapter} | |
1112 | + \fi | |
1113 | +\fi | |
1114 | + | |
1115 | +%definition of divers theorem environments | |
1116 | +\spnewtheorem*{claim}{Claim}{\itshape}{\rmfamily} | |
1117 | +\spnewtheorem*{proof}{Proof}{\itshape}{\rmfamily} | |
1118 | +\if@envcntsame % alle Umgebungen wie Theorem. | |
1119 | + \def\spn@wtheorem#1#2#3#4{\@spothm{#1}[theorem]{#2}{#3}{#4}} | |
1120 | +\else % alle Umgebungen mit eigenem Zaehler | |
1121 | + \if@envcntsect % mit section numeriert | |
1122 | + \def\spn@wtheorem#1#2#3#4{\@spxnthm{#1}{#2}[section]{#3}{#4}} | |
1123 | + \else % nicht mit section numeriert | |
1124 | + \if@envcntreset | |
1125 | + \def\spn@wtheorem#1#2#3#4{\@spynthm{#1}{#2}{#3}{#4} | |
1126 | + \@addtoreset{#1}{section}} | |
1127 | + \else | |
1128 | + \def\spn@wtheorem#1#2#3#4{\@spynthm{#1}{#2}{#3}{#4} | |
1129 | + \@addtoreset{#1}{chapter}}% | |
1130 | + \fi | |
1131 | + \fi | |
1132 | +\fi | |
1133 | +\spn@wtheorem{case}{Case}{\itshape}{\rmfamily} | |
1134 | +\spn@wtheorem{conjecture}{Conjecture}{\itshape}{\rmfamily} | |
1135 | +\spn@wtheorem{corollary}{Corollary}{\bfseries}{\itshape} | |
1136 | +\spn@wtheorem{definition}{Definition}{\bfseries}{\itshape} | |
1137 | +\spn@wtheorem{example}{Example}{\itshape}{\rmfamily} | |
1138 | +\spn@wtheorem{exercise}{Exercise}{\itshape}{\rmfamily} | |
1139 | +\spn@wtheorem{lemma}{Lemma}{\bfseries}{\itshape} | |
1140 | +\spn@wtheorem{note}{Note}{\itshape}{\rmfamily} | |
1141 | +\spn@wtheorem{problem}{Problem}{\itshape}{\rmfamily} | |
1142 | +\spn@wtheorem{property}{Property}{\itshape}{\rmfamily} | |
1143 | +\spn@wtheorem{proposition}{Proposition}{\bfseries}{\itshape} | |
1144 | +\spn@wtheorem{question}{Question}{\itshape}{\rmfamily} | |
1145 | +\spn@wtheorem{solution}{Solution}{\itshape}{\rmfamily} | |
1146 | +\spn@wtheorem{remark}{Remark}{\itshape}{\rmfamily} | |
1147 | + | |
1148 | +\def\@takefromreset#1#2{% | |
1149 | + \def\@tempa{#1}% | |
1150 | + \let\@tempd\@elt | |
1151 | + \def\@elt##1{% | |
1152 | + \def\@tempb{##1}% | |
1153 | + \ifx\@tempa\@tempb\else | |
1154 | + \@addtoreset{##1}{#2}% | |
1155 | + \fi}% | |
1156 | + \expandafter\expandafter\let\expandafter\@tempc\csname cl@#2\endcsname | |
1157 | + \expandafter\def\csname cl@#2\endcsname{}% | |
1158 | + \@tempc | |
1159 | + \let\@elt\@tempd} | |
1160 | + | |
1161 | +\def\theopargself{\def\@spopargbegintheorem##1##2##3##4##5{\trivlist | |
1162 | + \item[\hskip\labelsep{##4##1\ ##2}]{##4##3\@thmcounterend\ }##5} | |
1163 | + \def\@Opargbegintheorem##1##2##3##4{##4\trivlist | |
1164 | + \item[\hskip\labelsep{##3##1}]{##3##2\@thmcounterend\ }} | |
1165 | + } | |
1166 | + | |
1167 | +\renewenvironment{abstract}{% | |
1168 | + \list{}{\advance\topsep by0.35cm\relax\small | |
1169 | + \leftmargin=1cm | |
1170 | + \labelwidth=\z@ | |
1171 | + \listparindent=\z@ | |
1172 | + \itemindent\listparindent | |
1173 | + \rightmargin\leftmargin}\item[\hskip\labelsep | |
1174 | + \bfseries\abstractname]} | |
1175 | + {\endlist} | |
1176 | + | |
1177 | +\newdimen\headlineindent % dimension for space between | |
1178 | +\headlineindent=1.166cm % number and text of headings. | |
1179 | + | |
1180 | +\def\ps@headings{\let\@mkboth\@gobbletwo | |
1181 | + \let\@oddfoot\@empty\let\@evenfoot\@empty | |
1182 | + \def\@evenhead{\normalfont\small\rlap{\thepage}\hspace{\headlineindent}% | |
1183 | + \leftmark\hfil} | |
1184 | + \def\@oddhead{\normalfont\small\hfil\rightmark\hspace{\headlineindent}% | |
1185 | + \llap{\thepage}} | |
1186 | + \def\chaptermark##1{}% | |
1187 | + \def\sectionmark##1{}% | |
1188 | + \def\subsectionmark##1{}} | |
1189 | + | |
1190 | +\def\ps@titlepage{\let\@mkboth\@gobbletwo | |
1191 | + \let\@oddfoot\@empty\let\@evenfoot\@empty | |
1192 | + \def\@evenhead{\normalfont\small\rlap{\thepage}\hspace{\headlineindent}% | |
1193 | + \hfil} | |
1194 | + \def\@oddhead{\normalfont\small\hfil\hspace{\headlineindent}% | |
1195 | + \llap{\thepage}} | |
1196 | + \def\chaptermark##1{}% | |
1197 | + \def\sectionmark##1{}% | |
1198 | + \def\subsectionmark##1{}} | |
1199 | + | |
1200 | +\if@runhead\ps@headings\else | |
1201 | +\ps@empty\fi | |
1202 | + | |
1203 | +\setlength\arraycolsep{1.4\p@} | |
1204 | +\setlength\tabcolsep{1.4\p@} | |
1205 | + | |
1206 | +\endinput | |
1207 | +%end of file llncs.cls | |
... | ... |
doc/manual.pdf
0 → 100644
No preview for this file type
doc/manual.tex
0 → 100644
1 | +++ a/doc/manual.tex | |
1 | +\documentclass[runningheads,a4paper]{llncs} | |
2 | + | |
3 | +\setcounter{tocdepth}{3} | |
4 | +\usepackage[OT4]{fontenc} | |
5 | +\usepackage{graphicx} | |
6 | +\usepackage[utf8]{inputenc} | |
7 | +%\usepackage[polish]{babel} | |
8 | + | |
9 | +\usepackage{url} | |
10 | + | |
11 | +\newcommand{\comment}[2]{\noindent{\textbf{\sffamily(\marginpar{\sffamily\footnotesize #1}#2)}}} | |
12 | +\newcommand{\kg}[1]{\comment{KG}{#1}} | |
13 | + | |
14 | + | |
15 | +\setlength{\parindent}{0pt} | |
16 | +\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex} | |
17 | + | |
18 | +\begin{document} | |
19 | + | |
20 | +\mainmatter | |
21 | + | |
22 | +\title{Scoreference Manual} | |
23 | +\subtitle{\today} | |
24 | + | |
25 | +\author{Mateusz Kopeć} | |
26 | + | |
27 | +\institute{Institute of Computer Science, Polish Academy of Sciences \\ \url{m.kopec@ipipan.waw.pl}} | |
28 | + | |
29 | +\maketitle | |
30 | + | |
31 | + | |
32 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
33 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
34 | +\section*{About} | |
35 | + | |
36 | +The current version of the program facilitates the automatic evaluation of mention detection and coreference resolution, given an automatically and manually annotated corpus. Mention detection is evaluated by precision and recall. Coreference resolution is scored by 5 metrics: MUC, B$^3$, CEAFE, CEAFM, BLANC. Details about the scores calculation are in section \ref{details}. | |
37 | + | |
38 | +\textbf{Homepage:} \url{http://zil.ipipan.waw.pl/MentionDetector} \\ | |
39 | +\textbf{Contact person:} Mateusz Kopeć [mateusz.kopec@ipipan.waw.pl] \\ | |
40 | +\textbf{Author:} Mateusz Kopeć \\ | |
41 | +\textbf{License:} CC BY v.3 | |
42 | + | |
43 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
44 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
45 | + | |
46 | +\section{Requirements} | |
47 | +Java Runtime Environment (JRE) 1.7 or newer. | |
48 | + | |
49 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
50 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
51 | + | |
52 | +\section{Input data format} | |
53 | + | |
54 | +Gold and system texts must be stored in the same format, either TEI or MMAX. Details about TEI or MMAX format used may be found in the Polish Coreference Corpus description\footnote{Available at \url{http://zil.ipipan.waw.pl/PolishCoreferenceCorpus}}. | |
55 | + | |
56 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
57 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
58 | + | |
59 | +\section{Output data format} | |
60 | + | |
61 | +Results are printed to standard output. | |
62 | + | |
63 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
64 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
65 | + | |
66 | +\section{Usage} | |
67 | + | |
68 | +Standalone jar doesn't need any installation. To run it, simply execute:\\ | |
69 | + | |
70 | +\texttt{java -jar scoreference-1.0-SNAPSHOT.one-jar.jar <dir with gold texts> <dir for system texts> <type>}\\ | |
71 | + | |
72 | +\texttt{<dir with system texts>} is the directory with the corpus annotated automatically with coreference, \texttt{<dir with gold texts>} is the gold standard version of the same data. \texttt{<type>} should be either ``mmax'' or ``tei'', which indicates in what format the corpora are stored. | |
73 | + | |
74 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
75 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
76 | + | |
77 | +\section{Score details}\label{details} | |
78 | + | |
79 | +Scoring performed by \emph{Scoreference} is mostly in line with the SemEval \cite{Marquez2012} approach: we have chosen to evaluate separately mention detection and coreference resolution, but also allow for end-to-end system evaluation. | |
80 | + | |
81 | +\subsection{Mention detection measures} | |
82 | +We evaluate mention detection using precision, recall and F-measure. | |
83 | +Different than during SemEval, we have decided not to reward partial matches, but to present instead two alternative mention detection scores: | |
84 | +\begin{itemize} | |
85 | + \item score of exact boundary matches (there is a match when automatic and manual mention have exactly the same boundaries) (EXACT), | |
86 | + \item score of head matches (we reduce system and manual mentions to their single head tokens and compare them) (HEAD). | |
87 | +\end{itemize} | |
88 | + | |
89 | +\subsection{Coreference resolution measures} | |
90 | +As there is still no consensus about the single best coreference resolution measure, our evaluation tool provides results for 5 widely known measures: MUC\cite{muc}, $B^3$\cite{b3}, mention- and entity-based CEAF \cite{ceaf}(called CEAFM and CEAFE, respectively) and BLANC \cite{blanc}. | |
91 | + | |
92 | +As these measures assume that system and gold mentions are the same, we implemented two alternatives to make that happen for systems not using gold mentions: | |
93 | +\begin{itemize} | |
94 | + \item consider only correct system mentions (i.e. the intersection between gold and system mentions) (INTERSECT), | |
95 | + \item transform system and gold mentions as in \cite{Marquez2012}, following a procedure described below (TRANSFORM). | |
96 | +\end{itemize} | |
97 | +TRANSFORM procedure of dealing with so-called "twinless" mentions (not in the intersection of system and gold mention sets) was presented in \cite{Marquez2012} and uses the following steps: | |
98 | +\begin{enumerate} | |
99 | + \item insert twinless true mentions into the response partition as singletons, | |
100 | + \item remove twinless system mentions that are resolved as singletons, | |
101 | + \item insert twinless system mentions that are resolved as coreferent into the key partition (as singletons). | |
102 | +\end{enumerate} | |
103 | +This approach was also used in CoNLL-2011 shared task \cite{Pradhan2011}. | |
104 | + | |
105 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
106 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
107 | +\bibliographystyle{plain} | |
108 | +\bibliography{references} | |
109 | + | |
110 | +\end{document} | |
111 | + | |
... | ... |
doc/references.bib
0 → 100755
1 | +++ a/doc/references.bib | |
1 | +@book{ | |
2 | + prz:etal:11:ed, | |
3 | + editor = "Przepiórkowski, Adam and Bańko, Mirosław and Górski, Rafał L. and Lewandowska-Tomaszczyk, Barbara", | |
4 | + publisher = "Wydawnictwo Naukowe PWN", | |
5 | + title = "Narodowy Korpus Języka Polskiego", | |
6 | + booktitle = "Narodowy Korpus Języka Polskiego", | |
7 | + year = "2011", | |
8 | + address = "Warsaw" | |
9 | +} | |
10 | + | |
11 | +@InProceedings{ban:prz:10, | |
12 | + author = "Piotr Bański and Adam Przepiórkowski", | |
13 | + title = "The {TEI} and the {NCP}: the model and its | |
14 | + application", | |
15 | + crossref = "lrec:lrslm:10"} | |
16 | + | |
17 | +@Proceedings{lrec:lrslm:10, | |
18 | + key = "LREC:LRSLM", | |
19 | + title = "{LREC}\,2010 Workshop on Language Resources: From | |
20 | + Storyboard to Sustainability and {LR} Lifecycle | |
21 | + Management", | |
22 | + booktitle = "{LREC}\,2010 Workshop on Language Resources: From | |
23 | + Storyboard to Sustainability and {LR} Lifecycle | |
24 | + Management", | |
25 | + address = "Valletta, Malta", | |
26 | + organization = "ELRA", | |
27 | + year = 2010 | |
28 | + } | |
29 | + | |
30 | + @inproceedings{Pradhan2011, | |
31 | + author = {Pradhan, Sameer and Ramshaw, Lance and Marcus, Mitchell and Palmer, Martha and Weischedel, Ralph and Xue, Nianwen}, | |
32 | + title = {CoNLL-2011 Shared Task: Modeling Unrestricted Coreference in OntoNotes}, | |
33 | + booktitle = {Proceedings of the Fifteenth Conference on Computational Natural Language Learning: Shared Task}, | |
34 | + series = {CONLL Shared Task '11}, | |
35 | + year = {2011}, | |
36 | + isbn = {9781937284084}, | |
37 | + location = {Portland, Oregon}, | |
38 | + pages = {1--27}, | |
39 | + numpages = {27}, | |
40 | + url = {http://dl.acm.org/citation.cfm?id=2132936.2132937}, | |
41 | + acmid = {2132937}, | |
42 | + publisher = {Association for Computational Linguistics}, | |
43 | + address = {Stroudsburg, PA, USA}, | |
44 | +} | |
45 | + | |
46 | + | |
47 | +@inproceedings{muc, | |
48 | + author = {Vilain, Marc and Burger, John and Aberdeen, John and Connolly, Dennis and Hirschman, Lynette}, | |
49 | + title = {A model-theoretic coreference scoring scheme}, | |
50 | + booktitle = {Proceedings of the 6th conference on Message understanding}, | |
51 | + series = {MUC6 '95}, | |
52 | + year = {1995}, | |
53 | + isbn = {1-55860-402-2}, | |
54 | + location = {Columbia, Maryland}, | |
55 | + pages = {45--52}, | |
56 | + numpages = {8}, | |
57 | + url = {http://dx.doi.org/10.3115/1072399.1072405}, | |
58 | + doi = {http://dx.doi.org/10.3115/1072399.1072405}, | |
59 | + acmid = {1072405}, | |
60 | + publisher = {Association for Computational Linguistics}, | |
61 | + address = {Stroudsburg, PA, USA}, | |
62 | +} | |
63 | + | |
64 | +@ARTICLE{Marquez2012, | |
65 | + author = {M\`{a}rquez, Llu\'{\i}s and Recasens, Marta and Sapena, Emili}, | |
66 | + title = {Coreference resolution: an empirical study based on {SemEval}-2010 | |
67 | + shared Task 1}, | |
68 | + journal = {Language Resources and Evaluation}, | |
69 | + year = {2012}, | |
70 | + pages = {1--34}, | |
71 | + month = jul, | |
72 | + abstract = {This paper presents an empirical evaluation of coreference resolution | |
73 | + that covers several interrelated dimensions. The main goal is to | |
74 | + complete the comparative analysis from the {SemEval}-2010 task on | |
75 | + Coreference Resolution in Multiple Languages . To do so, the study | |
76 | + restricts the number of languages and systems involved, but extends | |
77 | + and deepens the analysis of the system outputs, including a more | |
78 | + qualitative discussion. The paper compares three automatic coreference | |
79 | + resolution systems for three languages (English, Catalan and Spanish) | |
80 | + in four evaluation settings, and using four evaluation measures. | |
81 | + Given that our main goal is not to provide a comparison between resolution | |
82 | + algorithms, these are merely used as tools to shed light on the different | |
83 | + conditions under which coreference resolution is evaluated. Although | |
84 | + the dimensions are strongly interdependent, making it very difficult | |
85 | + to extract general principles, the study reveals a series of interesting | |
86 | + issues in relation to coreference resolution: the portability of | |
87 | + systems across languages, the influence of the type and quality of | |
88 | + input annotations, and the behavior of the scoring measures.}, | |
89 | + citeulike-article-id = {10887108}, | |
90 | + citeulike-linkout-0 = {http://dx.doi.org/10.1007/s10579-012-9194-z}, | |
91 | + citeulike-linkout-1 = {http://www.springerlink.com/content/006123u1h7812455}, | |
92 | + day = {13}, | |
93 | + doi = {10.1007/s10579-012-9194-z}, | |
94 | + issn = {1574-020X}, | |
95 | + owner = {me2}, | |
96 | + posted-at = {2012-07-16 11:35:31}, | |
97 | + publisher = {Springer Netherlands}, | |
98 | + timestamp = {2013.11.18}, | |
99 | + url = {http://dx.doi.org/10.1007/s10579-012-9194-z} | |
100 | +} | |
101 | + | |
102 | + | |
103 | + | |
104 | +@inproceedings{b3, | |
105 | + author = {Amit Bagga and Breck Baldwin}, | |
106 | + title = {Algorithms for Scoring Coreference Chains}, | |
107 | + booktitle = {In The First International Conference on Language Resources and Evaluation Workshop on Linguistics Coreference}, | |
108 | + year = {1998}, | |
109 | + pages = {563--566} | |
110 | +} | |
111 | + | |
112 | +@Article{ceaf, | |
113 | + author = "Xiaoqiang Luo", | |
114 | + title = "{On Coreference Resolution Performance Metrics}", | |
115 | + booktitle = {Proceedings of HLT-EMNLP}, | |
116 | + year = {2005}, | |
117 | + pages = {25--32}, | |
118 | + address = "Vancouver, Canada", | |
119 | +} | |
120 | + | |
121 | +@article{blanc, | |
122 | + author = {Marta Recasens and E. Hovy}, | |
123 | + title = {BLANC: Implementing the Rand index for coreference evaluation}, | |
124 | + booktitle = {Natural Language Engineering, 17}, | |
125 | + pages = {485--510}, | |
126 | + doi = {10.1017/S135132491000029X}, | |
127 | + year = 2011, | |
128 | +} | |
0 | 129 | \ No newline at end of file |
... | ... |
pom.xml
0 → 100755
1 | +++ a/pom.xml | |
1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
3 | + <modelVersion>4.0.0</modelVersion> | |
4 | + <groupId>pl.waw.ipipan.zil.core</groupId> | |
5 | + <artifactId>scoreference</artifactId> | |
6 | + <version>1.0-SNAPSHOT</version> | |
7 | + <properties> | |
8 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
9 | + </properties> | |
10 | + <build> | |
11 | + <plugins> | |
12 | + <plugin> | |
13 | + <groupId>org.apache.maven.plugins</groupId> | |
14 | + <artifactId>maven-compiler-plugin</artifactId> | |
15 | + <version>3.0</version> | |
16 | + <configuration> | |
17 | + <source>1.7</source> | |
18 | + <target>1.7</target> | |
19 | + </configuration> | |
20 | + </plugin> | |
21 | + <plugin> | |
22 | + <groupId>org.dstovall</groupId> | |
23 | + <artifactId>onejar-maven-plugin</artifactId> | |
24 | + <version>1.4.4</version> | |
25 | + <executions> | |
26 | + <execution> | |
27 | + <configuration> | |
28 | + <mainClass>pl.waw.ipipan.zil.core.scoreference.main.Main</mainClass> | |
29 | + </configuration> | |
30 | + <goals> | |
31 | + <goal>one-jar</goal> | |
32 | + </goals> | |
33 | + </execution> | |
34 | + </executions> | |
35 | + </plugin> | |
36 | + </plugins> | |
37 | + </build> | |
38 | + <dependencies> | |
39 | + <dependency> | |
40 | + <groupId>junit</groupId> | |
41 | + <artifactId>junit</artifactId> | |
42 | + <version>4.9</version> | |
43 | + <scope>test</scope> | |
44 | + </dependency> | |
45 | + <dependency> | |
46 | + <groupId>log4j</groupId> | |
47 | + <artifactId>log4j</artifactId> | |
48 | + <version>1.2.16</version> | |
49 | + </dependency> | |
50 | + <dependency> | |
51 | + <groupId>javax.xml.stream</groupId> | |
52 | + <artifactId>stax-api</artifactId> | |
53 | + <version>1.0-2</version> | |
54 | + </dependency> | |
55 | + <dependency> | |
56 | + <groupId>ipipan</groupId> | |
57 | + <artifactId>teiapi</artifactId> | |
58 | + <version>1.0-SNAPSHOT</version> | |
59 | + </dependency> | |
60 | + <dependency> | |
61 | + <groupId>org.apache.commons</groupId> | |
62 | + <artifactId>commons-io</artifactId> | |
63 | + <version>1.3.2</version> | |
64 | + </dependency> | |
65 | + </dependencies> | |
66 | + | |
67 | + <repositories> | |
68 | + <repository> | |
69 | + <id>zil-maven-repo</id> | |
70 | + <name>ZIL maven repository</name> | |
71 | + <url>http://maven.nlp.ipipan.waw.pl/content/repositories/snapshots/</url> | |
72 | + </repository> | |
73 | + </repositories> | |
74 | + | |
75 | + <pluginRepositories> | |
76 | + <pluginRepository> | |
77 | + <id>onejar-maven-plugin.googlecode.com</id> | |
78 | + <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url> | |
79 | + </pluginRepository> | |
80 | + </pluginRepositories> | |
81 | +</project> | |
0 | 82 | \ No newline at end of file |
... | ... |
src/main/java/log4j.properties
0 → 100755
1 | +++ a/src/main/java/log4j.properties | |
1 | +# konfiguracja root logger (logger) | |
2 | +log4j.appender.stderr=org.apache.log4j.ConsoleAppender | |
3 | +log4j.appender.stderr.layout=org.apache.log4j.PatternLayout | |
4 | +#log4j.appender.stderr.layout.ConversionPattern=[%t] %-5p %c - %m%n | |
5 | +log4j.appender.stderr.layout.ConversionPattern=[%p] [%C{1}] %m%n | |
6 | + | |
7 | +log4j.logger.pl.waw.ipipan.zil.core.scoreference=INFO, stderr | |
8 | +log4j.logger.ipipan.clarin=ERROR, stderr | |
0 | 9 | \ No newline at end of file |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/AnnotationPair.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/AnnotationPair.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
4 | + | |
5 | +public interface AnnotationPair { | |
6 | + | |
7 | + void addPair(SingleTextAnnotation goldText, SingleTextAnnotation sysText, boolean transform); | |
8 | + | |
9 | + int getTextCount(); | |
10 | + | |
11 | + SingleTextAnnotation getGold(int i); | |
12 | + | |
13 | + SingleTextAnnotation getSys(int i); | |
14 | + | |
15 | + Result getMentionDetectionResult(boolean zeroOnly); | |
16 | + | |
17 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/AnnotationPairImpl.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/AnnotationPairImpl.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.Collection; | |
5 | +import java.util.HashSet; | |
6 | +import java.util.List; | |
7 | + | |
8 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
9 | + | |
10 | +public class AnnotationPairImpl implements AnnotationPair { | |
11 | + | |
12 | + private final List<SingleTextAnnotation> golds = new ArrayList<>(); | |
13 | + private final List<SingleTextAnnotation> syss = new ArrayList<>(); | |
14 | + private int totalTruePositives; | |
15 | + private int totalSysMentions; | |
16 | + private int totalGoldMentions; | |
17 | + | |
18 | + private int zeroTruePositives; | |
19 | + private int zeroSysMentions; | |
20 | + private int zeroGoldMentions; | |
21 | + | |
22 | + @Override | |
23 | + public void addPair(SingleTextAnnotation goldText, SingleTextAnnotation sysText, boolean transform) { | |
24 | + | |
25 | + evaluateMD(goldText, sysText); | |
26 | + | |
27 | + // ensure that annotations have the same mentions | |
28 | + if (transform) { | |
29 | + // 1. insert twinless true mentions into the response partition as | |
30 | + // singletons | |
31 | + for (Mention m : goldText.getMentions()) { | |
32 | + if (!sysText.getMentions().contains(m)) { | |
33 | + sysText.addSingletons(m.getId()); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + for (Mention m : sysText.getMentions()) { | |
38 | + if (!goldText.getMentions().contains(m)) { | |
39 | + if (m.getMentionGroup().getMentions().size() == 1) { | |
40 | + // 2. remove twinless system mentions that are resolved | |
41 | + // as singletons | |
42 | + sysText.removeMentions(m.getId()); | |
43 | + } else { | |
44 | + // 3. insert twinless system mentions that are resolved | |
45 | + // as coreferent into the key partition (as singletons) | |
46 | + goldText.addSingletons(m.getId()); | |
47 | + } | |
48 | + } | |
49 | + } | |
50 | + | |
51 | + } else { | |
52 | + // simple intersection | |
53 | + Collection<Mention> goldMentions = goldText.getMentions(); | |
54 | + goldMentions.retainAll(sysText.getMentions()); | |
55 | + goldText.retainMentions(goldMentions); | |
56 | + sysText.retainMentions(goldMentions); | |
57 | + } | |
58 | + | |
59 | + this.golds.add(goldText); | |
60 | + this.syss.add(sysText); | |
61 | + } | |
62 | + | |
63 | + private void evaluateMD(SingleTextAnnotation goldText, SingleTextAnnotation sysText) { | |
64 | + Collection<Mention> goldMentions = goldText.getMentions(); | |
65 | + Collection<Mention> sysMentions = sysText.getMentions(); | |
66 | + totalGoldMentions += goldMentions.size(); | |
67 | + totalSysMentions += sysMentions.size(); | |
68 | + Collection<Mention> goldMentionsCopy = new HashSet<>(goldMentions); | |
69 | + goldMentionsCopy.retainAll(sysMentions); | |
70 | + totalTruePositives += goldMentionsCopy.size(); | |
71 | + | |
72 | + Collection<Mention> goldZeroMentions = goldText.getZeroMentions(); | |
73 | + Collection<Mention> sysZeroMentions = sysText.getZeroMentions(); | |
74 | + zeroGoldMentions += goldZeroMentions.size(); | |
75 | + zeroSysMentions += sysZeroMentions.size(); | |
76 | + Collection<Mention> goldZeroMentionsCopy = new HashSet<>(goldZeroMentions); | |
77 | + goldZeroMentionsCopy.retainAll(sysZeroMentions); | |
78 | + zeroTruePositives += goldZeroMentionsCopy.size(); | |
79 | + } | |
80 | + | |
81 | + @Override | |
82 | + public int getTextCount() { | |
83 | + return golds.size(); | |
84 | + } | |
85 | + | |
86 | + @Override | |
87 | + public Result getMentionDetectionResult(boolean zeroOnly) { | |
88 | + if (zeroOnly) { | |
89 | + System.out.println("Total gold mentions (zero subject only): " + zeroGoldMentions); | |
90 | + System.out.println("Total sys mentions (zero subject only): " + zeroSysMentions); | |
91 | + System.out.println("Total common mentions (zero subject only): " + zeroTruePositives); | |
92 | + return new Result(zeroTruePositives, zeroSysMentions, zeroTruePositives, zeroGoldMentions); | |
93 | + } else { | |
94 | + System.out.println("Total gold mentions: " + totalGoldMentions); | |
95 | + System.out.println("Total sys mentions: " + totalSysMentions); | |
96 | + System.out.println("Total common mentions: " + totalTruePositives); | |
97 | + return new Result(totalTruePositives, totalSysMentions, totalTruePositives, totalGoldMentions); | |
98 | + } | |
99 | + } | |
100 | + | |
101 | + @Override | |
102 | + public SingleTextAnnotation getGold(int i) { | |
103 | + if (i < golds.size()) | |
104 | + return golds.get(i); | |
105 | + else | |
106 | + return null; | |
107 | + } | |
108 | + | |
109 | + @Override | |
110 | + public SingleTextAnnotation getSys(int i) { | |
111 | + if (i < syss.size()) | |
112 | + return syss.get(i); | |
113 | + else | |
114 | + return null; | |
115 | + } | |
116 | + | |
117 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/Mention.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/Mention.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +public class Mention { | |
4 | + | |
5 | + private MentionGroup mentionGroup = null; | |
6 | + private String id; | |
7 | + | |
8 | + public Mention(String i) { | |
9 | + id = i; | |
10 | + } | |
11 | + | |
12 | + public MentionGroup getMentionGroup() { | |
13 | + return mentionGroup; | |
14 | + } | |
15 | + | |
16 | + public void setMentionGroup(MentionGroup mentionGroup) { | |
17 | + this.mentionGroup = mentionGroup; | |
18 | + } | |
19 | + | |
20 | + public String getId() { | |
21 | + return id; | |
22 | + } | |
23 | + | |
24 | + @Override | |
25 | + public int hashCode() { | |
26 | + final int prime = 31; | |
27 | + int result = 1; | |
28 | + result = prime * result + ((id == null) ? 0 : id.hashCode()); | |
29 | + return result; | |
30 | + } | |
31 | + | |
32 | + @Override | |
33 | + public boolean equals(Object obj) { | |
34 | + if (this == obj) | |
35 | + return true; | |
36 | + if (obj == null) | |
37 | + return false; | |
38 | + if (getClass() != obj.getClass()) | |
39 | + return false; | |
40 | + Mention other = (Mention) obj; | |
41 | + if (id == null) { | |
42 | + if (other.id != null) | |
43 | + return false; | |
44 | + } else if (!id.equals(other.id)) | |
45 | + return false; | |
46 | + return true; | |
47 | + } | |
48 | + | |
49 | + public String toString() { | |
50 | + return id; | |
51 | + } | |
52 | + | |
53 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/MentionGroup.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/MentionGroup.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +import java.util.HashSet; | |
4 | +import java.util.Set; | |
5 | + | |
6 | +public class MentionGroup implements Comparable<MentionGroup> { | |
7 | + | |
8 | + private Set<Mention> mentions = new HashSet<Mention>(); | |
9 | + | |
10 | + public Set<Mention> getMentions() { | |
11 | + return mentions; | |
12 | + } | |
13 | + | |
14 | + public void addMention(Mention m) { | |
15 | + mentions.add(m); | |
16 | + m.setMentionGroup(this); | |
17 | + } | |
18 | + | |
19 | + public String toString() { | |
20 | + return mentions.toString(); | |
21 | + } | |
22 | + | |
23 | + public void removeMention(Mention m) { | |
24 | + this.mentions.remove(m); | |
25 | + m.setMentionGroup(null); | |
26 | + } | |
27 | + | |
28 | + public int compareTo(MentionGroup o) { | |
29 | + return this.toString().compareTo(o.toString()); | |
30 | + } | |
31 | + | |
32 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/SingleTextAnnotation.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/SingleTextAnnotation.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +import java.util.Collection; | |
4 | + | |
5 | +public interface SingleTextAnnotation { | |
6 | + | |
7 | + public Collection<Mention> getMentions(); | |
8 | + | |
9 | + public Mention getMention(Mention m); | |
10 | + | |
11 | + public Collection<MentionGroup> getMentionGroups(); | |
12 | + | |
13 | + public void retainMentions(Collection<Mention> mentions); | |
14 | + | |
15 | + public String getFilename(); | |
16 | + | |
17 | + public void addSingletons(String... ids); | |
18 | + | |
19 | + public void removeMentions(String... id); | |
20 | + | |
21 | + public Collection<Mention> getZeroMentions(); | |
22 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/SingleTextAnnotationImpl.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/basic/SingleTextAnnotationImpl.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.basic; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.Collection; | |
5 | +import java.util.Collections; | |
6 | +import java.util.HashMap; | |
7 | +import java.util.HashSet; | |
8 | +import java.util.Iterator; | |
9 | +import java.util.Map; | |
10 | +import java.util.Map.Entry; | |
11 | +import java.util.Set; | |
12 | + | |
13 | +public class SingleTextAnnotationImpl implements SingleTextAnnotation { | |
14 | + | |
15 | + Set<MentionGroup> mentionGroups = new HashSet<>(); | |
16 | + Map<String, Mention> mentions = new HashMap<>(); | |
17 | + private String filename = null; | |
18 | + private Set<String> zeroSubjectIds = new HashSet<>(); | |
19 | + | |
20 | + public SingleTextAnnotationImpl() { | |
21 | + } | |
22 | + | |
23 | + public SingleTextAnnotationImpl(String filename) { | |
24 | + this.filename = filename; | |
25 | + } | |
26 | + | |
27 | + public String toString() { | |
28 | + ArrayList<MentionGroup> mgs = new ArrayList<MentionGroup>(mentionGroups); | |
29 | + Iterator<MentionGroup> it = mgs.iterator(); | |
30 | + while (it.hasNext()) { | |
31 | + if (it.next().getMentions().size() == 1) | |
32 | + it.remove(); | |
33 | + } | |
34 | + | |
35 | + Collections.sort(mgs); | |
36 | + return mgs.toString(); | |
37 | + } | |
38 | + | |
39 | + public Collection<Mention> getMentions() { | |
40 | + return new HashSet<Mention>(mentions.values()); | |
41 | + } | |
42 | + | |
43 | + public Mention getMention(Mention m) { | |
44 | + return mentions.get(m.getId()); | |
45 | + } | |
46 | + | |
47 | + public void addMentionGroup(String... ids) { | |
48 | + MentionGroup mg = new MentionGroup(); | |
49 | + for (String i : ids) { | |
50 | + Mention m = new Mention(i); | |
51 | + mg.addMention(m); | |
52 | + | |
53 | + mentions.put(i, m); | |
54 | + } | |
55 | + mentionGroups.add(mg); | |
56 | + } | |
57 | + | |
58 | + public void addSingletons(String... ids) { | |
59 | + for (String i : ids) { | |
60 | + MentionGroup mg = new MentionGroup(); | |
61 | + Mention m = new Mention(i); | |
62 | + mg.addMention(m); | |
63 | + | |
64 | + mentions.put(i, m); | |
65 | + mentionGroups.add(mg); | |
66 | + } | |
67 | + } | |
68 | + | |
69 | + private String[] intArrayToStringArray(int[] intArray) { | |
70 | + String[] stringArray = new String[intArray.length]; | |
71 | + for (int i = 0; i < intArray.length; i++) { | |
72 | + stringArray[i] = Integer.toString(intArray[i]); | |
73 | + } | |
74 | + return stringArray; | |
75 | + } | |
76 | + | |
77 | + public void addMentionGroup(int... ids) { | |
78 | + addMentionGroup(intArrayToStringArray(ids)); | |
79 | + } | |
80 | + | |
81 | + public void addSingletons(int... ids) { | |
82 | + addSingletons(intArrayToStringArray(ids)); | |
83 | + } | |
84 | + | |
85 | + public Collection<MentionGroup> getMentionGroups() { | |
86 | + return new HashSet<MentionGroup>(mentionGroups); | |
87 | + } | |
88 | + | |
89 | + public void retainMentions(Collection<Mention> mentions) { | |
90 | + Iterator<Entry<String, Mention>> iterator = this.mentions.entrySet().iterator(); | |
91 | + while (iterator.hasNext()) { | |
92 | + Entry<String, Mention> next = iterator.next(); | |
93 | + Mention m = next.getValue(); | |
94 | + if (!mentions.contains(m)) { | |
95 | + iterator.remove(); | |
96 | + MentionGroup mg = m.getMentionGroup(); | |
97 | + mg.removeMention(m); | |
98 | + if (mg.getMentions().size() == 0) | |
99 | + mentionGroups.remove(mg); | |
100 | + } | |
101 | + } | |
102 | + } | |
103 | + | |
104 | + public String getFilename() { | |
105 | + return filename; | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public void removeMentions(String... ids) { | |
110 | + for (String id : ids) { | |
111 | + Mention mention = this.mentions.get(id); | |
112 | + | |
113 | + MentionGroup mg = mention.getMentionGroup(); | |
114 | + mg.removeMention(mention); | |
115 | + if (mg.getMentions().size() == 0) | |
116 | + this.mentionGroups.remove(mg); | |
117 | + | |
118 | + this.mentions.remove(id); | |
119 | + } | |
120 | + } | |
121 | + | |
122 | + public void setZeroSubjectIds(Set<String> zeroSubjectIds) { | |
123 | + this.zeroSubjectIds = zeroSubjectIds; | |
124 | + } | |
125 | + | |
126 | + @Override | |
127 | + public Collection<Mention> getZeroMentions() { | |
128 | + Set<Mention> result = new HashSet<>(); | |
129 | + for (Mention m : mentions.values()) | |
130 | + if (zeroSubjectIds.contains(m.getId())) | |
131 | + result.add(m); | |
132 | + return result; | |
133 | + } | |
134 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/main/EvaluateSeveralSystemsLatex.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/main/EvaluateSeveralSystemsLatex.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.main; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.Arrays; | |
6 | +import java.util.Collections; | |
7 | +import java.util.HashMap; | |
8 | +import java.util.LinkedHashMap; | |
9 | +import java.util.List; | |
10 | +import java.util.Map; | |
11 | + | |
12 | +import org.apache.log4j.Logger; | |
13 | + | |
14 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
15 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPairImpl; | |
16 | +import pl.waw.ipipan.zil.core.scoreference.readers.Mmax; | |
17 | +import pl.waw.ipipan.zil.core.scoreference.readers.Reader; | |
18 | +import pl.waw.ipipan.zil.core.scoreference.readers.Tei; | |
19 | +import pl.waw.ipipan.zil.core.scoreference.scorers.Scorer; | |
20 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerB3; | |
21 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerBlanc; | |
22 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerCeafe; | |
23 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerCeafm; | |
24 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerMuc; | |
25 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
26 | + | |
27 | +public class EvaluateSeveralSystemsLatex { | |
28 | + | |
29 | + private static final Logger logger = Logger.getLogger(EvaluateSeveralSystemsLatex.class); | |
30 | + | |
31 | + /** | |
32 | + * @param args | |
33 | + */ | |
34 | + public static void main(String[] args) { | |
35 | + | |
36 | + if (args.length != 3) { | |
37 | + logger.error("Wrong number of arguments! Try: " + EvaluateSeveralSystemsLatex.class.getSimpleName() | |
38 | + + " goldDir sysDirs format"); | |
39 | + return; | |
40 | + } | |
41 | + | |
42 | + File gold = new File(args[0]); | |
43 | + File sys = new File(args[1]); | |
44 | + String format = args[2]; | |
45 | + | |
46 | + if (!gold.isDirectory()) { | |
47 | + logger.error("Gold data directory (" + gold + ") not found"); | |
48 | + return; | |
49 | + } | |
50 | + if (!sys.isDirectory()) { | |
51 | + logger.error("Sys data directory (" + sys + ") not found"); | |
52 | + return; | |
53 | + } | |
54 | + if (!format.equalsIgnoreCase("mmax") && !format.equalsIgnoreCase("tei")) { | |
55 | + logger.error("Wrong format! Try \"mmax\" or \"tei\"."); | |
56 | + return; | |
57 | + } | |
58 | + | |
59 | + Reader reader = format.equalsIgnoreCase("mmax") ? new Mmax() : new Tei(); | |
60 | + | |
61 | + printStats(false, false, gold, sys, reader); | |
62 | + printStats(true, false, gold, sys, reader); | |
63 | + printStats(false, true, gold, sys, reader); | |
64 | + printStats(true, true, gold, sys, reader); | |
65 | + } | |
66 | + | |
67 | + private static void printStats(boolean headsOnly, boolean transform, File gold, File sys, Reader reader) { | |
68 | + | |
69 | + List<File> systemDirs = new ArrayList<>(Arrays.asList(sys.listFiles())); | |
70 | + | |
71 | + List<Scorer> scorers = new ArrayList<>(); | |
72 | + scorers.add(new ScorerMuc()); | |
73 | + scorers.add(new ScorerB3()); | |
74 | + scorers.add(new ScorerCeafm()); | |
75 | + scorers.add(new ScorerCeafe()); | |
76 | + scorers.add(new ScorerBlanc()); | |
77 | + | |
78 | + Map<String, String> scorerClass2name = new LinkedHashMap<>(); | |
79 | + scorerClass2name.put("ScorerMuc", "MUC"); | |
80 | + scorerClass2name.put("ScorerB3", "$B^3$"); | |
81 | + scorerClass2name.put("ScorerCeafm", "CEAF-M"); | |
82 | + scorerClass2name.put("ScorerCeafe", "CEAF-E"); | |
83 | + scorerClass2name.put("ScorerBlanc", "BLANC"); | |
84 | + | |
85 | + Map<String, Map<String, Map<String, Double>>> system2scorer2results = new HashMap<>(); | |
86 | + for (File dir : systemDirs) { | |
87 | + String systemName = dir.getName(); | |
88 | + system2scorer2results.put(systemName, new HashMap<String, Map<String, Double>>()); | |
89 | + | |
90 | + AnnotationPair ann = new AnnotationPairImpl(); | |
91 | + reader.loadAnnotationsFromDirs(gold, dir, ann, headsOnly, transform); | |
92 | + | |
93 | + logger.info(ann.getTextCount() + " text pairs loaded."); | |
94 | + for (Scorer scorer : scorers) { | |
95 | + Result result = scorer.compare(ann); | |
96 | + Map<String, Double> resultMap = new LinkedHashMap<>(); | |
97 | + resultMap.put("Precision", result.getPrecision()); | |
98 | + resultMap.put("Recall", result.getRecall()); | |
99 | + resultMap.put("$F_1$\t", result.getF1()); | |
100 | + system2scorer2results.get(systemName).put(scorerClass2name.get(scorer.getName()), resultMap); | |
101 | + } | |
102 | + } | |
103 | + | |
104 | + System.out.println("Mention matching: " + (headsOnly ? "HEAD" : "EXACT")); | |
105 | + System.out.println("Mention mapping: " + (transform ? "TRANSFORM" : "INTERSECT")); | |
106 | + System.out.println(); | |
107 | + | |
108 | + List<String> measureNames = new ArrayList<>(system2scorer2results.values().iterator().next().values() | |
109 | + .iterator().next().keySet()); | |
110 | + List<String> systemNames = new ArrayList<>(system2scorer2results.keySet()); | |
111 | + Collections.sort(systemNames); | |
112 | + | |
113 | + for (String scorerName : scorerClass2name.values()) { | |
114 | + System.out.println("\\midrule"); | |
115 | + | |
116 | + boolean first = true; | |
117 | + for (String measure : measureNames) { | |
118 | + if (first) { | |
119 | + System.out.print("\\multirow{3}{*}{" + scorerName + "}\t& "); | |
120 | + first = false; | |
121 | + } else { | |
122 | + System.out.print("\t\t\t\t\t\t& "); | |
123 | + } | |
124 | + System.out.print(measure + "\t"); | |
125 | + | |
126 | + double max = 0; | |
127 | + for (String systemName : systemNames) { | |
128 | + Double score = system2scorer2results.get(systemName).get(scorerName).get(measure); | |
129 | + if (score > max) | |
130 | + max = score; | |
131 | + } | |
132 | + for (String systemName : systemNames) { | |
133 | + System.out.print("& "); | |
134 | + Double score = system2scorer2results.get(systemName).get(scorerName).get(measure); | |
135 | + String result = String.format("%.2f", score * 100) + "\\%"; | |
136 | + if (score == max) | |
137 | + result = "\\textbf{" + result + "}\t"; | |
138 | + else | |
139 | + result = result + "\t\t\t"; | |
140 | + System.out.print(result); | |
141 | + } | |
142 | + System.out.println("\\\\"); | |
143 | + } | |
144 | + System.out.println(); | |
145 | + } | |
146 | + } | |
147 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/main/KAlpha.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/main/KAlpha.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.main; | |
2 | + | |
3 | +import java.io.BufferedReader; | |
4 | +import java.io.File; | |
5 | +import java.io.FileReader; | |
6 | +import java.io.IOException; | |
7 | +import java.util.ArrayList; | |
8 | +import java.util.Collections; | |
9 | +import java.util.Comparator; | |
10 | +import java.util.HashMap; | |
11 | +import java.util.List; | |
12 | +import java.util.Map; | |
13 | +import java.util.Map.Entry; | |
14 | + | |
15 | +import org.apache.log4j.Logger; | |
16 | + | |
17 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
18 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPairImpl; | |
19 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
20 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
21 | +import pl.waw.ipipan.zil.core.scoreference.readers.Mmax; | |
22 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
23 | + | |
24 | +public class KAlpha { | |
25 | + | |
26 | + private static final Logger logger = Logger.getLogger(KAlpha.class); | |
27 | + | |
28 | + /** | |
29 | + * @param args | |
30 | + */ | |
31 | + public static void main(String[] args) { | |
32 | + | |
33 | + if (args.length < 2) { | |
34 | + logger.error("Wrong number of arguments! Try: " + KAlpha.class.getSimpleName() + " goldDir sysDir [map]"); | |
35 | + return; | |
36 | + } | |
37 | + | |
38 | + File gold = new File(args[0]); | |
39 | + File sys = new File(args[1]); | |
40 | + File mapFile = args.length > 2 ? new File(args[2]) : null; | |
41 | + AnnotationPair ann = new AnnotationPairImpl(); | |
42 | + | |
43 | + (new Mmax()).loadAnnotationsFromDirs(gold, sys, ann, false, false); | |
44 | + logger.info(ann.getTextCount() + " pairs of texts found"); | |
45 | + | |
46 | + Result md = ann.getMentionDetectionResult(false); | |
47 | + System.out.println("\nMention detection result:"); | |
48 | + System.out.println(md); | |
49 | + | |
50 | + System.out.println("\nK Alpha results:"); | |
51 | + Map<String, String> map = mapFile == null ? null : loadMap(mapFile); | |
52 | + Map<String, Double> kalphaBlanc = KAlpha.computeKappaBlanc(ann, map); | |
53 | + List<Entry<String, Double>> entries = new ArrayList<>(kalphaBlanc.entrySet()); | |
54 | + Collections.sort(entries, new Comparator<Entry<String, Double>>() { | |
55 | + | |
56 | + @Override | |
57 | + public int compare(Entry<String, Double> o1, Entry<String, Double> o2) { | |
58 | + return o1.getValue().compareTo(o2.getValue()); | |
59 | + } | |
60 | + }); | |
61 | + for (Entry<String, Double> e : entries) | |
62 | + System.out.println(String.format("%6.3f", e.getValue()) + "\t" + e.getKey().replaceAll("\"", "")); | |
63 | + | |
64 | + } | |
65 | + | |
66 | + private static Map<String, String> loadMap(File mapFile) { | |
67 | + if (!mapFile.exists()) | |
68 | + return null; | |
69 | + | |
70 | + Map<String, String> result = new HashMap<>(); | |
71 | + | |
72 | + try (BufferedReader br = new BufferedReader(new FileReader(mapFile))) { | |
73 | + String line = null; | |
74 | + while ((line = br.readLine()) != null) { | |
75 | + String[] spl = line.split(" ", 2); | |
76 | + result.put(spl[0], spl[1]); | |
77 | + } | |
78 | + | |
79 | + } catch (IOException e) { | |
80 | + logger.error("Error loading map file: " + e); | |
81 | + } | |
82 | + | |
83 | + return result; | |
84 | + } | |
85 | + | |
86 | + public static Map<String, Double> computeKappaBlanc(AnnotationPair goldAndSys, Map<String, String> map) { | |
87 | + | |
88 | + Map<String, Double> kappaSums = new HashMap<>(); | |
89 | + Map<String, Double> textCounts = new HashMap<>(); | |
90 | + | |
91 | + for (int i = 0; i < goldAndSys.getTextCount(); i++) { | |
92 | + | |
93 | + int[] table = computeTable(goldAndSys.getGold(i), goldAndSys.getSys(i)); | |
94 | + | |
95 | + double kappa = computeAlphaBlanc4Text(table); | |
96 | + | |
97 | + String filename = goldAndSys.getGold(i).getFilename(); | |
98 | + String idx = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf("_")); | |
99 | + String type = "only type"; | |
100 | + if (map != null) | |
101 | + type = map.get(idx); | |
102 | + | |
103 | + if (kappaSums.containsKey(type)) | |
104 | + kappaSums.put(type, kappaSums.get(type) + kappa); | |
105 | + else | |
106 | + kappaSums.put(type, kappa); | |
107 | + | |
108 | + if (textCounts.containsKey(type)) | |
109 | + textCounts.put(type, textCounts.get(type) + 1); | |
110 | + else | |
111 | + textCounts.put(type, 1.0); | |
112 | + } | |
113 | + | |
114 | + for (String type : kappaSums.keySet()) { | |
115 | + double sum = kappaSums.get(type); | |
116 | + double count = textCounts.get(type); | |
117 | + sum /= count; | |
118 | + | |
119 | + kappaSums.put(type, sum); | |
120 | + } | |
121 | + | |
122 | + return kappaSums; | |
123 | + } | |
124 | + | |
125 | + private static double computeAlphaBlanc4Text(int[] table) { | |
126 | + double totalRc = table[0]; | |
127 | + double totalWc = table[1]; | |
128 | + double totalRn = table[2]; | |
129 | + double totalWn = table[3]; | |
130 | + | |
131 | + double sum = (totalRc + totalRn + totalWc + totalWn); | |
132 | + | |
133 | + double agrObs = (totalRc + totalRn) / sum; | |
134 | + double agrExp = (totalRc + totalWc) / sum * (totalRc + totalWn) / sum + (totalRn + totalWc) / sum | |
135 | + * (totalRn + totalWn) / sum; | |
136 | + double kappa = (agrObs - agrExp) / (1 - agrExp); | |
137 | + | |
138 | + return kappa; | |
139 | + } | |
140 | + | |
141 | + public static int[] computeTable(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
142 | + | |
143 | + int rc = 0; | |
144 | + int wc = 0; | |
145 | + int rn = 0; | |
146 | + int wn = 0; | |
147 | + | |
148 | + List<Mention> mentions = new ArrayList<Mention>(gold.getMentions()); | |
149 | + int mentionsCount = mentions.size(); | |
150 | + | |
151 | + for (int i = 0; i < mentionsCount - 1; i++) { | |
152 | + Mention m1 = mentions.get(i); | |
153 | + for (int j = i + 1; j < mentionsCount; j++) { | |
154 | + Mention m2 = mentions.get(j); | |
155 | + | |
156 | + boolean goldCoreferent = m1.getMentionGroup().getMentions().contains(m2); | |
157 | + boolean sysCoreferent = sys.getMention(m1).getMentionGroup().getMentions().contains(sys.getMention(m2)); | |
158 | + | |
159 | + if (goldCoreferent) { | |
160 | + if (sysCoreferent) { | |
161 | + rc++; // right coreference link | |
162 | + } else { | |
163 | + wn++; // wrong non-coreference link | |
164 | + } | |
165 | + } else { | |
166 | + if (sysCoreferent) { | |
167 | + wc++; // wrong coreference link | |
168 | + } else { | |
169 | + rn++; // right non-coreference link | |
170 | + } | |
171 | + } | |
172 | + } | |
173 | + } | |
174 | + | |
175 | + int[] result = new int[4]; | |
176 | + result[0] = rc; | |
177 | + result[1] = wc; | |
178 | + result[2] = rn; | |
179 | + result[3] = wn; | |
180 | + | |
181 | + return result; | |
182 | + } | |
183 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/main/Main.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/main/Main.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.main; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import org.apache.log4j.Logger; | |
8 | + | |
9 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
10 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPairImpl; | |
11 | +import pl.waw.ipipan.zil.core.scoreference.readers.Mmax; | |
12 | +import pl.waw.ipipan.zil.core.scoreference.readers.Reader; | |
13 | +import pl.waw.ipipan.zil.core.scoreference.readers.Tei; | |
14 | +import pl.waw.ipipan.zil.core.scoreference.scorers.Scorer; | |
15 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerB3; | |
16 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerBlanc; | |
17 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerCeafe; | |
18 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerCeafm; | |
19 | +import pl.waw.ipipan.zil.core.scoreference.scorers.ScorerMuc; | |
20 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
21 | + | |
22 | +public class Main { | |
23 | + | |
24 | + private static final Logger logger = Logger.getLogger(Main.class); | |
25 | + | |
26 | + /** | |
27 | + * @param args | |
28 | + */ | |
29 | + public static void main(String[] args) { | |
30 | + | |
31 | + if (args.length != 3) { | |
32 | + logger.error("Wrong number of arguments! Try: " + Main.class.getSimpleName() + " goldDir sysDir format"); | |
33 | + return; | |
34 | + } | |
35 | + | |
36 | + File gold = new File(args[0]); | |
37 | + File sys = new File(args[1]); | |
38 | + String format = args[2]; | |
39 | + | |
40 | + if (!gold.isDirectory()) { | |
41 | + logger.error("Gold data directory (" + gold + ") not found"); | |
42 | + return; | |
43 | + } | |
44 | + if (!sys.isDirectory()) { | |
45 | + logger.error("Sys data directory (" + sys + ") not found"); | |
46 | + return; | |
47 | + } | |
48 | + if (!format.equalsIgnoreCase("mmax") && !format.equalsIgnoreCase("tei")) { | |
49 | + logger.error("Wrong format! Try \"mmax\" or \"tei\"."); | |
50 | + return; | |
51 | + } | |
52 | + | |
53 | + Reader reader = format.equalsIgnoreCase("mmax") ? new Mmax() : new Tei(); | |
54 | + | |
55 | + printStats(false, false, gold, sys, reader); | |
56 | + printStats(true, false, gold, sys, reader); | |
57 | + printStats(false, true, gold, sys, reader); | |
58 | + printStats(true, true, gold, sys, reader); | |
59 | + } | |
60 | + | |
61 | + private static void printStats(boolean headsOnly, boolean transform, File gold, File sys, Reader reader) { | |
62 | + AnnotationPair ann = new AnnotationPairImpl(); | |
63 | + reader.loadAnnotationsFromDirs(gold, sys, ann, headsOnly, transform); | |
64 | + | |
65 | + String sepLine = "###########################################"; | |
66 | + | |
67 | + System.out.println(sepLine); | |
68 | + System.out.println(sepLine); | |
69 | + System.out.println("Mention matching: " + (headsOnly ? "HEAD" : "EXACT")); | |
70 | + System.out.println("Mention mapping: " + (transform ? "TRANSFORM" : "INTERSECT")); | |
71 | + System.out.println(sepLine); | |
72 | + | |
73 | + System.out.println(ann.getTextCount() + " pairs of texts found"); | |
74 | + | |
75 | + System.out.println(sepLine); | |
76 | + Result md = ann.getMentionDetectionResult(false); | |
77 | + System.out.println("Mention detection result:"); | |
78 | + System.out.println(md); | |
79 | + System.out.println(sepLine); | |
80 | + | |
81 | + Result mdz = ann.getMentionDetectionResult(true); | |
82 | + System.out.println("Mention detection result zero only:"); | |
83 | + System.out.println(mdz); | |
84 | + System.out.println(sepLine); | |
85 | + | |
86 | + List<Scorer> scorers = new ArrayList<>(); | |
87 | + scorers.add(new ScorerMuc()); | |
88 | + scorers.add(new ScorerB3()); | |
89 | + scorers.add(new ScorerCeafm()); | |
90 | + scorers.add(new ScorerCeafe()); | |
91 | + scorers.add(new ScorerBlanc()); | |
92 | + | |
93 | + for (Scorer scorer : scorers) { | |
94 | + Result result = scorer.compare(ann); | |
95 | + System.out.println(scorer.getName() + ":"); | |
96 | + System.out.println(result); | |
97 | + } | |
98 | + } | |
99 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Mmax.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Mmax.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.readers; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.io.FileInputStream; | |
5 | +import java.io.InputStreamReader; | |
6 | +import java.util.ArrayList; | |
7 | +import java.util.Arrays; | |
8 | +import java.util.Collections; | |
9 | +import java.util.HashMap; | |
10 | +import java.util.HashSet; | |
11 | +import java.util.List; | |
12 | +import java.util.Map; | |
13 | +import java.util.Set; | |
14 | + | |
15 | +import javax.xml.namespace.QName; | |
16 | +import javax.xml.stream.XMLInputFactory; | |
17 | +import javax.xml.stream.XMLStreamReader; | |
18 | + | |
19 | +import org.apache.log4j.Logger; | |
20 | + | |
21 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
22 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
23 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
24 | + | |
25 | +public class Mmax implements Reader { | |
26 | + | |
27 | + private static final XMLInputFactory factory = XMLInputFactory.newInstance(); | |
28 | + private static final Logger logger = Logger.getLogger(Mmax.class); | |
29 | + | |
30 | + public void loadAnnotationsFromDirs(File goldDir, File sysDir, AnnotationPair ann, boolean headsOnly, | |
31 | + boolean transform) { | |
32 | + | |
33 | + List<File> children = new ArrayList<File>(Arrays.asList(goldDir.listFiles())); | |
34 | + Collections.sort(children); | |
35 | + | |
36 | + for (File goldFile : children) { | |
37 | + File sysFile = new File(sysDir.getPath() + File.separator + goldFile.getName()); | |
38 | + if (sysFile.exists()) { | |
39 | + if (goldFile.isDirectory()) | |
40 | + loadAnnotationsFromDirs(goldFile, sysFile, ann, headsOnly, transform); | |
41 | + else if (goldFile.getName().matches("\\d+_mentions\\.xml")) | |
42 | + loadAnnotationsFrom2Files(goldFile, sysFile, ann, headsOnly, transform); | |
43 | + } else { | |
44 | + logger.warn("No pair text for file:" + goldFile); | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + | |
49 | + public void loadAnnotationsFrom2Files(File goldFile, File sysFile, AnnotationPair ann, boolean headsOnly, | |
50 | + boolean transform) { | |
51 | + | |
52 | + File wordsFile = new File(goldFile.getParentFile() + File.separator | |
53 | + + goldFile.getName().replace("_mentions", "_words")); | |
54 | + | |
55 | + Map<String, Integer> id2start = new HashMap<>(); | |
56 | + Map<String, Integer> id2end = new HashMap<>(); | |
57 | + Map<String, String> id2orth = new HashMap<>(); | |
58 | + List<String> ids = new ArrayList<>(); | |
59 | + extractMappings(id2start, id2end, id2orth, ids, wordsFile); | |
60 | + | |
61 | + SingleTextAnnotation goldAnno = getAnnotation(goldFile, id2start, id2end, ids, id2orth, headsOnly); | |
62 | + SingleTextAnnotation sysAnno = getAnnotation(sysFile, id2start, id2end, ids, id2orth, headsOnly); | |
63 | + | |
64 | + ann.addPair(goldAnno, sysAnno, transform); | |
65 | + } | |
66 | + | |
67 | + private void extractMappings(Map<String, Integer> id2start, Map<String, Integer> id2end, | |
68 | + Map<String, String> id2orth, List<String> ids, File wordsFile) { | |
69 | + XMLStreamReader sr = null; | |
70 | + try (InputStreamReader isr = new InputStreamReader(new FileInputStream(wordsFile), "UTF-8");) { | |
71 | + sr = factory.createXMLStreamReader(isr); | |
72 | + | |
73 | + int currpos = 0; | |
74 | + String text = null; | |
75 | + String id = null; | |
76 | + while (sr.hasNext()) { | |
77 | + sr.next(); | |
78 | + if (sr.isStartElement()) { | |
79 | + if (sr.getName().equals(new QName("word"))) { | |
80 | + id = sr.getAttributeValue(null, "id"); | |
81 | + } | |
82 | + } else if (sr.isCharacters()) { | |
83 | + text = sr.getText(); | |
84 | + } else if (sr.isEndElement()) { | |
85 | + if (sr.getName().equals(new QName("word"))) { | |
86 | + id2start.put(id, currpos); | |
87 | + id2end.put(id, currpos + text.length() - 1); | |
88 | + id2orth.put(id, text); | |
89 | + currpos += text.length(); | |
90 | + ids.add(id); | |
91 | + } | |
92 | + } | |
93 | + } | |
94 | + } catch (Exception e) { | |
95 | + logger.error("Error reading words file:" + e); | |
96 | + } finally { | |
97 | + try { | |
98 | + if (sr != null) | |
99 | + sr.close(); | |
100 | + } catch (Exception e) { | |
101 | + logger.error("Error closing words file:" + e); | |
102 | + } | |
103 | + } | |
104 | + } | |
105 | + | |
106 | + private static SingleTextAnnotation getAnnotation(File file, Map<String, Integer> id2start, | |
107 | + Map<String, Integer> id2end, List<String> ids, Map<String, String> id2orth, boolean headsOnly) { | |
108 | + | |
109 | + Map<String, Set<String>> groups = new HashMap<String, Set<String>>(); | |
110 | + Set<String> singletons = new HashSet<String>(); | |
111 | + | |
112 | + XMLStreamReader sr = null; | |
113 | + try (InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "UTF-8")) { | |
114 | + | |
115 | + sr = factory.createXMLStreamReader(isr); | |
116 | + | |
117 | + while (sr.hasNext()) { | |
118 | + sr.next(); | |
119 | + if (sr.isStartElement()) { | |
120 | + if (sr.getName().equals(new QName("www.eml.org/NameSpaces/mention", "markable"))) { | |
121 | + String span = sr.getAttributeValue(null, "span"); | |
122 | + String head = sr.getAttributeValue(null, "mention_head"); | |
123 | + String mg = sr.getAttributeValue(null, "mention_group"); | |
124 | + | |
125 | + String id = ""; | |
126 | + | |
127 | + List<String> childIds = new ArrayList<>(); | |
128 | + for (String s : span.split(",")) { | |
129 | + String[] spl = s.split("\\.\\."); | |
130 | + String first = spl[0]; | |
131 | + String last = spl[spl.length - 1]; | |
132 | + | |
133 | + if (headsOnly) { | |
134 | + int start = ids.indexOf(first); | |
135 | + int end = ids.indexOf(last); | |
136 | + childIds.addAll(ids.subList(start, end + 1)); | |
137 | + } else { | |
138 | + id += id2start.get(first) + ".." + id2end.get(last) + "#"; | |
139 | + } | |
140 | + } | |
141 | + if (headsOnly) { | |
142 | + List<String> childOrths = new ArrayList<>(); | |
143 | + for (String chId : childIds) { | |
144 | + String orth = id2orth.get(chId); | |
145 | + childOrths.add(orth); | |
146 | + if (orth.equalsIgnoreCase(head)) { | |
147 | + id = chId; | |
148 | + break; | |
149 | + } | |
150 | + } | |
151 | + if (!childIds.contains(id)) { | |
152 | + logger.warn("Ignorning mention without head with id = " | |
153 | + + sr.getAttributeValue(null, "id") + " in file: " + file); | |
154 | + continue; | |
155 | + } | |
156 | + | |
157 | + } | |
158 | + | |
159 | + if (mg.equals("empty")) | |
160 | + singletons.add(id); | |
161 | + else { | |
162 | + if (!groups.containsKey(mg)) | |
163 | + groups.put(mg, new HashSet<String>()); | |
164 | + groups.get(mg).add(id); | |
165 | + } | |
166 | + } | |
167 | + } | |
168 | + } | |
169 | + } catch (Exception e) { | |
170 | + logger.error("Error reading mentions file:" + e); | |
171 | + } finally { | |
172 | + try { | |
173 | + if (sr != null) | |
174 | + sr.close(); | |
175 | + } catch (Exception e) { | |
176 | + logger.error("Error closing mentions file:" + e); | |
177 | + } | |
178 | + } | |
179 | + | |
180 | + // get rid of any mention added as singleton AND as in group | |
181 | + for (Set<String> mentionGroup : groups.values()) { | |
182 | + singletons.removeAll(mentionGroup); | |
183 | + } | |
184 | + | |
185 | + SingleTextAnnotationImpl anno = new SingleTextAnnotationImpl(file.getPath()); | |
186 | + for (String sing : singletons) | |
187 | + anno.addSingletons(sing); | |
188 | + for (Set<String> set : groups.values()) | |
189 | + anno.addMentionGroup(set.toArray(new String[0])); | |
190 | + | |
191 | + return anno; | |
192 | + } | |
193 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Reader.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Reader.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.readers; | |
2 | + | |
3 | +import java.io.File; | |
4 | + | |
5 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
6 | + | |
7 | +public interface Reader { | |
8 | + | |
9 | + public void loadAnnotationsFromDirs(File goldDir, File sysDir, AnnotationPair ann, boolean headsOnly, | |
10 | + boolean transform); | |
11 | + | |
12 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Tei.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/readers/Tei.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.readers; | |
2 | + | |
3 | +import ipipan.clarin.tei.api.entities.TEICoreference; | |
4 | +import ipipan.clarin.tei.api.entities.TEICorpusText; | |
5 | +import ipipan.clarin.tei.api.entities.TEIMention; | |
6 | +import ipipan.clarin.tei.api.entities.TEIMorph; | |
7 | +import ipipan.clarin.tei.api.entities.TEIParagraph; | |
8 | +import ipipan.clarin.tei.api.entities.TEISegment; | |
9 | +import ipipan.clarin.tei.api.entities.TEISentence; | |
10 | +import ipipan.clarin.tei.api.exceptions.TEIException; | |
11 | +import ipipan.clarin.tei.api.io.TEI_IO; | |
12 | + | |
13 | +import java.io.File; | |
14 | +import java.util.ArrayList; | |
15 | +import java.util.Arrays; | |
16 | +import java.util.Collections; | |
17 | +import java.util.HashMap; | |
18 | +import java.util.HashSet; | |
19 | +import java.util.List; | |
20 | +import java.util.Map; | |
21 | +import java.util.Set; | |
22 | + | |
23 | +import org.apache.log4j.Logger; | |
24 | + | |
25 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
26 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
27 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
28 | + | |
29 | +public class Tei implements Reader { | |
30 | + | |
31 | + private static final Logger logger = Logger.getLogger(Tei.class); | |
32 | + | |
33 | + public void loadAnnotationsFromDirs(File goldDir, File sysDir, AnnotationPair ann, boolean headsOnly, | |
34 | + boolean transform) { | |
35 | + | |
36 | + List<File> children = new ArrayList<File>(Arrays.asList(goldDir.listFiles())); | |
37 | + Collections.sort(children); | |
38 | + | |
39 | + for (File goldFile : children) { | |
40 | + File sysFile = new File(sysDir.getPath() + File.separator + goldFile.getName()); | |
41 | + if (sysFile.exists()) { | |
42 | + if (goldFile.isDirectory()) | |
43 | + loadAnnotationsFromDirs(goldFile, sysFile, ann, headsOnly, transform); | |
44 | + else if (goldFile.getName().matches("ann_coreference.xml(\\.gz)?")) | |
45 | + loadAnnotationsFrom2Files(goldFile.getParentFile(), sysFile.getParentFile(), ann, headsOnly, | |
46 | + transform); | |
47 | + } else if (goldFile.getName().matches("ann_coreference.xml(\\.gz)?")) { | |
48 | + logger.warn("No sys anno found for gold anno: " + goldFile); | |
49 | + } | |
50 | + } | |
51 | + } | |
52 | + | |
53 | + private static void loadAnnotationsFrom2Files(File goldDir, File sysDir, AnnotationPair ann, boolean headsOnly, | |
54 | + boolean transform) { | |
55 | + try { | |
56 | + SingleTextAnnotation goldAnno = getAnnotation(goldDir, headsOnly); | |
57 | + SingleTextAnnotation sysAnno = getAnnotation(sysDir, headsOnly); | |
58 | + ann.addPair(goldAnno, sysAnno, transform); | |
59 | + } catch (TEIException e) { | |
60 | + logger.error(e.getLocalizedMessage()); | |
61 | + } | |
62 | + | |
63 | + } | |
64 | + | |
65 | + private static SingleTextAnnotation getAnnotation(File dir, boolean headsOnly) throws TEIException { | |
66 | + | |
67 | + TEI_IO tei = TEI_IO.getInstance(); | |
68 | + TEICorpusText text = tei.readFromNKJPDirectory(dir); | |
69 | + | |
70 | + SingleTextAnnotationImpl anno = new SingleTextAnnotationImpl(dir.getPath()); | |
71 | + Set<String> zeroSubjectIds = new HashSet<>(); | |
72 | + | |
73 | + Map<String, Integer> parOffsets = getParOffsets(text); | |
74 | + | |
75 | + // distinct spans check | |
76 | + int skipped = 0; | |
77 | + Set<String> distinctSpans = new HashSet<>(); | |
78 | + for (TEISentence s : text.getAllSentences()) | |
79 | + for (TEIMention m : s.getAllMentions()) { | |
80 | + if (headsOnly) { | |
81 | + m.getMorphs().clear(); | |
82 | + m.getMorphs().addAll(m.getHeadMorphs()); | |
83 | + } | |
84 | + String span = getMentionId(m, parOffsets); | |
85 | + if (distinctSpans.contains(span)) { | |
86 | + logger.debug("Duplicate mention " + m.getId() + " in text " + dir.getName() | |
87 | + + ". A mention with exact same borders exists! Will be skipped for evaluation."); | |
88 | + skipped++; | |
89 | + } else { | |
90 | + distinctSpans.add(span); | |
91 | + } | |
92 | + } | |
93 | + | |
94 | + Set<String> alreadyAddedSpans = new HashSet<>(); | |
95 | + | |
96 | + // nonsingletons | |
97 | + int nonSingletons = 0; | |
98 | + for (TEICoreference cor : text.getAllCoreferences()) { | |
99 | + if (!cor.getType().equals("ident")) | |
100 | + continue; | |
101 | + | |
102 | + Set<String> ids = new HashSet<>(); | |
103 | + for (TEIMention m : cor.getMentions()) { | |
104 | + String span = getMentionId(m, parOffsets); | |
105 | + if (!alreadyAddedSpans.contains(span)) { | |
106 | + alreadyAddedSpans.add(span); | |
107 | + ids.add(span); | |
108 | + if (m.isZeroSubject()) | |
109 | + zeroSubjectIds.add(span); | |
110 | + nonSingletons++; | |
111 | + } | |
112 | + } | |
113 | + if (ids.size() > 0) | |
114 | + anno.addMentionGroup(ids.toArray(new String[0])); | |
115 | + } | |
116 | + | |
117 | + // singletons | |
118 | + int singletons = 0; | |
119 | + for (TEISentence s : text.getAllSentences()) | |
120 | + for (TEIMention m : s.getAllMentions()) { | |
121 | + String span = getMentionId(m, parOffsets); | |
122 | + if (!alreadyAddedSpans.contains(span)) { | |
123 | + alreadyAddedSpans.add(span); | |
124 | + anno.addSingletons(span); | |
125 | + singletons++; | |
126 | + if (m.isZeroSubject()) | |
127 | + zeroSubjectIds.add(span); | |
128 | + } | |
129 | + } | |
130 | + | |
131 | + anno.setZeroSubjectIds(zeroSubjectIds); | |
132 | + | |
133 | + logger.debug(nonSingletons + " non-singletons, " + singletons + " singletons, " + skipped | |
134 | + + " skipped duplicates in text " + dir.getName()); | |
135 | + | |
136 | + return anno; | |
137 | + } | |
138 | + | |
139 | + private static Map<String, Integer> getParOffsets(TEICorpusText text) { | |
140 | + Map<String, Integer> parOffsets = new HashMap<>(); | |
141 | + int parOffset = 0; | |
142 | + for (TEIParagraph par : text.getParagraphs()) { | |
143 | + parOffsets.put(par.getId(), parOffset); | |
144 | + for (TEIMorph m : par.getMorphs()) { | |
145 | + parOffset += m.getCorrespSegment().getLength() + 1; | |
146 | + if (m.hasNps()) | |
147 | + parOffset--; | |
148 | + } | |
149 | + } | |
150 | + return parOffsets; | |
151 | + } | |
152 | + | |
153 | + private static String getMentionId(TEIMention m, Map<String, Integer> parOffsets) { | |
154 | + StringBuffer id = new StringBuffer(); | |
155 | + for (TEIMorph morph : m.getMorphs()) { | |
156 | + TEISegment seg = morph.getCorrespSegment(); | |
157 | + int curparOffset = parOffsets.get(seg.getParagraph().getId()); | |
158 | + String morphId = (seg.getOffset() + curparOffset) + ":" + seg.getLength(); | |
159 | + id.append(morphId + "#"); | |
160 | + } | |
161 | + return id.toString(); | |
162 | + } | |
163 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/Scorer.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/Scorer.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
5 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
6 | + | |
7 | +public abstract class Scorer { | |
8 | + | |
9 | + public Result compare(AnnotationPair goldAndSys) { | |
10 | + Result totalResult = new Result(); | |
11 | + | |
12 | + for (int i = 0; i < goldAndSys.getTextCount(); i++) { | |
13 | + try { | |
14 | + | |
15 | + Result textResult = compare(goldAndSys.getGold(i), goldAndSys.getSys(i)); | |
16 | + | |
17 | + totalResult.add(textResult); | |
18 | + | |
19 | + } catch (Exception ex) { | |
20 | + System.out.println(this.getClass().getSimpleName() + " Error scoring text: " | |
21 | + + goldAndSys.getGold(i).getFilename()); | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + return totalResult; | |
26 | + } | |
27 | + | |
28 | + public abstract Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys); | |
29 | + | |
30 | + public String getName() { | |
31 | + return this.getClass().getSimpleName(); | |
32 | + } | |
33 | +} | |
0 | 34 | \ No newline at end of file |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerB3.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerB3.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import java.util.HashSet; | |
4 | +import java.util.Set; | |
5 | + | |
6 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
7 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
8 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
9 | + | |
10 | +public class ScorerB3 extends Scorer { | |
11 | + | |
12 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
13 | + | |
14 | + int mentionCount = 0; | |
15 | + double recallNominator = 0; | |
16 | + double precisionNominator = 0; | |
17 | + | |
18 | + for (Mention m : gold.getMentions()) { | |
19 | + mentionCount++; | |
20 | + Set<Mention> coreferentsGold = m.getMentionGroup().getMentions(); | |
21 | + Set<Mention> coreferentsSys = sys.getMention(m).getMentionGroup().getMentions(); | |
22 | + | |
23 | + Set<Mention> intersection = new HashSet<Mention>(coreferentsGold); | |
24 | + intersection.retainAll(coreferentsSys); | |
25 | + | |
26 | + recallNominator += 1.0 * intersection.size() / coreferentsGold.size(); | |
27 | + precisionNominator += 1.0 * intersection.size() / coreferentsSys.size(); | |
28 | + } | |
29 | + | |
30 | + return new Result(precisionNominator, mentionCount, recallNominator, mentionCount); | |
31 | + } | |
32 | + | |
33 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerBlanc.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerBlanc.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
7 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
8 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
9 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
10 | + | |
11 | +public class ScorerBlanc extends Scorer { | |
12 | + | |
13 | + public Result compare(AnnotationPair goldAndSys) { | |
14 | + Result totalCoref = new Result(); | |
15 | + Result totalNonCoref = new Result(); | |
16 | + | |
17 | + for (int i = 0; i < goldAndSys.getTextCount(); i++) { | |
18 | + int[] table = computeTable(goldAndSys.getGold(i), goldAndSys.getSys(i)); | |
19 | + int rc = table[0]; | |
20 | + int wc = table[1]; | |
21 | + int rn = table[2]; | |
22 | + int wn = table[3]; | |
23 | + | |
24 | + Result cr = new Result(rc, rc + wc, rc, rc + wn); | |
25 | + Result nr = new Result(rn, rn + wn, rn, rn + wc); | |
26 | + | |
27 | + totalCoref.add(cr); | |
28 | + totalNonCoref.add(nr); | |
29 | + } | |
30 | + | |
31 | + return computeResultFromTwo(totalCoref, totalNonCoref); | |
32 | + } | |
33 | + | |
34 | + private Result computeResultFromTwo(Result totalCoref, Result totalNonCoref) { | |
35 | + | |
36 | + double avgP = (totalCoref.getPrecision() + totalNonCoref.getPrecision()) / 2; | |
37 | + double avgR = (totalCoref.getRecall() + totalNonCoref.getRecall()) / 2; | |
38 | + double avgF1 = (totalCoref.getF1() + totalNonCoref.getF1()) / 2; | |
39 | + | |
40 | + return new Result(avgP, avgR, avgF1); | |
41 | + } | |
42 | + | |
43 | + public int[] computeTable(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
44 | + | |
45 | + int rc = 0; | |
46 | + int wc = 0; | |
47 | + int rn = 0; | |
48 | + int wn = 0; | |
49 | + | |
50 | + List<Mention> mentions = new ArrayList<Mention>(gold.getMentions()); | |
51 | + int mentionsCount = mentions.size(); | |
52 | + | |
53 | + for (int i = 0; i < mentionsCount - 1; i++) { | |
54 | + Mention m1 = mentions.get(i); | |
55 | + for (int j = i + 1; j < mentionsCount; j++) { | |
56 | + Mention m2 = mentions.get(j); | |
57 | + | |
58 | + boolean goldCoreferent = m1.getMentionGroup().getMentions().contains(m2); | |
59 | + boolean sysCoreferent = sys.getMention(m1).getMentionGroup().getMentions().contains(sys.getMention(m2)); | |
60 | + | |
61 | + if (goldCoreferent) { | |
62 | + if (sysCoreferent) { | |
63 | + rc++; // right coreference link | |
64 | + } else { | |
65 | + wn++; // wrong non-coreference link | |
66 | + } | |
67 | + } else { | |
68 | + if (sysCoreferent) { | |
69 | + wc++; // wrong coreference link | |
70 | + } else { | |
71 | + rn++; // right non-coreference link | |
72 | + } | |
73 | + } | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + int[] result = new int[4]; | |
78 | + result[0] = rc; | |
79 | + result[1] = wc; | |
80 | + result[2] = rn; | |
81 | + result[3] = wn; | |
82 | + | |
83 | + return result; | |
84 | + } | |
85 | + | |
86 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
87 | + | |
88 | + int rc = 0; | |
89 | + int wc = 0; | |
90 | + int rn = 0; | |
91 | + int wn = 0; | |
92 | + | |
93 | + List<Mention> mentions = new ArrayList<Mention>(gold.getMentions()); | |
94 | + int mentionsCount = mentions.size(); | |
95 | + | |
96 | + for (int i = 0; i < mentionsCount - 1; i++) { | |
97 | + Mention m1 = mentions.get(i); | |
98 | + for (int j = i + 1; j < mentionsCount; j++) { | |
99 | + Mention m2 = mentions.get(j); | |
100 | + | |
101 | + boolean goldCoreferent = m1.getMentionGroup().getMentions().contains(m2); | |
102 | + boolean sysCoreferent = sys.getMention(m1).getMentionGroup().getMentions().contains(sys.getMention(m2)); | |
103 | + | |
104 | + if (goldCoreferent) { | |
105 | + if (sysCoreferent) { | |
106 | + rc++; // right coreference link | |
107 | + } else { | |
108 | + wn++; // wrong non-coreference link | |
109 | + } | |
110 | + } else { | |
111 | + if (sysCoreferent) { | |
112 | + wc++; // wrong coreference link | |
113 | + } else { | |
114 | + rn++; // right non-coreference link | |
115 | + } | |
116 | + } | |
117 | + } | |
118 | + } | |
119 | + | |
120 | + Result cr = new Result(rc, rc + wc, rc, rc + wn); | |
121 | + Result nr = new Result(rn, rn + wn, rn, rn + wc); | |
122 | + | |
123 | + // handle border cases | |
124 | + | |
125 | + if (rc + wc == 0 || rc + wn == 0) | |
126 | + cr = new Result(0.0, 0.0, 0.0); | |
127 | + | |
128 | + if (rn + wn == 0 || rn + wc == 0) | |
129 | + nr = new Result(0.0, 0.0, 0.0); | |
130 | + | |
131 | + // perfect annotation | |
132 | + if (wc + wn == 0) | |
133 | + return new Result(1.0, 1.0, 1.0); | |
134 | + | |
135 | + // anti-perfect annotation | |
136 | + if (rc + rn == 0) | |
137 | + return new Result(0.0, 0.0, 0.0); | |
138 | + | |
139 | + // no coreference in gold | |
140 | + if (rc + wn == 0) | |
141 | + return nr; | |
142 | + | |
143 | + // only coreference in gold | |
144 | + if (rn + wc == 0) | |
145 | + return cr; | |
146 | + | |
147 | + return computeResultFromTwo(cr, nr); | |
148 | + } | |
149 | + | |
150 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeaf.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeaf.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +import pl.waw.ipipan.zil.core.scoreference.basic.MentionGroup; | |
9 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
10 | +import pl.waw.ipipan.zil.core.scoreference.utils.HungarianAlgorithm; | |
11 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
12 | + | |
13 | +public abstract class ScorerCeaf extends Scorer { | |
14 | + | |
15 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
16 | + | |
17 | + Map<MentionGroup, MentionGroup> mapping = getOptimalMapping(gold, sys); | |
18 | + | |
19 | + double recallDenominator = 0; | |
20 | + for (MentionGroup mg : gold.getMentionGroups()) | |
21 | + recallDenominator += getSimilarity(mg, mg); | |
22 | + | |
23 | + double precisionDenominator = 0; | |
24 | + for (MentionGroup mg : sys.getMentionGroups()) | |
25 | + precisionDenominator += getSimilarity(mg, mg); | |
26 | + | |
27 | + double nominator = 0; | |
28 | + for (MentionGroup mg : gold.getMentionGroups()) | |
29 | + if (mapping.containsKey(mg)) | |
30 | + nominator += getSimilarity(mg, mapping.get(mg)); | |
31 | + | |
32 | + return new Result(nominator, precisionDenominator, nominator, recallDenominator); | |
33 | + } | |
34 | + | |
35 | + private Map<MentionGroup, MentionGroup> getOptimalMapping(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
36 | + | |
37 | + List<MentionGroup> mgsGold = new ArrayList<MentionGroup>(gold.getMentionGroups()); | |
38 | + List<MentionGroup> mgsSys = new ArrayList<MentionGroup>(sys.getMentionGroups()); | |
39 | + | |
40 | + boolean transposed = mgsGold.size() > mgsSys.size(); | |
41 | + double[][] array = new double[mgsGold.size()][mgsSys.size()]; | |
42 | + int i = 0; | |
43 | + for (MentionGroup mgGold : mgsGold) { | |
44 | + int j = 0; | |
45 | + for (MentionGroup mgSys : mgsSys) { | |
46 | + | |
47 | + array[i][j] = getSimilarity(mgGold, mgSys); | |
48 | + j++; | |
49 | + } | |
50 | + i++; | |
51 | + } | |
52 | + if (transposed) { | |
53 | + array = HungarianAlgorithm.transpose(array); | |
54 | + } | |
55 | + | |
56 | + int[][] assignment = new int[array.length][2]; | |
57 | + assignment = HungarianAlgorithm.hgAlgorithm(array, "max"); | |
58 | + | |
59 | + // decode the assignment | |
60 | + Map<MentionGroup, MentionGroup> mapping = new HashMap<MentionGroup, MentionGroup>(); | |
61 | + for (int n = 0; n < assignment.length; n++) { | |
62 | + if (transposed) | |
63 | + mapping.put(mgsGold.get(assignment[n][1]), mgsSys.get(assignment[n][0])); | |
64 | + else | |
65 | + mapping.put(mgsGold.get(assignment[n][0]), mgsSys.get(assignment[n][1])); | |
66 | + } | |
67 | + | |
68 | + return mapping; | |
69 | + } | |
70 | + | |
71 | + protected abstract double getSimilarity(MentionGroup mg, MentionGroup mg2); | |
72 | + | |
73 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafe.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafe.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.basic.MentionGroup; | |
5 | + | |
6 | +public class ScorerCeafe extends ScorerCeaf { | |
7 | + | |
8 | + protected double getSimilarity(MentionGroup mg, MentionGroup mg2) { | |
9 | + int nominator = 0; | |
10 | + for (Mention m : mg.getMentions()) { | |
11 | + if (mg2.getMentions().contains(m)) | |
12 | + nominator++; | |
13 | + } | |
14 | + return 2.0 * nominator / (mg.getMentions().size() + mg2.getMentions().size()); | |
15 | + } | |
16 | + | |
17 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafm.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafm.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.basic.MentionGroup; | |
5 | + | |
6 | +public class ScorerCeafm extends ScorerCeaf { | |
7 | + | |
8 | + protected double getSimilarity(MentionGroup mg, MentionGroup mg2) { | |
9 | + int nominator = 0; | |
10 | + for (Mention m : mg.getMentions()) { | |
11 | + if (mg2.getMentions().contains(m)) | |
12 | + nominator++; | |
13 | + } | |
14 | + return nominator; | |
15 | + } | |
16 | + | |
17 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerF1.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerF1.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
5 | + | |
6 | +public class ScorerF1 extends Scorer { | |
7 | + | |
8 | + @Override | |
9 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
10 | + // TODO Auto-generated method stub | |
11 | + return null; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerH.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerH.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
5 | + | |
6 | +public class ScorerH extends Scorer { | |
7 | + | |
8 | + @Override | |
9 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
10 | + // TODO Auto-generated method stub | |
11 | + return null; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerMuc.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerMuc.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import java.util.HashSet; | |
4 | +import java.util.Set; | |
5 | + | |
6 | +import pl.waw.ipipan.zil.core.scoreference.basic.Mention; | |
7 | +import pl.waw.ipipan.zil.core.scoreference.basic.MentionGroup; | |
8 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
9 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
10 | + | |
11 | +public class ScorerMuc extends Scorer { | |
12 | + | |
13 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
14 | + | |
15 | + Pair recall = calculatePorR(gold, sys); | |
16 | + Pair precision = calculatePorR(sys, gold); | |
17 | + | |
18 | + return new Result(precision.getNominator(), precision.getDenominator(), recall.getNominator(), | |
19 | + recall.getDenominator()); | |
20 | + } | |
21 | + | |
22 | + private Pair calculatePorR(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
23 | + | |
24 | + int nominator = 0; | |
25 | + int denominator = 0; | |
26 | + | |
27 | + for (MentionGroup mg : gold.getMentionGroups()) { | |
28 | + int mgSize = mg.getMentions().size(); | |
29 | + nominator += mgSize - getNumberOfGroupsForMentions(mg.getMentions(), sys); | |
30 | + denominator += mgSize - 1; | |
31 | + } | |
32 | + | |
33 | + return new Pair(nominator, denominator); | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * Calculates the number of different mention groups, to which given | |
38 | + * mentions belong regarding given annotation. | |
39 | + * | |
40 | + * @param mentions | |
41 | + * @param annotation | |
42 | + * @return | |
43 | + */ | |
44 | + private int getNumberOfGroupsForMentions(Set<Mention> mentions, SingleTextAnnotation annotation) { | |
45 | + Set<MentionGroup> groups = new HashSet<MentionGroup>(); | |
46 | + for (Mention m : mentions) { | |
47 | + Mention correspMention = annotation.getMention(m); | |
48 | + if (correspMention == null) | |
49 | + System.out.println("Problem with mention " + m.getId()); | |
50 | + | |
51 | + groups.add(correspMention.getMentionGroup()); | |
52 | + } | |
53 | + | |
54 | + return groups.size(); | |
55 | + } | |
56 | + | |
57 | + private class Pair { | |
58 | + | |
59 | + private double denominator; | |
60 | + private double nominator; | |
61 | + | |
62 | + public Pair(double nominator, double denominator) { | |
63 | + this.nominator = nominator; | |
64 | + this.denominator = denominator; | |
65 | + } | |
66 | + | |
67 | + public double getDenominator() { | |
68 | + return denominator; | |
69 | + } | |
70 | + | |
71 | + public double getNominator() { | |
72 | + return nominator; | |
73 | + } | |
74 | + } | |
75 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerRand.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerRand.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
4 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
5 | + | |
6 | +public class ScorerRand extends Scorer { | |
7 | + | |
8 | + @Override | |
9 | + public Result compare(SingleTextAnnotation gold, SingleTextAnnotation sys) { | |
10 | + // TODO Auto-generated method stub | |
11 | + return null; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/HungarianAlgorithm.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/HungarianAlgorithm.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.utils; | |
2 | + | |
3 | +/* | |
4 | + * Created on Apr 25, 2005 | |
5 | + * | |
6 | + * Munkres-Kuhn (Hungarian) Algorithm Clean Version: 0.11 | |
7 | + * | |
8 | + * Konstantinos A. Nedas | |
9 | + * Department of Spatial Information Science & Engineering | |
10 | + * University of Maine, Orono, ME 04469-5711, USA | |
11 | + * kostas@spatial.maine.edu | |
12 | + * http://www.spatial.maine.edu/~kostas | |
13 | + * | |
14 | + * This Java class implements the Hungarian algorithm [a.k.a Munkres' algorithm, | |
15 | + * a.k.a. Kuhn algorithm, a.k.a. Assignment problem, a.k.a. Marriage problem, | |
16 | + * a.k.a. Maximum Weighted Maximum Cardinality Bipartite Matching]. | |
17 | + * | |
18 | + * [It can be used as a method call from within any main (or other function).] | |
19 | + * It takes 2 arguments: | |
20 | + * a. A 2-D array (could be rectangular or square). | |
21 | + * b. A string ("min" or "max") specifying whether you want the min or max assignment. | |
22 | + * [It returns an assignment matrix[array.length][2] that contains the row and col of | |
23 | + * the elements (in the original inputted array) that make up the optimum assignment.] | |
24 | + * | |
25 | + * [This version contains only scarce comments. If you want to understand the | |
26 | + * inner workings of the algorithm, get the tutorial version of the algorithm | |
27 | + * from the same website you got this one (http://www.spatial.maine.edu/~kostas/dev/soft/munkres.htm)] | |
28 | + * | |
29 | + * Any comments, corrections, or additions would be much appreciated. | |
30 | + * Credit due to professor Bob Pilgrim for providing an online copy of the | |
31 | + * pseudocode for this algorithm (http://216.249.163.93/bob.pilgrim/445/munkres.html) | |
32 | + * | |
33 | + * Feel free to redistribute this source code, as long as this header--with | |
34 | + * the exception of sections in brackets--remains as part of the file. | |
35 | + * | |
36 | + * Requirements: JDK 1.5.0_01 or better. | |
37 | + * [Created in Eclipse 3.1M6 (www.eclipse.org).] | |
38 | + * | |
39 | + */ | |
40 | + | |
41 | +import static java.lang.Math.floor; | |
42 | +import static java.lang.Math.round; | |
43 | + | |
44 | +import java.util.Random; | |
45 | +import java.util.Scanner; | |
46 | + | |
47 | +public class HungarianAlgorithm { | |
48 | + | |
49 | + // ********************************// | |
50 | + // METHODS FOR CONSOLE INPUT-OUTPUT// | |
51 | + // ********************************// | |
52 | + | |
53 | + public static int readInput(String prompt) // Reads input,returns double. | |
54 | + { | |
55 | + Scanner in = new Scanner(System.in); | |
56 | + System.out.print(prompt); | |
57 | + int input = in.nextInt(); | |
58 | + in.close(); | |
59 | + return input; | |
60 | + } | |
61 | + | |
62 | + public static void printTime(double time) // Formats time output. | |
63 | + { | |
64 | + String timeElapsed = ""; | |
65 | + int days = (int) floor(time) / (24 * 3600); | |
66 | + int hours = (int) floor(time % (24 * 3600)) / (3600); | |
67 | + int minutes = (int) floor((time % 3600) / 60); | |
68 | + int seconds = (int) round(time % 60); | |
69 | + | |
70 | + if (days > 0) | |
71 | + timeElapsed = Integer.toString(days) + "d:"; | |
72 | + if (hours > 0) | |
73 | + timeElapsed = timeElapsed + Integer.toString(hours) + "h:"; | |
74 | + if (minutes > 0) | |
75 | + timeElapsed = timeElapsed + Integer.toString(minutes) + "m:"; | |
76 | + | |
77 | + timeElapsed = timeElapsed + Integer.toString(seconds) + "s"; | |
78 | + System.out.print("\nTotal time required: " + timeElapsed + "\n\n"); | |
79 | + } | |
80 | + | |
81 | + // *******************************************// | |
82 | + // METHODS THAT PERFORM ARRAY-PROCESSING TASKS// | |
83 | + // *******************************************// | |
84 | + | |
85 | + public static void generateRandomArray // Generates random 2-D array. | |
86 | + (double[][] array, String randomMethod) { | |
87 | + Random generator = new Random(); | |
88 | + for (int i = 0; i < array.length; i++) { | |
89 | + for (int j = 0; j < array[i].length; j++) { | |
90 | + if (randomMethod.equals("random")) { | |
91 | + array[i][j] = generator.nextDouble(); | |
92 | + } | |
93 | + if (randomMethod.equals("gaussian")) { | |
94 | + array[i][j] = generator.nextGaussian() / 4; // range length | |
95 | + // to 1. | |
96 | + if (array[i][j] > 0.5) { | |
97 | + array[i][j] = 0.5; | |
98 | + } // eliminate outliers. | |
99 | + if (array[i][j] < -0.5) { | |
100 | + array[i][j] = -0.5; | |
101 | + } // eliminate outliers. | |
102 | + array[i][j] = array[i][j] + 0.5; // make elements positive. | |
103 | + } | |
104 | + } | |
105 | + } | |
106 | + } | |
107 | + | |
108 | + public static double findLargest // Finds the largest element in a positive | |
109 | + // array. | |
110 | + (double[][] array) | |
111 | + // works for arrays where all values are >= 0. | |
112 | + { | |
113 | + double largest = 0; | |
114 | + for (int i = 0; i < array.length; i++) { | |
115 | + for (int j = 0; j < array[i].length; j++) { | |
116 | + if (array[i][j] > largest) { | |
117 | + largest = array[i][j]; | |
118 | + } | |
119 | + } | |
120 | + } | |
121 | + | |
122 | + return largest; | |
123 | + } | |
124 | + | |
125 | + public static double[][] transpose // Transposes a double[][] array. | |
126 | + (double[][] array) { | |
127 | + double[][] transposedArray = new double[array[0].length][array.length]; | |
128 | + for (int i = 0; i < transposedArray.length; i++) { | |
129 | + for (int j = 0; j < transposedArray[i].length; j++) { | |
130 | + transposedArray[i][j] = array[j][i]; | |
131 | + } | |
132 | + } | |
133 | + return transposedArray; | |
134 | + } | |
135 | + | |
136 | + public static double[][] copyOf // Copies all elements of an array to a new | |
137 | + // array. | |
138 | + (double[][] original) { | |
139 | + double[][] copy = new double[original.length][original[0].length]; | |
140 | + for (int i = 0; i < original.length; i++) { | |
141 | + // Need to do it this way, otherwise it copies only memory location | |
142 | + System.arraycopy(original[i], 0, copy[i], 0, original[i].length); | |
143 | + } | |
144 | + | |
145 | + return copy; | |
146 | + } | |
147 | + | |
148 | + // **********************************// | |
149 | + // METHODS OF THE HUNGARIAN ALGORITHM// | |
150 | + // **********************************// | |
151 | + | |
152 | + public static int[][] hgAlgorithm(double[][] array, String sumType) { | |
153 | + double[][] cost = copyOf(array); // Create the cost matrix | |
154 | + | |
155 | + if (sumType.equalsIgnoreCase("max")) // Then array is weight array. Must | |
156 | + // change to cost. | |
157 | + { | |
158 | + double maxWeight = findLargest(cost); | |
159 | + for (int i = 0; i < cost.length; i++) // Generate cost by | |
160 | + // subtracting. | |
161 | + { | |
162 | + for (int j = 0; j < cost[i].length; j++) { | |
163 | + cost[i][j] = (maxWeight - cost[i][j]); | |
164 | + } | |
165 | + } | |
166 | + } | |
167 | + double maxCost = findLargest(cost); // Find largest cost matrix element | |
168 | + // (needed for step 6). | |
169 | + | |
170 | + int[][] mask = new int[cost.length][cost[0].length]; // The mask array. | |
171 | + int[] rowCover = new int[cost.length]; // The row covering vector. | |
172 | + int[] colCover = new int[cost[0].length]; // The column covering vector. | |
173 | + int[] zero_RC = new int[2]; // Position of last zero from Step 4. | |
174 | + int step = 1; | |
175 | + boolean done = false; | |
176 | + while (done == false) // main execution loop | |
177 | + { | |
178 | + switch (step) { | |
179 | + case 1: | |
180 | + step = hg_step1(step, cost); | |
181 | + break; | |
182 | + case 2: | |
183 | + step = hg_step2(step, cost, mask, rowCover, colCover); | |
184 | + break; | |
185 | + case 3: | |
186 | + step = hg_step3(step, mask, colCover); | |
187 | + break; | |
188 | + case 4: | |
189 | + step = hg_step4(step, cost, mask, rowCover, colCover, zero_RC); | |
190 | + break; | |
191 | + case 5: | |
192 | + step = hg_step5(step, mask, rowCover, colCover, zero_RC); | |
193 | + break; | |
194 | + case 6: | |
195 | + step = hg_step6(step, cost, rowCover, colCover, maxCost); | |
196 | + break; | |
197 | + case 7: | |
198 | + done = true; | |
199 | + break; | |
200 | + } | |
201 | + }// end while | |
202 | + | |
203 | + int[][] assignment = new int[array.length][2]; // Create the returned | |
204 | + // array. | |
205 | + for (int i = 0; i < mask.length; i++) { | |
206 | + for (int j = 0; j < mask[i].length; j++) { | |
207 | + if (mask[i][j] == 1) { | |
208 | + assignment[i][0] = i; | |
209 | + assignment[i][1] = j; | |
210 | + } | |
211 | + } | |
212 | + } | |
213 | + | |
214 | + // If you want to return the min or max sum, in your own main method | |
215 | + // instead of the assignment array, then use the following code: | |
216 | + /* | |
217 | + * double sum = 0; for (int i=0; i<assignment.length; i++) { sum = sum + | |
218 | + * array[assignment[i][0]][assignment[i][1]]; } return sum; | |
219 | + */ | |
220 | + // Of course you must also change the header of the method to: | |
221 | + // public static double hgAlgorithm (double[][] array, String sumType) | |
222 | + | |
223 | + return assignment; | |
224 | + } | |
225 | + | |
226 | + public static int hg_step1(int step, double[][] cost) { | |
227 | + // What STEP 1 does: | |
228 | + // For each row of the cost matrix, find the smallest element | |
229 | + // and subtract it from from every other element in its row. | |
230 | + | |
231 | + double minval; | |
232 | + | |
233 | + for (int i = 0; i < cost.length; i++) { | |
234 | + minval = cost[i][0]; | |
235 | + for (int j = 0; j < cost[i].length; j++) // 1st inner loop finds min | |
236 | + // val in row. | |
237 | + { | |
238 | + if (minval > cost[i][j]) { | |
239 | + minval = cost[i][j]; | |
240 | + } | |
241 | + } | |
242 | + for (int j = 0; j < cost[i].length; j++) // 2nd inner loop subtracts | |
243 | + // it. | |
244 | + { | |
245 | + cost[i][j] = cost[i][j] - minval; | |
246 | + } | |
247 | + } | |
248 | + | |
249 | + step = 2; | |
250 | + return step; | |
251 | + } | |
252 | + | |
253 | + public static int hg_step2(int step, double[][] cost, int[][] mask, int[] rowCover, int[] colCover) { | |
254 | + // What STEP 2 does: | |
255 | + // Marks uncovered zeros as starred and covers their row and column. | |
256 | + | |
257 | + for (int i = 0; i < cost.length; i++) { | |
258 | + for (int j = 0; j < cost[i].length; j++) { | |
259 | + if ((cost[i][j] == 0) && (colCover[j] == 0) && (rowCover[i] == 0)) { | |
260 | + mask[i][j] = 1; | |
261 | + colCover[j] = 1; | |
262 | + rowCover[i] = 1; | |
263 | + } | |
264 | + } | |
265 | + } | |
266 | + | |
267 | + clearCovers(rowCover, colCover); // Reset cover vectors. | |
268 | + | |
269 | + step = 3; | |
270 | + return step; | |
271 | + } | |
272 | + | |
273 | + public static int hg_step3(int step, int[][] mask, int[] colCover) { | |
274 | + // What STEP 3 does: | |
275 | + // Cover columns of starred zeros. Check if all columns are covered. | |
276 | + | |
277 | + for (int i = 0; i < mask.length; i++) // Cover columns of starred zeros. | |
278 | + { | |
279 | + for (int j = 0; j < mask[i].length; j++) { | |
280 | + if (mask[i][j] == 1) { | |
281 | + colCover[j] = 1; | |
282 | + } | |
283 | + } | |
284 | + } | |
285 | + | |
286 | + int count = 0; | |
287 | + for (int j = 0; j < colCover.length; j++) // Check if all columns are | |
288 | + // covered. | |
289 | + { | |
290 | + count = count + colCover[j]; | |
291 | + } | |
292 | + | |
293 | + if (count >= mask.length) // Should be cost.length but ok, because mask | |
294 | + // has same dimensions. | |
295 | + { | |
296 | + step = 7; | |
297 | + } else { | |
298 | + step = 4; | |
299 | + } | |
300 | + | |
301 | + return step; | |
302 | + } | |
303 | + | |
304 | + public static int hg_step4(int step, double[][] cost, int[][] mask, int[] rowCover, int[] colCover, int[] zero_RC) { | |
305 | + // What STEP 4 does: | |
306 | + // Find an uncovered zero in cost and prime it (if none go to step 6). | |
307 | + // Check for star in same row: | |
308 | + // if yes, cover the row and uncover the star's column. Repeat until no | |
309 | + // uncovered zeros are left | |
310 | + // and go to step 6. If not, save location of primed zero and go to step | |
311 | + // 5. | |
312 | + | |
313 | + int[] row_col = new int[2]; // Holds row and col of uncovered zero. | |
314 | + boolean done = false; | |
315 | + while (done == false) { | |
316 | + row_col = findUncoveredZero(row_col, cost, rowCover, colCover); | |
317 | + if (row_col[0] == -1) { | |
318 | + done = true; | |
319 | + step = 6; | |
320 | + } else { | |
321 | + mask[row_col[0]][row_col[1]] = 2; // Prime the found uncovered | |
322 | + // zero. | |
323 | + | |
324 | + boolean starInRow = false; | |
325 | + for (int j = 0; j < mask[row_col[0]].length; j++) { | |
326 | + if (mask[row_col[0]][j] == 1) // If there is a star in the | |
327 | + // same row... | |
328 | + { | |
329 | + starInRow = true; | |
330 | + row_col[1] = j; // remember its column. | |
331 | + } | |
332 | + } | |
333 | + | |
334 | + if (starInRow == true) { | |
335 | + rowCover[row_col[0]] = 1; // Cover the star's row. | |
336 | + colCover[row_col[1]] = 0; // Uncover its column. | |
337 | + } else { | |
338 | + zero_RC[0] = row_col[0]; // Save row of primed zero. | |
339 | + zero_RC[1] = row_col[1]; // Save column of primed zero. | |
340 | + done = true; | |
341 | + step = 5; | |
342 | + } | |
343 | + } | |
344 | + } | |
345 | + | |
346 | + return step; | |
347 | + } | |
348 | + | |
349 | + public static int[] findUncoveredZero // Aux 1 for hg_step4. | |
350 | + (int[] row_col, double[][] cost, int[] rowCover, int[] colCover) { | |
351 | + row_col[0] = -1; // Just a check value. Not a real index. | |
352 | + row_col[1] = 0; | |
353 | + | |
354 | + int i = 0; | |
355 | + boolean done = false; | |
356 | + while (done == false) { | |
357 | + int j = 0; | |
358 | + while (j < cost[i].length) { | |
359 | + if (cost[i][j] == 0 && rowCover[i] == 0 && colCover[j] == 0) { | |
360 | + row_col[0] = i; | |
361 | + row_col[1] = j; | |
362 | + done = true; | |
363 | + } | |
364 | + j = j + 1; | |
365 | + }// end inner while | |
366 | + i = i + 1; | |
367 | + if (i >= cost.length) { | |
368 | + done = true; | |
369 | + } | |
370 | + }// end outer while | |
371 | + | |
372 | + return row_col; | |
373 | + } | |
374 | + | |
375 | + public static int hg_step5(int step, int[][] mask, int[] rowCover, int[] colCover, int[] zero_RC) { | |
376 | + // What STEP 5 does: | |
377 | + // Construct series of alternating primes and stars. Start with prime | |
378 | + // from step 4. | |
379 | + // Take star in the same column. Next take prime in the same row as the | |
380 | + // star. Finish | |
381 | + // at a prime with no star in its column. Unstar all stars and star the | |
382 | + // primes of the | |
383 | + // series. Erasy any other primes. Reset covers. Go to step 3. | |
384 | + | |
385 | + int count = 0; // Counts rows of the path matrix. | |
386 | + int[][] path = new int[(mask[0].length * mask.length)][2]; // Path | |
387 | + // matrix | |
388 | + // (stores | |
389 | + // row and | |
390 | + // col). | |
391 | + path[count][0] = zero_RC[0]; // Row of last prime. | |
392 | + path[count][1] = zero_RC[1]; // Column of last prime. | |
393 | + | |
394 | + boolean done = false; | |
395 | + while (done == false) { | |
396 | + int r = findStarInCol(mask, path[count][1]); | |
397 | + if (r >= 0) { | |
398 | + count = count + 1; | |
399 | + path[count][0] = r; // Row of starred zero. | |
400 | + path[count][1] = path[count - 1][1]; // Column of starred zero. | |
401 | + } else { | |
402 | + done = true; | |
403 | + } | |
404 | + | |
405 | + if (done == false) { | |
406 | + int c = findPrimeInRow(mask, path[count][0]); | |
407 | + count = count + 1; | |
408 | + path[count][0] = path[count - 1][0]; // Row of primed zero. | |
409 | + path[count][1] = c; // Col of primed zero. | |
410 | + } | |
411 | + }// end while | |
412 | + | |
413 | + convertPath(mask, path, count); | |
414 | + clearCovers(rowCover, colCover); | |
415 | + erasePrimes(mask); | |
416 | + | |
417 | + step = 3; | |
418 | + return step; | |
419 | + | |
420 | + } | |
421 | + | |
422 | + public static int findStarInCol // Aux 1 for hg_step5. | |
423 | + (int[][] mask, int col) { | |
424 | + int r = -1; // Again this is a check value. | |
425 | + for (int i = 0; i < mask.length; i++) { | |
426 | + if (mask[i][col] == 1) { | |
427 | + r = i; | |
428 | + } | |
429 | + } | |
430 | + | |
431 | + return r; | |
432 | + } | |
433 | + | |
434 | + public static int findPrimeInRow // Aux 2 for hg_step5. | |
435 | + (int[][] mask, int row) { | |
436 | + int c = -1; | |
437 | + for (int j = 0; j < mask[row].length; j++) { | |
438 | + if (mask[row][j] == 2) { | |
439 | + c = j; | |
440 | + } | |
441 | + } | |
442 | + | |
443 | + return c; | |
444 | + } | |
445 | + | |
446 | + public static void convertPath // Aux 3 for hg_step5. | |
447 | + (int[][] mask, int[][] path, int count) { | |
448 | + for (int i = 0; i <= count; i++) { | |
449 | + if (mask[(path[i][0])][(path[i][1])] == 1) { | |
450 | + mask[(path[i][0])][(path[i][1])] = 0; | |
451 | + } else { | |
452 | + mask[(path[i][0])][(path[i][1])] = 1; | |
453 | + } | |
454 | + } | |
455 | + } | |
456 | + | |
457 | + public static void erasePrimes // Aux 4 for hg_step5. | |
458 | + (int[][] mask) { | |
459 | + for (int i = 0; i < mask.length; i++) { | |
460 | + for (int j = 0; j < mask[i].length; j++) { | |
461 | + if (mask[i][j] == 2) { | |
462 | + mask[i][j] = 0; | |
463 | + } | |
464 | + } | |
465 | + } | |
466 | + } | |
467 | + | |
468 | + public static void clearCovers // Aux 5 for hg_step5 (and not only). | |
469 | + (int[] rowCover, int[] colCover) { | |
470 | + for (int i = 0; i < rowCover.length; i++) { | |
471 | + rowCover[i] = 0; | |
472 | + } | |
473 | + for (int j = 0; j < colCover.length; j++) { | |
474 | + colCover[j] = 0; | |
475 | + } | |
476 | + } | |
477 | + | |
478 | + public static int hg_step6(int step, double[][] cost, int[] rowCover, int[] colCover, double maxCost) { | |
479 | + // What STEP 6 does: | |
480 | + // Find smallest uncovered value in cost: a. Add it to every element of | |
481 | + // covered rows | |
482 | + // b. Subtract it from every element of uncovered columns. Go to step 4. | |
483 | + | |
484 | + double minval = findSmallest(cost, rowCover, colCover, maxCost); | |
485 | + | |
486 | + for (int i = 0; i < rowCover.length; i++) { | |
487 | + for (int j = 0; j < colCover.length; j++) { | |
488 | + if (rowCover[i] == 1) { | |
489 | + cost[i][j] = cost[i][j] + minval; | |
490 | + } | |
491 | + if (colCover[j] == 0) { | |
492 | + cost[i][j] = cost[i][j] - minval; | |
493 | + } | |
494 | + } | |
495 | + } | |
496 | + | |
497 | + step = 4; | |
498 | + return step; | |
499 | + } | |
500 | + | |
501 | + public static double findSmallest // Aux 1 for hg_step6. | |
502 | + (double[][] cost, int[] rowCover, int[] colCover, double maxCost) { | |
503 | + double minval = maxCost; // There cannot be a larger cost than this. | |
504 | + for (int i = 0; i < cost.length; i++) // Now find the smallest uncovered | |
505 | + // value. | |
506 | + { | |
507 | + for (int j = 0; j < cost[i].length; j++) { | |
508 | + if (rowCover[i] == 0 && colCover[j] == 0 && (minval > cost[i][j])) { | |
509 | + minval = cost[i][j]; | |
510 | + } | |
511 | + } | |
512 | + } | |
513 | + | |
514 | + return minval; | |
515 | + } | |
516 | + | |
517 | + // ***********// | |
518 | + // MAIN METHOD// | |
519 | + // ***********// | |
520 | + | |
521 | + public static void main(String[] args) { | |
522 | + // Below enter "max" or "min" to find maximum sum or minimum sum | |
523 | + // assignment. | |
524 | + String sumType = "max"; | |
525 | + | |
526 | + // Hard-coded example. | |
527 | + // double[][] array = | |
528 | + // { | |
529 | + // {1, 2, 3}, | |
530 | + // {2, 4, 6}, | |
531 | + // {3, 6, 9} | |
532 | + // }; | |
533 | + | |
534 | + // <UNCOMMENT> BELOW AND COMMENT BLOCK ABOVE TO USE A RANDOMLY GENERATED | |
535 | + // MATRIX | |
536 | + int numOfRows = readInput("How many rows for the matrix? "); | |
537 | + int numOfCols = readInput("How many columns for the matrix? "); | |
538 | + double[][] array = new double[numOfRows][numOfCols]; | |
539 | + generateRandomArray(array, "random"); // All elements within [0,1]. | |
540 | + // </UNCOMMENT> | |
541 | + | |
542 | + if (array.length > array[0].length) { | |
543 | + System.out.println("Array transposed (because rows>columns).\n"); // Cols | |
544 | + // must | |
545 | + // be | |
546 | + // >= | |
547 | + // Rows. | |
548 | + array = transpose(array); | |
549 | + } | |
550 | + | |
551 | + // <COMMENT> TO AVOID PRINTING THE MATRIX FOR WHICH THE ASSIGNMENT IS | |
552 | + // CALCULATED | |
553 | + System.out.println("\n(Printing out only 2 decimals)\n"); | |
554 | + System.out.println("The matrix is:"); | |
555 | + for (int i = 0; i < array.length; i++) { | |
556 | + for (int j = 0; j < array[i].length; j++) { | |
557 | + System.out.printf("%.2f\t", array[i][j]); | |
558 | + } | |
559 | + System.out.println(); | |
560 | + } | |
561 | + System.out.println(); | |
562 | + // </COMMENT>*/ | |
563 | + | |
564 | + double startTime = System.nanoTime(); | |
565 | + int[][] assignment = new int[array.length][2]; | |
566 | + assignment = hgAlgorithm(array, sumType); // Call Hungarian algorithm. | |
567 | + double endTime = System.nanoTime(); | |
568 | + | |
569 | + System.out.println("The winning assignment (" + sumType + " sum) is:\n"); | |
570 | + double sum = 0; | |
571 | + for (int i = 0; i < assignment.length; i++) { | |
572 | + // <COMMENT> to avoid printing the elements that make up the | |
573 | + // assignment | |
574 | + System.out.printf("array(%d,%d) = %.2f\n", (assignment[i][0] + 1), (assignment[i][1] + 1), | |
575 | + array[assignment[i][0]][assignment[i][1]]); | |
576 | + sum = sum + array[assignment[i][0]][assignment[i][1]]; | |
577 | + // </COMMENT> | |
578 | + } | |
579 | + | |
580 | + System.out.printf("\nThe %s is: %.2f\n", sumType, sum); | |
581 | + printTime((endTime - startTime) / 1000000000.0); | |
582 | + | |
583 | + } | |
584 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/Result.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/Result.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.utils; | |
2 | + | |
3 | +public class Result { | |
4 | + | |
5 | + private Double precisionNominator = 0.0; | |
6 | + private Double precisionDenominator = 0.0; | |
7 | + private Double recallNominator = 0.0; | |
8 | + private Double recallDenominator = 0.0; | |
9 | + | |
10 | + private Double precision = null; | |
11 | + private Double recall = null; | |
12 | + private Double f1 = null; | |
13 | + | |
14 | + public Result(double precisionNominator, double precisionDenominator, double recallNominator, | |
15 | + double recallDenominator) { | |
16 | + this.precisionNominator = precisionNominator; | |
17 | + this.precisionDenominator = precisionDenominator; | |
18 | + this.recallNominator = recallNominator; | |
19 | + this.recallDenominator = recallDenominator; | |
20 | + } | |
21 | + | |
22 | + public Result() { | |
23 | + } | |
24 | + | |
25 | + public Result(double p, double r) { | |
26 | + this.precisionNominator = p; | |
27 | + this.recallNominator = r; | |
28 | + this.precisionDenominator = 1.0; | |
29 | + this.recallDenominator = 1.0; | |
30 | + } | |
31 | + | |
32 | + public Result(double avgP, double avgR, double avgF1) { | |
33 | + this.precision = avgP; | |
34 | + this.recall = avgR; | |
35 | + this.f1 = avgF1; | |
36 | + } | |
37 | + | |
38 | + public double getPrecision() { | |
39 | + if (precision != null) | |
40 | + return precision; | |
41 | + return precisionNominator / precisionDenominator; | |
42 | + } | |
43 | + | |
44 | + public double getRecall() { | |
45 | + if (recall != null) | |
46 | + return recall; | |
47 | + return recallNominator / recallDenominator; | |
48 | + } | |
49 | + | |
50 | + public String getPrecisionString() { | |
51 | + return precisionNominator + "/" + precisionDenominator; | |
52 | + } | |
53 | + | |
54 | + public String getRecallString() { | |
55 | + return recallNominator + "/" + recallDenominator; | |
56 | + } | |
57 | + | |
58 | + public double getF1() { | |
59 | + if (f1 != null) | |
60 | + return f1; | |
61 | + double recall = getRecall(); | |
62 | + double precision = getPrecision(); | |
63 | + return (recall + precision) == 0 ? 0 : 2 * precision * recall / (recall + precision); | |
64 | + } | |
65 | + | |
66 | + @Override | |
67 | + public String toString() { | |
68 | + String precLine = "Precision: " + getPrecision() + "\n"; | |
69 | + String recLine = "Recall: " + getRecall() + "\n"; | |
70 | + return precLine + recLine + "F1: " + getF1(); | |
71 | + } | |
72 | + | |
73 | + public void add(Result textResult) { | |
74 | + this.precisionDenominator += textResult.precisionDenominator; | |
75 | + this.precisionNominator += textResult.precisionNominator; | |
76 | + this.recallDenominator += textResult.recallDenominator; | |
77 | + this.recallNominator += textResult.recallNominator; | |
78 | + } | |
79 | + | |
80 | +} | |
... | ... |
src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/Splitter.java
0 → 100755
1 | +++ a/src/main/java/pl/waw/ipipan/zil/core/scoreference/utils/Splitter.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.utils; | |
2 | + | |
3 | +import ipipan.clarin.tei.api.io.IOUtils; | |
4 | + | |
5 | +import java.io.File; | |
6 | +import java.io.IOException; | |
7 | +import java.util.ArrayList; | |
8 | +import java.util.Collections; | |
9 | +import java.util.HashMap; | |
10 | +import java.util.List; | |
11 | +import java.util.Map; | |
12 | +import java.util.Random; | |
13 | +import java.util.TreeSet; | |
14 | + | |
15 | +import javax.xml.parsers.DocumentBuilder; | |
16 | +import javax.xml.parsers.DocumentBuilderFactory; | |
17 | +import javax.xml.parsers.ParserConfigurationException; | |
18 | + | |
19 | +import org.apache.commons.io.FileUtils; | |
20 | +import org.apache.log4j.Logger; | |
21 | +import org.w3c.dom.Document; | |
22 | +import org.w3c.dom.NodeList; | |
23 | +import org.xml.sax.SAXException; | |
24 | + | |
25 | +public class Splitter { | |
26 | + | |
27 | + private static final Logger logger = Logger.getLogger(Splitter.class); | |
28 | + | |
29 | + public static void main(String[] args) { | |
30 | + if (args.length != 3) { | |
31 | + logger.error("Wrong number of arguments! Try: " + Splitter.class.getSimpleName() | |
32 | + + " corpusDir targetDir percent"); | |
33 | + return; | |
34 | + } | |
35 | + | |
36 | + File corpusDir = new File(args[0]); | |
37 | + File targetDir = new File(args[1]); | |
38 | + Integer percent = Integer.parseInt(args[2]); | |
39 | + | |
40 | + Map<String, TreeSet<File>> type2texts = new HashMap<>(); | |
41 | + for (File textDir : IOUtils.getNKJPDirs(corpusDir)) { | |
42 | + try { | |
43 | + String textType = getTextType(textDir); | |
44 | + if (!type2texts.containsKey(textType)) | |
45 | + type2texts.put(textType, new TreeSet<File>()); | |
46 | + type2texts.get(textType).add(textDir); | |
47 | + | |
48 | + } catch (ParserConfigurationException | SAXException | IOException e) { | |
49 | + logger.error("Error processing text:" + textDir + ":" + e); | |
50 | + } | |
51 | + } | |
52 | + | |
53 | + File trainDir = new File(targetDir, "train"); | |
54 | + File testDir = new File(targetDir, "test"); | |
55 | + trainDir.mkdir(); | |
56 | + testDir.mkdir(); | |
57 | + | |
58 | + Random r = new Random(1); | |
59 | + for (String type : type2texts.keySet()) { | |
60 | + TreeSet<File> files = type2texts.get(type); | |
61 | + int size = files.size(); | |
62 | + int test = Math.max(1, size * percent / 100); | |
63 | + int train = size - test; | |
64 | + | |
65 | + List<File> shuffledFiles = new ArrayList<>(files); | |
66 | + Collections.shuffle(shuffledFiles, r); | |
67 | + List<File> trainFiles = shuffledFiles.subList(0, train); | |
68 | + List<File> testFiles = shuffledFiles.subList(train, shuffledFiles.size()); | |
69 | + | |
70 | + logger.info("Text type:" + type); | |
71 | + logger.info("\t" + size + " both"); | |
72 | + logger.info("\t" + train + " train"); | |
73 | + logger.info("\t" + test + " test"); | |
74 | + | |
75 | + for (File f : trainFiles) | |
76 | + try { | |
77 | + FileUtils.copyDirectoryToDirectory(f, trainDir); | |
78 | + } catch (IOException e) { | |
79 | + e.printStackTrace(); | |
80 | + } | |
81 | + | |
82 | + for (File f : testFiles) | |
83 | + try { | |
84 | + FileUtils.copyDirectoryToDirectory(f, testDir); | |
85 | + } catch (IOException e) { | |
86 | + e.printStackTrace(); | |
87 | + } | |
88 | + } | |
89 | + } | |
90 | + | |
91 | + private static String getTextType(File textDir) throws ParserConfigurationException, SAXException, IOException { | |
92 | + Document doc = loadDocument(new File(textDir, "header.xml")); | |
93 | + NodeList refs = doc.getElementsByTagName("catRef"); | |
94 | + return refs.item(0).getAttributes().getNamedItem("target").getTextContent(); | |
95 | + } | |
96 | + | |
97 | + public static Document loadDocument(File xmlFile) throws ParserConfigurationException, SAXException, IOException { | |
98 | + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); | |
99 | + dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); | |
100 | + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); | |
101 | + Document doc = dBuilder.parse(xmlFile); | |
102 | + doc.normalize(); | |
103 | + return doc; | |
104 | + } | |
105 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationA.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationA.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.annotations; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
4 | + | |
5 | +public class AnnotationA extends SingleTextAnnotationImpl { | |
6 | + | |
7 | + { | |
8 | + addMentionGroup(1, 2, 3, 4, 5); | |
9 | + addMentionGroup(6, 7, 8, 9, 10, 11, 12); | |
10 | + } | |
11 | + | |
12 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationB.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationB.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.annotations; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
4 | + | |
5 | +public class AnnotationB extends SingleTextAnnotationImpl { | |
6 | + | |
7 | + { | |
8 | + addMentionGroup(1, 2, 3, 4, 5, 8, 9, 10, 11, 12); | |
9 | + addMentionGroup(6, 7); | |
10 | + } | |
11 | + | |
12 | +} | |
0 | 13 | \ No newline at end of file |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationC.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationC.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.annotations; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
4 | + | |
5 | +public class AnnotationC extends SingleTextAnnotationImpl { | |
6 | + | |
7 | + { | |
8 | + addMentionGroup(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); | |
9 | + } | |
10 | + | |
11 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationD.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationD.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.annotations; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
4 | + | |
5 | +public class AnnotationD extends SingleTextAnnotationImpl { | |
6 | + | |
7 | + { | |
8 | + addSingletons(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); | |
9 | + } | |
10 | + | |
11 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationGold.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/annotations/AnnotationGold.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.annotations; | |
2 | + | |
3 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
4 | + | |
5 | +public class AnnotationGold extends SingleTextAnnotationImpl { | |
6 | + | |
7 | + { | |
8 | + addMentionGroup(1, 2, 3, 4, 5); | |
9 | + addMentionGroup(6, 7); | |
10 | + addMentionGroup(8, 9, 10, 11, 12); | |
11 | + } | |
12 | + | |
13 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/main/KAlphaTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/main/KAlphaTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.main; | |
2 | + | |
3 | +import static org.junit.Assert.assertEquals; | |
4 | + | |
5 | +import java.io.File; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +import org.junit.Test; | |
9 | + | |
10 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
11 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPairImpl; | |
12 | +import pl.waw.ipipan.zil.core.scoreference.readers.Mmax; | |
13 | + | |
14 | +public class KAlphaTest { | |
15 | + @Test | |
16 | + public final void testMmax() { | |
17 | + | |
18 | + String goldPath = new File(KAlphaTest.class.getResource( | |
19 | + "/teksty_mmax/teksty_gold").getFile()).getAbsolutePath(); | |
20 | + String sysPath = new File(KAlphaTest.class.getResource( | |
21 | + "/teksty_mmax/teksty_sys").getFile()).getAbsolutePath(); | |
22 | + | |
23 | + AnnotationPair ann = new AnnotationPairImpl(); | |
24 | + (new Mmax()).loadAnnotationsFrom2Files(new File(goldPath, | |
25 | + "0_mentions.xml"), new File(sysPath, "0_mentions.xml"), ann, | |
26 | + false, false); | |
27 | + | |
28 | + ann.getMentionDetectionResult(false); | |
29 | + | |
30 | + Map<String, Double> kalphaBlanc = KAlpha.computeKappaBlanc(ann, null); | |
31 | + | |
32 | + assertEquals(0.9865, kalphaBlanc.values().iterator().next(), 0.0001); | |
33 | + | |
34 | + } | |
35 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/main/MainTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/main/MainTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.main; | |
2 | + | |
3 | +import java.io.File; | |
4 | + | |
5 | +import org.junit.Test; | |
6 | + | |
7 | +public class MainTest { | |
8 | + @Test | |
9 | + public final void testMmax() { | |
10 | + | |
11 | + String goldPath = new File(MainTest.class.getResource( | |
12 | + "/teksty_mmax/teksty_gold").getFile()).getAbsolutePath(); | |
13 | + String sysPath = new File(MainTest.class.getResource( | |
14 | + "/teksty_mmax/teksty_sys").getFile()).getAbsolutePath(); | |
15 | + | |
16 | + Main.main(new String[] { goldPath, sysPath, "mmax" }); | |
17 | + } | |
18 | + | |
19 | + @Test | |
20 | + public final void testTei() { | |
21 | + | |
22 | + String goldPath = new File(MainTest.class.getResource( | |
23 | + "/teksty_tei/teksty_gold").getFile()).getAbsolutePath(); | |
24 | + String sysPath = new File(MainTest.class.getResource( | |
25 | + "/teksty_tei/teksty_sys").getFile()).getAbsolutePath(); | |
26 | + | |
27 | + Main.main(new String[] { goldPath, sysPath, "tei" }); | |
28 | + } | |
29 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerB3Test.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerB3Test.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +public class ScorerB3Test extends ScorerTest { | |
4 | + | |
5 | + { | |
6 | + scorer = new ScorerB3(); | |
7 | + perfectAnnotationScore = 1.0; | |
8 | + annotationAScore = 0.865; | |
9 | + annotationBScore = 0.737; | |
10 | + annotationCScore = 0.545; | |
11 | + annotationDScore = 0.400; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerBlancTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerBlancTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import org.junit.Test; | |
4 | + | |
5 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
6 | + | |
7 | +public class ScorerBlancTest extends ScorerTest { | |
8 | + | |
9 | + { | |
10 | + scorer = new ScorerBlanc(); | |
11 | + perfectAnnotationScore = 1.0; | |
12 | + annotationAScore = 0.841; | |
13 | + annotationBScore = 0.621; | |
14 | + annotationCScore = 0.241; // 0.318; | |
15 | + annotationDScore = 0.405; // 0.682; | |
16 | + } | |
17 | + | |
18 | + @Test | |
19 | + public final void testAnnotationBlanc() { | |
20 | + testAnnotation(new AnnotationBlancGold(), new AnnotationBlancSys(), | |
21 | + 0.7078); | |
22 | + } | |
23 | + | |
24 | + private class AnnotationBlancGold extends SingleTextAnnotationImpl { | |
25 | + { | |
26 | + addSingletons(1, 2, 3, 4, 6, 8, 10, 11, 13); | |
27 | + addMentionGroup(5, 12, 14); | |
28 | + addMentionGroup(7, 9); | |
29 | + } | |
30 | + } | |
31 | + | |
32 | + private class AnnotationBlancSys extends SingleTextAnnotationImpl { | |
33 | + { | |
34 | + addSingletons(1, 2, 3, 8, 10, 11, 13); | |
35 | + addMentionGroup(4, 6); | |
36 | + addMentionGroup(5, 12); | |
37 | + addMentionGroup(7, 9, 14); | |
38 | + } | |
39 | + } | |
40 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafeTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafeTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +public class ScorerCeafeTest extends ScorerTest { | |
4 | + | |
5 | + { | |
6 | + scorer = new ScorerCeafe(); | |
7 | + perfectAnnotationScore = 1.0; | |
8 | + annotationAScore = 0.733; | |
9 | + annotationBScore = 0.667; | |
10 | + annotationCScore = 0.294; | |
11 | + annotationDScore = 0.178; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafmTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerCeafmTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +public class ScorerCeafmTest extends ScorerTest { | |
4 | + | |
5 | + { | |
6 | + scorer = new ScorerCeafm(); | |
7 | + perfectAnnotationScore = 1.0; | |
8 | + annotationAScore = 0.833; | |
9 | + annotationBScore = 0.583; | |
10 | + annotationCScore = 0.417; | |
11 | + annotationDScore = 0.250; | |
12 | + } | |
13 | + | |
14 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerF1Test.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerF1Test.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import org.junit.Ignore; | |
4 | + | |
5 | +@Ignore | |
6 | +public class ScorerF1Test extends ScorerTest { | |
7 | + | |
8 | + { | |
9 | + scorer = new ScorerF1(); | |
10 | + perfectAnnotationScore = 1.0; | |
11 | + annotationAScore = 0.808; | |
12 | + annotationBScore = 0.636; | |
13 | + annotationCScore = 0.483; | |
14 | + annotationDScore = Double.NaN; | |
15 | + } | |
16 | + | |
17 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerHTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerHTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import org.junit.Ignore; | |
4 | + | |
5 | +@Ignore | |
6 | +public class ScorerHTest extends ScorerTest { | |
7 | + | |
8 | + { | |
9 | + scorer = new ScorerH(); | |
10 | + perfectAnnotationScore = 1.0; | |
11 | + annotationAScore = 0.778; | |
12 | + annotationBScore = 0.571; | |
13 | + annotationCScore = 0.0; | |
14 | + annotationDScore = 0.487; | |
15 | + } | |
16 | + | |
17 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerMucTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerMucTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import org.junit.Test; | |
4 | + | |
5 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotationImpl; | |
6 | + | |
7 | +public class ScorerMucTest extends ScorerTest { | |
8 | + | |
9 | + { | |
10 | + scorer = new ScorerMuc(); | |
11 | + perfectAnnotationScore = 1.0; | |
12 | + annotationAScore = 0.947; | |
13 | + annotationBScore = 0.947; | |
14 | + annotationCScore = 0.9; | |
15 | + annotationDScore = Double.NaN; | |
16 | + } | |
17 | + | |
18 | + @Test | |
19 | + public final void testAnnotationMUC() { | |
20 | + testAnnotation(new AnnotationMUCGold(), new AnnotationMUCSys(), 0.666); | |
21 | + } | |
22 | + | |
23 | + private class AnnotationMUCGold extends SingleTextAnnotationImpl { | |
24 | + { | |
25 | + addMentionGroup(1, 2, 3); | |
26 | + } | |
27 | + } | |
28 | + | |
29 | + private class AnnotationMUCSys extends SingleTextAnnotationImpl { | |
30 | + { | |
31 | + addMentionGroup(1, 3); | |
32 | + addMentionGroup(2); | |
33 | + } | |
34 | + } | |
35 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerRandTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerRandTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import org.junit.Ignore; | |
4 | + | |
5 | +@Ignore | |
6 | +public class ScorerRandTest extends ScorerTest { | |
7 | + | |
8 | + { | |
9 | + scorer = new ScorerRand(); | |
10 | + perfectAnnotationScore = 1.0; | |
11 | + annotationAScore = 0.848; | |
12 | + annotationBScore = 0.621; | |
13 | + annotationCScore = 0.318; | |
14 | + annotationDScore = 0.682; | |
15 | + } | |
16 | + | |
17 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/scorers/ScorerTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.scorers; | |
2 | + | |
3 | +import static org.junit.Assert.assertEquals; | |
4 | + | |
5 | +import org.apache.log4j.Logger; | |
6 | +import org.junit.Ignore; | |
7 | +import org.junit.Test; | |
8 | + | |
9 | +import pl.waw.ipipan.zil.core.scoreference.annotations.AnnotationA; | |
10 | +import pl.waw.ipipan.zil.core.scoreference.annotations.AnnotationB; | |
11 | +import pl.waw.ipipan.zil.core.scoreference.annotations.AnnotationC; | |
12 | +import pl.waw.ipipan.zil.core.scoreference.annotations.AnnotationD; | |
13 | +import pl.waw.ipipan.zil.core.scoreference.annotations.AnnotationGold; | |
14 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPair; | |
15 | +import pl.waw.ipipan.zil.core.scoreference.basic.AnnotationPairImpl; | |
16 | +import pl.waw.ipipan.zil.core.scoreference.basic.SingleTextAnnotation; | |
17 | +import pl.waw.ipipan.zil.core.scoreference.utils.Result; | |
18 | + | |
19 | +@Ignore | |
20 | +public class ScorerTest { | |
21 | + | |
22 | + protected Logger logger = Logger.getLogger(ScorerTest.class); | |
23 | + | |
24 | + protected Scorer scorer = null; | |
25 | + | |
26 | + protected Double perfectAnnotationScore; | |
27 | + protected Double annotationAScore; | |
28 | + protected Double annotationBScore; | |
29 | + protected Double annotationCScore; | |
30 | + protected Double annotationDScore; | |
31 | + | |
32 | + protected void testAnnotation(SingleTextAnnotation gold, | |
33 | + SingleTextAnnotation sys, Double expectedF1) { | |
34 | + | |
35 | + logger.debug("\n################## " | |
36 | + + scorer.getClass().getCanonicalName() + " #############"); | |
37 | + logger.debug("Calculating annotation score for \n" + "\tGOLD: " | |
38 | + + gold.toString() + "\n" + "\tSYS: " + sys.toString()); | |
39 | + | |
40 | + AnnotationPair annos = new AnnotationPairImpl(); | |
41 | + annos.addPair(gold, sys, false); | |
42 | + | |
43 | + Result result = scorer.compare(annos.getGold(0), annos.getSys(0)); | |
44 | + | |
45 | + logger.debug(result.toString()); | |
46 | + | |
47 | + Double delta = 0.001; | |
48 | + | |
49 | + assertEquals(expectedF1, result.getF1(), delta); | |
50 | + } | |
51 | + | |
52 | + @Test | |
53 | + public final void testPerfectAnnotation() { | |
54 | + testAnnotation(new AnnotationGold(), new AnnotationGold(), | |
55 | + perfectAnnotationScore); | |
56 | + } | |
57 | + | |
58 | + @Test | |
59 | + public final void testAnnotationA() { | |
60 | + testAnnotation(new AnnotationGold(), new AnnotationA(), | |
61 | + annotationAScore); | |
62 | + } | |
63 | + | |
64 | + @Test | |
65 | + public final void testAnnotationB() { | |
66 | + testAnnotation(new AnnotationGold(), new AnnotationB(), | |
67 | + annotationBScore); | |
68 | + } | |
69 | + | |
70 | + @Test | |
71 | + public final void testAnnotationC() { | |
72 | + testAnnotation(new AnnotationGold(), new AnnotationC(), | |
73 | + annotationCScore); | |
74 | + } | |
75 | + | |
76 | + @Test | |
77 | + public final void testAnnotationD() { | |
78 | + testAnnotation(new AnnotationGold(), new AnnotationD(), | |
79 | + annotationDScore); | |
80 | + } | |
81 | +} | |
... | ... |
src/test/java/pl/waw/ipipan/zil/core/scoreference/utils/ResultTest.java
0 → 100755
1 | +++ a/src/test/java/pl/waw/ipipan/zil/core/scoreference/utils/ResultTest.java | |
1 | +package pl.waw.ipipan.zil.core.scoreference.utils; | |
2 | + | |
3 | +import static org.junit.Assert.assertEquals; | |
4 | + | |
5 | +import org.junit.Test; | |
6 | + | |
7 | +public class ResultTest { | |
8 | + | |
9 | + @Test | |
10 | + public final void testF1Calculation() { | |
11 | + Result r = new Result(1.0, 1.0); | |
12 | + assertEquals(r.getF1(), 1.0, 0.000001); | |
13 | + | |
14 | + r = new Result(0.42, 0.91); | |
15 | + assertEquals(0.5747, r.getF1(), 0.0001); | |
16 | + | |
17 | + r = new Result(1.0, 0.9); | |
18 | + assertEquals(0.947, r.getF1(), 0.001); | |
19 | + | |
20 | + r = new Result(Double.NaN, 0.9); | |
21 | + assertEquals(Double.NaN, r.getF1(), 0.001); | |
22 | + | |
23 | + r = new Result(Double.NaN, Double.NaN); | |
24 | + assertEquals(Double.NaN, r.getF1(), 0.001); | |
25 | + } | |
26 | + | |
27 | +} | |
... | ... |
src/test/resources/teksty_mmax/teksty_gold/0.mmax
0 → 100755
src/test/resources/teksty_mmax/teksty_gold/0_mentions.xml
0 → 100755
1 | +++ a/src/test/resources/teksty_mmax/teksty_gold/0_mentions.xml | |
1 | +<?xml version="1.0" ?> | |
2 | +<!DOCTYPE markables SYSTEM "markables.dtd"> | |
3 | +<markables xmlns="www.eml.org/NameSpaces/mention"> | |
4 | + <markable id="markable_1" span="word_2" mmax_level="mention" mention_head="spotkaniu" mention_group="empty" near_identity="empty"></markable> | |
5 | + <markable id="markable_2" span="word_4" mmax_level="mention" mention_head="udział" mention_group="set_0" near_identity="empty"></markable> | |
6 | + <markable id="markable_3" span="word_8" mmax_level="mention" mention_head="braci" mention_group="set_7" near_identity="empty"></markable> | |
7 | + <markable id="markable_4" span="word_7..word_8" mmax_level="mention" mention_head="tysięcy" mention_group="empty" near_identity="empty"></markable> | |
8 | + <markable id="markable_5" span="word_10..word_11" mmax_level="mention" mention_head="Europy" mention_group="empty" near_identity="empty"></markable> | |
9 | + <markable id="markable_6" span="word_17" mmax_level="mention" mention_head="nich" mention_group="set_2" near_identity="empty"></markable> | |
10 | + <markable id="markable_7" span="word_22..word_25" mmax_level="mention" mention_head="tytuł" mention_group="set_11" near_identity="empty"></markable> | |
11 | + <markable id="markable_8" span="word_29" mmax_level="mention" mention_head="udział" mention_group="set_0" near_identity="empty"></markable> | |
12 | + <markable id="markable_9" span="word_31" mmax_level="mention" mention_head="strzelaniu" mention_group="set_1" near_identity="empty"></markable> | |
13 | + <markable id="markable_10" span="word_34..word_35" mmax_level="mention" mention_head="szanse" mention_group="empty" near_identity="empty"></markable> | |
14 | + <markable id="markable_11" span="word_40" mmax_level="mention" mention_head="to" mention_group="set_8" near_identity="empty"></markable> | |
15 | + <markable id="markable_12" span="word_46" mmax_level="mention" mention_head="gospodarza" mention_group="empty" near_identity="empty"></markable> | |
16 | + <markable id="markable_13" span="word_47" mmax_level="mention" mention_head="spotkań" mention_group="set_6" near_identity="empty"></markable> | |
17 | + <markable id="markable_14" span="word_44..word_47" mmax_level="mention" mention_head="obowiązków" mention_group="empty" near_identity="empty"></markable> | |
18 | + <markable id="markable_15" span="word_50..word_52" mmax_level="mention" mention_head="nawale" mention_group="empty" near_identity="empty"></markable> | |
19 | + <markable id="markable_16" span="word_54" mmax_level="mention" mention_head="mi" mention_group="empty" near_identity="empty"></markable> | |
20 | + <markable id="markable_17" span="word_59" mmax_level="mention" mention_head="strzelaniu" mention_group="set_1" near_identity="empty"></markable> | |
21 | + <markable id="markable_18" span="word_63" mmax_level="mention" mention_head="Maj" mention_group="set_4" near_identity="empty"></markable> | |
22 | + <markable id="markable_19" span="word_62..word_63" mmax_level="mention" mention_head="Zdzisław" mention_group="set_5" near_identity="empty"></markable> | |
23 | + <markable id="markable_20" span="word_66..word_68" mmax_level="mention" mention_head="Bractwa" mention_group="set_9" near_identity="empty"></markable> | |
24 | + <markable id="markable_21" span="word_65..word_68" mmax_level="mention" mention_head="prezes" mention_group="empty" near_identity="empty"></markable> | |
25 | + <markable id="markable_22" span="word_71..word_72" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
26 | + <markable id="markable_23" span="word_70..word_72" mmax_level="mention" mention_head="Król" mention_group="set_3" near_identity="empty"></markable> | |
27 | + <markable id="markable_24" span="word_77..word_79" mmax_level="mention" mention_head="Króla" mention_group="set_3" near_identity="empty"></markable> | |
28 | + <markable id="markable_25" span="word_76..word_79" mmax_level="mention" mention_head="tytuł" mention_group="set_11" near_identity="empty"></markable> | |
29 | + <markable id="markable_26" span="word_84..word_85" mmax_level="mention" mention_head="etapach" mention_group="empty" near_identity="empty"></markable> | |
30 | + <markable id="markable_27" span="word_88" mmax_level="mention" mention_head="finału" mention_group="empty" near_identity="empty"></markable> | |
31 | + <markable id="markable_28" span="word_96" mmax_level="mention" mention_head="nich" mention_group="set_2" near_identity="empty"></markable> | |
32 | + <markable id="markable_29" span="word_99..word_101" mmax_level="mention" mention_head="Króla" mention_group="set_3" near_identity="empty"></markable> | |
33 | + <markable id="markable_30" span="word_98..word_101" mmax_level="mention" mention_head="tytuł" mention_group="set_11" near_identity="empty"></markable> | |
34 | + <markable id="markable_31" span="word_103" mmax_level="mention" mention_head="go" mention_group="set_3" near_identity="empty"></markable> | |
35 | + <markable id="markable_32" span="word_106..word_107" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
36 | + <markable id="markable_33" span="word_110" mmax_level="mention" mention_head="Król" mention_group="set_3" near_identity="empty"></markable> | |
37 | + <markable id="markable_34" span="word_113..word_115" mmax_level="mention" mention_head="nagród" mention_group="empty" near_identity="empty"></markable> | |
38 | + <markable id="markable_35" span="word_118..word_119" mmax_level="mention" mention_head="tytuł" mention_group="set_11" near_identity="empty"></markable> | |
39 | + <markable id="markable_36" span="word_121..word_122" mmax_level="mention" mention_head="zaszczytem" mention_group="empty" near_identity="empty"></markable> | |
40 | + <markable id="markable_37" span="word_124" mmax_level="mention" mention_head="król" mention_group="set_3" near_identity="empty"></markable> | |
41 | + <markable id="markable_38" span="word_131..word_132" mmax_level="mention" mention_head="Parlamentu" mention_group="empty" near_identity="empty"></markable> | |
42 | + <markable id="markable_39" span="word_130..word_132" mmax_level="mention" mention_head="posiedzenia" mention_group="empty" near_identity="empty"></markable> | |
43 | + <markable id="markable_40" span="word_136" mmax_level="mention" mention_head="Maj" mention_group="set_4" near_identity="empty"></markable> | |
44 | + <markable id="markable_41" span="word_135..word_136" mmax_level="mention" mention_head="Zdzisław" mention_group="set_5" near_identity="empty"></markable> | |
45 | + <markable id="markable_42" span="word_144..word_145" mmax_level="mention" mention_head="Bractw" mention_group="empty" near_identity="empty"></markable> | |
46 | + <markable id="markable_43" span="word_142..word_145" mmax_level="mention" mention_head="Spotkań" mention_group="set_6" near_identity="empty"></markable> | |
47 | + <markable id="markable_44" span="word_147..word_148" mmax_level="mention" mention_head="parada" mention_group="empty" near_identity="empty"></markable> | |
48 | + <markable id="markable_45" span="word_156..word_157" mmax_level="mention" mention_head="godz" mention_group="empty" near_identity="empty"></markable> | |
49 | + <markable id="markable_46" span="word_160..word_161" mmax_level="mention" mention_head="braci" mention_group="set_7" near_identity="empty"></markable> | |
50 | + <markable id="markable_47" span="word_163..word_164" mmax_level="mention" mention_head="strojach" mention_group="empty" near_identity="empty"></markable> | |
51 | + <markable id="markable_48" span="word_167" mmax_level="mention" mention_head="Błoń" mention_group="empty" near_identity="empty"></markable> | |
52 | + <markable id="markable_49" span="word_169" mmax_level="mention" mention_head="Rynek" mention_group="empty" near_identity="empty"></markable> | |
53 | + <markable id="markable_50" span="word_172" mmax_level="mention" mention_head="Piłsudskiego" mention_group="empty" near_identity="empty"></markable> | |
54 | + <markable id="markable_51" span="word_174" mmax_level="mention" mention_head="Straszewskiego" mention_group="empty" near_identity="empty"></markable> | |
55 | + <markable id="markable_52" span="word_181" mmax_level="mention" mention_head="istnienia" mention_group="set_8" near_identity="empty"></markable> | |
56 | + <markable id="markable_53" span="word_182..word_183" mmax_level="mention" mention_head="Bractwa" mention_group="set_9" near_identity="empty"></markable> | |
57 | + <markable id="markable_54" span="word_185" mmax_level="mention" mention_head="Krakowie" mention_group="empty" near_identity="empty"></markable> | |
58 | + <markable id="markable_55" span="word_182..word_185" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
59 | + <markable id="markable_56" span="word_187..word_188" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
60 | + <markable id="markable_57" span="word_191" mmax_level="mention" mention_head="ono" mention_group="set_9" near_identity="empty"></markable> | |
61 | + <markable id="markable_58" span="word_192..word_193" mmax_level="mention" mention_head="obywateli" mention_group="empty" near_identity="empty"></markable> | |
62 | + <markable id="markable_59" span="word_197..word_198" mmax_level="mention" mention_head="rzemieślników" mention_group="empty" near_identity="empty"></markable> | |
63 | + <markable id="markable_60" span="word_195..word_198" mmax_level="mention" mention_head="kupców" mention_group="empty" near_identity="empty"></markable> | |
64 | + <markable id="markable_61" span="word_200..word_201" mmax_level="mention" mention_head="obronność" mention_group="empty" near_identity="empty"></markable> | |
65 | + <markable id="markable_62" span="word_203..word_205" mmax_level="mention" mention_head="świętem" mention_group="empty" near_identity="empty"></markable> | |
66 | + <markable id="markable_63" span="word_207" mmax_level="mention" mention_head="turniej" mention_group="empty" near_identity="empty"></markable> | |
67 | + <markable id="markable_64" span="word_213" mmax_level="mention" mention_head="strzelnicy" mention_group="empty" near_identity="empty"></markable> | |
68 | + <markable id="markable_65" span="word_220..word_221" mmax_level="mention" mention_head="dni" mention_group="empty" near_identity="empty"></markable> | |
69 | + <markable id="markable_66" span="word_229..word_230" mmax_level="mention" mention_head="żerdzi" mention_group="empty" near_identity="empty"></markable> | |
70 | + <markable id="markable_67" span="word_232" mmax_level="mention" mention_head="Brat" mention_group="set_10" near_identity="empty"></markable> | |
71 | + <markable id="markable_68" span="word_236..word_237" mmax_level="mention" mention_head="strzałem" mention_group="empty" near_identity="empty"></markable> | |
72 | + <markable id="markable_69" span="word_240" mmax_level="mention" mention_head="jego" mention_group="set_10" near_identity="empty"></markable> | |
73 | + <markable id="markable_70" span="word_239..word_241" mmax_level="mention" mention_head="fragment" mention_group="empty" near_identity="empty"></markable> | |
74 | + <markable id="markable_71" span="word_243..word_245" mmax_level="mention" mention_head="miano" mention_group="empty" near_identity="empty"></markable> | |
75 | + <markable id="markable_72" span="word_248..word_249" mmax_level="mention" mention_head="tytułem" mention_group="set_11" near_identity="empty"></markable> | |
76 | + <markable id="markable_73" span="word_258" mmax_level="mention" mention_head="przywileje" mention_group="empty" near_identity="empty"></markable> | |
77 | + <markable id="markable_74" span="word_252..word_258" mmax_level="mention" mention_head="honory" mention_group="set_12" near_identity="empty"></markable> | |
78 | + <markable id="markable_75" span="word_260..word_261" mmax_level="mention" mention_head="Rada" mention_group="empty" near_identity="empty"></markable> | |
79 | + <markable id="markable_76" span="word_263" mmax_level="mention" mention_head="jego" mention_group="set_12" near_identity="empty"></markable> | |
80 | + <markable id="markable_77" span="word_263..word_264" mmax_level="mention" mention_head="posiadacza" mention_group="set_12" near_identity="empty"></markable> | |
81 | + <markable id="markable_78" span="word_272" mmax_level="mention" mention_head="podatków" mention_group="empty" near_identity="empty"></markable> | |
82 | + <markable id="markable_79" span="word_270..word_272" mmax_level="mention" mention_head="obowiązku" mention_group="empty" near_identity="empty"></markable> | |
83 | + <markable id="markable_80" span="word_274..word_275" mmax_level="mention" mention_head="zwyczaj" mention_group="empty" near_identity="empty"></markable> | |
84 | + <markable id="markable_81" span="word_279" mmax_level="mention" mention_head="dziś" mention_group="empty" near_identity="empty"></markable> | |
85 | +</markables> | |
0 | 86 | \ No newline at end of file |
... | ... |
src/test/resources/teksty_mmax/teksty_gold/0_words.xml
0 → 100755
1 | +++ a/src/test/resources/teksty_mmax/teksty_gold/0_words.xml | |
1 | +<?xml version="1.0" ?> | |
2 | +<!DOCTYPE words SYSTEM "words.dtd"> | |
3 | +<words> | |
4 | + <word id="word_1" tei_id="morph_1.1.1-seg">W</word> | |
5 | + <word id="word_2" tei_id="morph_1.1.2-seg">spotkaniu</word> | |
6 | + <word id="word_3" tei_id="morph_1.1.3-seg">weźmie</word> | |
7 | + <word id="word_4" tei_id="morph_1.1.4-seg">udział</word> | |
8 | + <word id="word_5" tei_id="morph_1.1.5-seg">blisko</word> | |
9 | + <word id="word_6" tei_id="morph_1.1.6-seg">7</word> | |
10 | + <word id="word_7" tei_id="morph_1.1.7-seg">tysięcy</word> | |
11 | + <word id="word_8" tei_id="morph_1.1.8-seg">braci</word> | |
12 | + <word id="word_9" tei_id="morph_1.1.9-seg">z</word> | |
13 | + <word id="word_10" tei_id="morph_1.1.10-seg">całej</word> | |
14 | + <word id="word_11" tei_id="morph_1.1.11-seg">Europy</word> | |
15 | + <word id="word_12" tei_id="morph_1.1.12-seg">,</word> | |
16 | + <word id="word_13" tei_id="morph_1.1.13-seg">ale</word> | |
17 | + <word id="word_14" tei_id="morph_1.1.14-seg">tylko</word> | |
18 | + <word id="word_15" tei_id="morph_1.1.15-seg">206</word> | |
19 | + <word id="word_16" tei_id="morph_1.1.16-seg">z</word> | |
20 | + <word id="word_17" tei_id="morph_1.1.17-seg">nich</word> | |
21 | + <word id="word_18" tei_id="morph_1.1.18-seg">będzie</word> | |
22 | + <word id="word_19" tei_id="morph_1.1.19-seg">ubiegało</word> | |
23 | + <word id="word_20" tei_id="morph_1.1.20-seg">się</word> | |
24 | + <word id="word_21" tei_id="morph_1.1.21-seg">o</word> | |
25 | + <word id="word_22" tei_id="morph_1.1.22-seg">tytuł</word> | |
26 | + <word id="word_23" tei_id="morph_1.1.23-seg">Europejskiego</word> | |
27 | + <word id="word_24" tei_id="morph_1.1.24-seg">Króla</word> | |
28 | + <word id="word_25" tei_id="morph_1.1.25-seg">Kurkowego</word> | |
29 | + <word id="word_26" tei_id="morph_1.1.26-seg">.</word> | |
30 | + <word id="word_27" tei_id="morph_1.1.27-seg">-</word> | |
31 | + <word id="word_28" tei_id="morph_1.1.28-seg">Wezmę</word> | |
32 | + <word id="word_29" tei_id="morph_1.1.29-seg">udział</word> | |
33 | + <word id="word_30" tei_id="morph_1.1.30-seg">w</word> | |
34 | + <word id="word_31" tei_id="morph_1.1.31-seg">strzelaniu</word> | |
35 | + <word id="word_32" tei_id="morph_1.1.32-seg">,</word> | |
36 | + <word id="word_33" tei_id="morph_1.1.33-seg">choć</word> | |
37 | + <word id="word_34" tei_id="morph_1.1.34-seg">moje</word> | |
38 | + <word id="word_35" tei_id="morph_1.1.35-seg">szanse</word> | |
39 | + <word id="word_36" tei_id="morph_1.1.36-seg">są</word> | |
40 | + <word id="word_37" tei_id="morph_1.1.37-seg">marne</word> | |
41 | + <word id="word_38" tei_id="morph_1.1.38-seg">.</word> | |
42 | + <word id="word_39" tei_id="morph_1.2.1-seg">Wynika</word> | |
43 | + <word id="word_40" tei_id="morph_1.2.2-seg">to</word> | |
44 | + <word id="word_41" tei_id="morph_1.2.3-seg">przede</word> | |
45 | + <word id="word_42" tei_id="morph_1.2.4-seg">wszystkim</word> | |
46 | + <word id="word_43" tei_id="morph_1.2.5-seg">z</word> | |
47 | + <word id="word_44" tei_id="morph_1.2.6-seg">moich</word> | |
48 | + <word id="word_45" tei_id="morph_1.2.7-seg">obowiązków</word> | |
49 | + <word id="word_46" tei_id="morph_1.2.8-seg">gospodarza</word> | |
50 | + <word id="word_47" tei_id="morph_1.2.9-seg">spotkań</word> | |
51 | + <word id="word_48" tei_id="morph_1.2.10-seg">;</word> | |
52 | + <word id="word_49" tei_id="morph_1.2.11-seg">w</word> | |
53 | + <word id="word_50" tei_id="morph_1.2.12-seg">tym</word> | |
54 | + <word id="word_51" tei_id="morph_1.2.13-seg">nawale</word> | |
55 | + <word id="word_52" tei_id="morph_1.2.14-seg">pracy</word> | |
56 | + <word id="word_53" tei_id="morph_1.2.15-seg">ciężko</word> | |
57 | + <word id="word_54" tei_id="morph_1.2.16-seg">mi</word> | |
58 | + <word id="word_55" tei_id="morph_1.2.17-seg">będzie</word> | |
59 | + <word id="word_56" tei_id="morph_1.2.18-seg">się</word> | |
60 | + <word id="word_57" tei_id="morph_1.2.19-seg">skupić</word> | |
61 | + <word id="word_58" tei_id="morph_1.2.20-seg">na</word> | |
62 | + <word id="word_59" tei_id="morph_1.2.21-seg">strzelaniu</word> | |
63 | + <word id="word_60" tei_id="morph_1.2.22-seg">-</word> | |
64 | + <word id="word_61" tei_id="morph_1.2.23-seg">przewiduje</word> | |
65 | + <word id="word_62" tei_id="morph_1.2.24-seg">Zdzisław</word> | |
66 | + <word id="word_63" tei_id="morph_1.2.25-seg">Maj</word> | |
67 | + <word id="word_64" tei_id="morph_1.2.26-seg">,</word> | |
68 | + <word id="word_65" tei_id="morph_1.2.27-seg">prezes</word> | |
69 | + <word id="word_66" tei_id="morph_1.2.28-seg">krakowskiego</word> | |
70 | + <word id="word_67" tei_id="morph_1.2.29-seg">Bractwa</word> | |
71 | + <word id="word_68" tei_id="morph_1.2.30-seg">Kurkowego</word> | |
72 | + <word id="word_69" tei_id="morph_1.2.31-seg">,</word> | |
73 | + <word id="word_70" tei_id="morph_1.2.32-seg">panujący</word> | |
74 | + <word id="word_71" tei_id="morph_1.2.33-seg">Król</word> | |
75 | + <word id="word_72" tei_id="morph_1.2.34-seg">Kurkowy</word> | |
76 | + <word id="word_73" tei_id="morph_1.2.35-seg" lastinpar="true">.</word> | |
77 | + <word id="word_74" tei_id="morph_2.3.1-seg">Strzelanie</word> | |
78 | + <word id="word_75" tei_id="morph_2.3.2-seg">o</word> | |
79 | + <word id="word_76" tei_id="morph_2.3.3-seg">tytuł</word> | |
80 | + <word id="word_77" tei_id="morph_2.3.4-seg">Europejskiego</word> | |
81 | + <word id="word_78" tei_id="morph_2.3.5-seg">Króla</word> | |
82 | + <word id="word_79" tei_id="morph_2.3.6-seg">Kurkowego</word> | |
83 | + <word id="word_80" tei_id="morph_2.3.7-seg">będzie</word> | |
84 | + <word id="word_81" tei_id="morph_2.3.8-seg">się</word> | |
85 | + <word id="word_82" tei_id="morph_2.3.9-seg">odbywało</word> | |
86 | + <word id="word_83" tei_id="morph_2.3.10-seg">w</word> | |
87 | + <word id="word_84" tei_id="morph_2.3.11-seg">kilku</word> | |
88 | + <word id="word_85" tei_id="morph_2.3.12-seg">etapach</word> | |
89 | + <word id="word_86" tei_id="morph_2.3.13-seg">.</word> | |
90 | + <word id="word_87" tei_id="morph_2.4.1-seg">Do</word> | |
91 | + <word id="word_88" tei_id="morph_2.4.2-seg">finału</word> | |
92 | + <word id="word_89" tei_id="morph_2.4.3-seg">zostanie</word> | |
93 | + <word id="word_90" tei_id="morph_2.4.4-seg">dopuszczonych</word> | |
94 | + <word id="word_91" tei_id="morph_2.4.5-seg">27</word> | |
95 | + <word id="word_92" tei_id="morph_2.4.6-seg">braci</word> | |
96 | + <word id="word_93" tei_id="morph_2.4.7-seg">-</word> | |
97 | + <word id="word_94" tei_id="morph_2.4.8-seg">jeden</word> | |
98 | + <word id="word_95" tei_id="morph_2.4.9-seg">z</word> | |
99 | + <word id="word_96" tei_id="morph_2.4.10-seg">nich</word> | |
100 | + <word id="word_97" tei_id="morph_2.4.11-seg">otrzyma</word> | |
101 | + <word id="word_98" tei_id="morph_2.4.12-seg">tytuł</word> | |
102 | + <word id="word_99" tei_id="morph_2.4.13-seg">Europejskiego</word> | |
103 | + <word id="word_100" tei_id="morph_2.4.14-seg">Króla</word> | |
104 | + <word id="word_101" tei_id="morph_2.4.15-seg">Kurkowego</word> | |
105 | + <word id="word_102" tei_id="morph_2.4.16-seg">odbierając</word> | |
106 | + <word id="word_103" tei_id="morph_2.4.17-seg">go</word> | |
107 | + <word id="word_104" tei_id="morph_2.4.18-seg">obecnie</word> | |
108 | + <word id="word_105" tei_id="morph_2.4.19-seg">panującemu</word> | |
109 | + <word id="word_106" tei_id="morph_2.4.20-seg">Wilfriedowi</word> | |
110 | + <word id="word_107" tei_id="morph_2.4.21-seg">Stammermannowi</word> | |
111 | + <word id="word_108" tei_id="morph_2.4.22-seg">.</word> | |
112 | + <word id="word_109" tei_id="morph_2.4.23-seg">-</word> | |
113 | + <word id="word_110" tei_id="morph_2.4.24-seg">Król</word> | |
114 | + <word id="word_111" tei_id="morph_2.4.25-seg">nie</word> | |
115 | + <word id="word_112" tei_id="morph_2.4.26-seg">otrzymuje</word> | |
116 | + <word id="word_113" tei_id="morph_2.4.27-seg">żadnych</word> | |
117 | + <word id="word_114" tei_id="morph_2.4.28-seg">nagród</word> | |
118 | + <word id="word_115" tei_id="morph_2.4.29-seg">finansowych</word> | |
119 | + <word id="word_116" tei_id="morph_2.4.30-seg">,</word> | |
120 | + <word id="word_117" tei_id="morph_2.4.31-seg">ale</word> | |
121 | + <word id="word_118" tei_id="morph_2.4.32-seg">taki</word> | |
122 | + <word id="word_119" tei_id="morph_2.4.33-seg">tytuł</word> | |
123 | + <word id="word_120" tei_id="morph_2.4.34-seg">jest</word> | |
124 | + <word id="word_121" tei_id="morph_2.4.35-seg">ogromnym</word> | |
125 | + <word id="word_122" tei_id="morph_2.4.36-seg">zaszczytem</word> | |
126 | + <word id="word_123" tei_id="morph_2.4.37-seg">;</word> | |
127 | + <word id="word_124" tei_id="morph_2.4.38-seg">król</word> | |
128 | + <word id="word_125" tei_id="morph_2.4.39-seg">jest</word> | |
129 | + <word id="word_126" tei_id="morph_2.4.40-seg">np</word> | |
130 | + <word id="word_127" tei_id="morph_2.4.41-seg">.</word> | |
131 | + <word id="word_128" tei_id="morph_2.4.42-seg">zapraszany</word> | |
132 | + <word id="word_129" tei_id="morph_2.4.43-seg">na</word> | |
133 | + <word id="word_130" tei_id="morph_2.4.44-seg">posiedzenia</word> | |
134 | + <word id="word_131" tei_id="morph_2.4.45-seg">Parlamentu</word> | |
135 | + <word id="word_132" tei_id="morph_2.4.46-seg">Europejskiego</word> | |
136 | + <word id="word_133" tei_id="morph_2.4.47-seg">-</word> | |
137 | + <word id="word_134" tei_id="morph_2.4.48-seg">mówi</word> | |
138 | + <word id="word_135" tei_id="morph_2.4.49-seg">Zdzisław</word> | |
139 | + <word id="word_136" tei_id="morph_2.4.50-seg">Maj</word> | |
140 | + <word id="word_137" tei_id="morph_2.4.51-seg" lastinpar="true">.</word> | |
141 | + <word id="word_138" tei_id="morph_3.5.1-seg">Największą</word> | |
142 | + <word id="word_139" tei_id="morph_3.5.2-seg">atrakcją</word> | |
143 | + <word id="word_140" tei_id="morph_3.5.3-seg">12</word> | |
144 | + <word id="word_141" tei_id="morph_3.5.4-seg">.</word> | |
145 | + <word id="word_142" tei_id="morph_3.6.1-seg">Europejskich</word> | |
146 | + <word id="word_143" tei_id="morph_3.6.2-seg">Spotkań</word> | |
147 | + <word id="word_144" tei_id="morph_3.6.3-seg">Bractw</word> | |
148 | + <word id="word_145" tei_id="morph_3.6.4-seg">Strzeleckich</word> | |
149 | + <word id="word_146" tei_id="morph_3.6.5-seg">będzie</word> | |
150 | + <word id="word_147" tei_id="morph_3.6.6-seg">wielka</word> | |
151 | + <word id="word_148" tei_id="morph_3.6.7-seg">parada</word> | |
152 | + <word id="word_149" tei_id="morph_3.6.8-seg">,</word> | |
153 | + <word id="word_150" tei_id="morph_3.6.9-seg">która</word> | |
154 | + <word id="word_151" tei_id="morph_3.6.10-seg">rozpocznie</word> | |
155 | + <word id="word_152" tei_id="morph_3.6.11-seg">się</word> | |
156 | + <word id="word_153" tei_id="morph_3.6.12-seg">w</word> | |
157 | + <word id="word_154" tei_id="morph_3.6.13-seg">niedzielę</word> | |
158 | + <word id="word_155" tei_id="morph_3.6.14-seg">o</word> | |
159 | + <word id="word_156" tei_id="morph_3.6.15-seg">godz</word> | |
160 | + <word id="word_157" tei_id="morph_3.6.16-seg">.</word> | |
161 | + <word id="word_158" tei_id="morph_3.6.17-seg">13</word> | |
162 | + <word id="word_159" tei_id="morph_3.6.18-seg">.</word> | |
163 | + <word id="word_160" tei_id="morph_3.7.1-seg">Kilkuset</word> | |
164 | + <word id="word_161" tei_id="morph_3.7.2-seg">braci</word> | |
165 | + <word id="word_162" tei_id="morph_3.7.3-seg">w</word> | |
166 | + <word id="word_163" tei_id="morph_3.7.4-seg">historycznych</word> | |
167 | + <word id="word_164" tei_id="morph_3.7.5-seg">strojach</word> | |
168 | + <word id="word_165" tei_id="morph_3.7.6-seg">przejdzie</word> | |
169 | + <word id="word_166" tei_id="morph_3.7.7-seg">z</word> | |
170 | + <word id="word_167" tei_id="morph_3.7.8-seg">Błoń</word> | |
171 | + <word id="word_168" tei_id="morph_3.7.9-seg">na</word> | |
172 | + <word id="word_169" tei_id="morph_3.7.10-seg">Rynek</word> | |
173 | + <word id="word_170" tei_id="morph_3.7.11-seg">ulicami</word> | |
174 | + <word id="word_171" tei_id="morph_3.7.12-seg">:</word> | |
175 | + <word id="word_172" tei_id="morph_3.7.13-seg">Piłsudskiego</word> | |
176 | + <word id="word_173" tei_id="morph_3.7.14-seg">,</word> | |
177 | + <word id="word_174" tei_id="morph_3.7.15-seg">Straszewskiego</word> | |
178 | + <word id="word_175" tei_id="morph_3.7.16-seg">,</word> | |
179 | + <word id="word_176" tei_id="morph_3.7.17-seg">Franciszkańską</word> | |
180 | + <word id="word_177" tei_id="morph_3.7.18-seg">i</word> | |
181 | + <word id="word_178" tei_id="morph_3.7.19-seg">Grodzką</word> | |
182 | + <word id="word_179" tei_id="morph_3.7.20-seg" lastinpar="true">.</word> | |
183 | + <word id="word_180" tei_id="morph_4.8.1-seg">Początki</word> | |
184 | + <word id="word_181" tei_id="morph_4.8.2-seg">istnienia</word> | |
185 | + <word id="word_182" tei_id="morph_4.8.3-seg">Bractwa</word> | |
186 | + <word id="word_183" tei_id="morph_4.8.4-seg">Kurkowego</word> | |
187 | + <word id="word_184" tei_id="morph_4.8.5-seg">w</word> | |
188 | + <word id="word_185" tei_id="morph_4.8.6-seg">Krakowie</word> | |
189 | + <word id="word_186" tei_id="morph_4.8.7-seg">sięgają</word> | |
190 | + <word id="word_187" tei_id="morph_4.8.8-seg">XIII</word> | |
191 | + <word id="word_188" tei_id="morph_4.8.9-seg">wieku</word> | |
192 | + <word id="word_189" tei_id="morph_4.8.10-seg">.</word> | |
193 | + <word id="word_190" tei_id="morph_4.9.1-seg">Skupiało</word> | |
194 | + <word id="word_191" tei_id="morph_4.9.2-seg">ono</word> | |
195 | + <word id="word_192" tei_id="morph_4.9.3-seg">znamienitych</word> | |
196 | + <word id="word_193" tei_id="morph_4.9.4-seg">obywateli</word> | |
197 | + <word id="word_194" tei_id="morph_4.9.5-seg">,</word> | |
198 | + <word id="word_195" tei_id="morph_4.9.6-seg">kupców</word> | |
199 | + <word id="word_196" tei_id="morph_4.9.7-seg">i</word> | |
200 | + <word id="word_197" tei_id="morph_4.9.8-seg">rzemieślników</word> | |
201 | + <word id="word_198" tei_id="morph_4.9.9-seg">pragnących</word> | |
202 | + <word id="word_199" tei_id="morph_4.9.10-seg">wspomóc</word> | |
203 | + <word id="word_200" tei_id="morph_4.9.11-seg">obronność</word> | |
204 | + <word id="word_201" tei_id="morph_4.9.12-seg">miasta</word> | |
205 | + <word id="word_202" tei_id="morph_4.9.13-seg">.</word> | |
206 | + <word id="word_203" tei_id="morph_4.10.1-seg">Wielkim</word> | |
207 | + <word id="word_204" tei_id="morph_4.10.2-seg">świętem</word> | |
208 | + <word id="word_205" tei_id="morph_4.10.3-seg">bractwa</word> | |
209 | + <word id="word_206" tei_id="morph_4.10.4-seg">był</word> | |
210 | + <word id="word_207" tei_id="morph_4.10.5-seg">turniej</word> | |
211 | + <word id="word_208" tei_id="morph_4.10.6-seg">,</word> | |
212 | + <word id="word_209" tei_id="morph_4.10.7-seg">który</word> | |
213 | + <word id="word_210" tei_id="morph_4.10.8-seg">odbywał</word> | |
214 | + <word id="word_211" tei_id="morph_4.10.9-seg">się</word> | |
215 | + <word id="word_212" tei_id="morph_4.10.10-seg">na</word> | |
216 | + <word id="word_213" tei_id="morph_4.10.11-seg">strzelnicy</word> | |
217 | + <word id="word_214" tei_id="morph_4.10.12-seg">zwanej</word> | |
218 | + <word id="word_215" tei_id="morph_4.10.13-seg">Celestatem</word> | |
219 | + <word id="word_216" tei_id="morph_4.10.14-seg">.</word> | |
220 | + <word id="word_217" tei_id="morph_4.11.1-seg">Zawody</word> | |
221 | + <word id="word_218" tei_id="morph_4.11.2-seg">trwały</word> | |
222 | + <word id="word_219" tei_id="morph_4.11.3-seg">zwykle</word> | |
223 | + <word id="word_220" tei_id="morph_4.11.4-seg">trzy</word> | |
224 | + <word id="word_221" tei_id="morph_4.11.5-seg">dni</word> | |
225 | + <word id="word_222" tei_id="morph_4.11.6-seg">.</word> | |
226 | + <word id="word_223" tei_id="morph_4.12.1-seg">Strzelano</word> | |
227 | + <word id="word_224" tei_id="morph_4.12.2-seg">do</word> | |
228 | + <word id="word_225" tei_id="morph_4.12.3-seg">drewnianego</word> | |
229 | + <word id="word_226" tei_id="morph_4.12.4-seg">kura</word> | |
230 | + <word id="word_227" tei_id="morph_4.12.5-seg">umocowanego</word> | |
231 | + <word id="word_228" tei_id="morph_4.12.6-seg">na</word> | |
232 | + <word id="word_229" tei_id="morph_4.12.7-seg">wysokiej</word> | |
233 | + <word id="word_230" tei_id="morph_4.12.8-seg">żerdzi</word> | |
234 | + <word id="word_231" tei_id="morph_4.12.9-seg">.</word> | |
235 | + <word id="word_232" tei_id="morph_4.13.1-seg">Brat</word> | |
236 | + <word id="word_233" tei_id="morph_4.13.2-seg">,</word> | |
237 | + <word id="word_234" tei_id="morph_4.13.3-seg">który</word> | |
238 | + <word id="word_235" tei_id="morph_4.13.4-seg">zdołał</word> | |
239 | + <word id="word_236" tei_id="morph_4.13.5-seg">celnym</word> | |
240 | + <word id="word_237" tei_id="morph_4.13.6-seg">strzałem</word> | |
241 | + <word id="word_238" tei_id="morph_4.13.7-seg">strącić</word> | |
242 | + <word id="word_239" tei_id="morph_4.13.8-seg">ostatni</word> | |
243 | + <word id="word_240" tei_id="morph_4.13.9-seg">jego</word> | |
244 | + <word id="word_241" tei_id="morph_4.13.10-seg">fragment</word> | |
245 | + <word id="word_242" tei_id="morph_4.13.11-seg">zdobywał</word> | |
246 | + <word id="word_243" tei_id="morph_4.13.12-seg">miano</word> | |
247 | + <word id="word_244" tei_id="morph_4.13.13-seg">Króla</word> | |
248 | + <word id="word_245" tei_id="morph_4.13.14-seg">Kurkowego</word> | |
249 | + <word id="word_246" tei_id="morph_4.13.15-seg">.</word> | |
250 | + <word id="word_247" tei_id="morph_4.14.1-seg">Z</word> | |
251 | + <word id="word_248" tei_id="morph_4.14.2-seg">tym</word> | |
252 | + <word id="word_249" tei_id="morph_4.14.3-seg">tytułem</word> | |
253 | + <word id="word_250" tei_id="morph_4.14.4-seg">wiązały</word> | |
254 | + <word id="word_251" tei_id="morph_4.14.5-seg">się</word> | |
255 | + <word id="word_252" tei_id="morph_4.14.6-seg">nie</word> | |
256 | + <word id="word_253" tei_id="morph_4.14.7-seg">tylko</word> | |
257 | + <word id="word_254" tei_id="morph_4.14.8-seg">honory</word> | |
258 | + <word id="word_255" tei_id="morph_4.14.9-seg">,</word> | |
259 | + <word id="word_256" tei_id="morph_4.14.10-seg">ale</word> | |
260 | + <word id="word_257" tei_id="morph_4.14.11-seg">także</word> | |
261 | + <word id="word_258" tei_id="morph_4.14.12-seg">przywileje</word> | |
262 | + <word id="word_259" tei_id="morph_4.14.13-seg">:</word> | |
263 | + <word id="word_260" tei_id="morph_4.14.14-seg">Rada</word> | |
264 | + <word id="word_261" tei_id="morph_4.14.15-seg">Miejska</word> | |
265 | + <word id="word_262" tei_id="morph_4.14.16-seg">zwalniała</word> | |
266 | + <word id="word_263" tei_id="morph_4.14.17-seg">jego</word> | |
267 | + <word id="word_264" tei_id="morph_4.14.18-seg">posiadacza</word> | |
268 | + <word id="word_265" tei_id="morph_4.14.19-seg">m</word> | |
269 | + <word id="word_266" tei_id="morph_4.14.20-seg">.</word> | |
270 | + <word id="word_267" tei_id="morph_4.14.21-seg">in</word> | |
271 | + <word id="word_268" tei_id="morph_4.14.22-seg">.</word> | |
272 | + <word id="word_269" tei_id="morph_4.14.23-seg">z</word> | |
273 | + <word id="word_270" tei_id="morph_4.14.24-seg">obowiązku</word> | |
274 | + <word id="word_271" tei_id="morph_4.14.25-seg">płacenia</word> | |
275 | + <word id="word_272" tei_id="morph_4.14.26-seg">podatków</word> | |
276 | + <word id="word_273" tei_id="morph_4.14.27-seg">(</word> | |
277 | + <word id="word_274" tei_id="morph_4.14.28-seg">ten</word> | |
278 | + <word id="word_275" tei_id="morph_4.14.29-seg">zwyczaj</word> | |
279 | + <word id="word_276" tei_id="morph_4.14.30-seg">utrzymał</word> | |
280 | + <word id="word_277" tei_id="morph_4.14.31-seg">się</word> | |
281 | + <word id="word_278" tei_id="morph_4.14.32-seg">do</word> | |
282 | + <word id="word_279" tei_id="morph_4.14.33-seg">dziś</word> | |
283 | + <word id="word_280" tei_id="morph_4.14.34-seg">)</word> | |
284 | + <word id="word_281" tei_id="morph_4.14.35-seg" lastinpar="true">.</word> | |
285 | +</words> | |
... | ... |
src/test/resources/teksty_mmax/teksty_gold/1.mmax
0 → 100755
src/test/resources/teksty_mmax/teksty_gold/1_mentions.xml
0 → 100755
1 | +++ a/src/test/resources/teksty_mmax/teksty_gold/1_mentions.xml | |
1 | +<?xml version="1.0" ?> | |
2 | +<!DOCTYPE markables SYSTEM "markables.dtd"> | |
3 | +<markables xmlns="www.eml.org/NameSpaces/mention"> | |
4 | + <markable id="markable_1" span="word_4" mmax_level="mention" mention_head="Wrocławiu" mention_group="empty" near_identity="empty"></markable> | |
5 | + <markable id="markable_2" span="word_6" mmax_level="mention" mention_head="kontrolerów" mention_group="empty" near_identity="empty"></markable> | |
6 | + <markable id="markable_3" span="word_5..word_6" mmax_level="mention" mention_head="płace" mention_group="empty" near_identity="empty"></markable> | |
7 | + <markable id="markable_4" span="word_12..word_13" mmax_level="mention" mention_head="wezwań" mention_group="empty" near_identity="empty"></markable> | |
8 | + <markable id="markable_5" span="word_15" mmax_level="mention" mention_head="zapłaty" mention_group="empty" near_identity="empty"></markable> | |
9 | + <markable id="markable_6" span="word_26..word_27" mmax_level="mention" mention_head="pracowników" mention_group="empty" near_identity="empty"></markable> | |
10 | + <markable id="markable_7" span="word_29..word_30" mmax_level="mention" mention_head="razy" mention_group="empty" near_identity="empty"></markable> | |
11 | + <markable id="markable_8" span="word_35" mmax_level="mention" mention_head="premie" mention_group="empty" near_identity="empty"></markable> | |
12 | + <markable id="markable_9" span="word_41" mmax_level="mention" mention_head="skuteczność" mention_group="empty" near_identity="empty"></markable> | |
13 | + <markable id="markable_10" span="word_45" mmax_level="mention" mention_head="pasażerów" mention_group="empty" near_identity="empty"></markable> | |
14 | + <markable id="markable_11" span="word_43..word_45" mmax_level="mention" mention_head="skargi" mention_group="empty" near_identity="empty"></markable> | |
15 | + <markable id="markable_12" span="word_40..word_45" mmax_level="mention" mention_head="uwagę" mention_group="empty" near_identity="empty"></markable> | |
16 | + <markable id="markable_13" span="word_48..word_49" mmax_level="mention" mention_head="Monika" mention_group="empty" near_identity="empty"></markable> | |
17 | + <markable id="markable_14" span="word_52" mmax_level="mention" mention_head="Wydziału" mention_group="empty" near_identity="empty"></markable> | |
18 | + <markable id="markable_15" span="word_52..word_53" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
19 | + <markable id="markable_16" span="word_56" mmax_level="mention" mention_head="Miasta" mention_group="set_7" near_identity="empty"></markable> | |
20 | + <markable id="markable_17" span="word_55..word_56" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
21 | + <markable id="markable_18" span="word_51..word_56" mmax_level="mention" mention_head="kierownik" mention_group="set_8" near_identity="empty"></markable> | |
22 | + <markable id="markable_19" span="word_58..word_59" mmax_level="mention" mention_head="kontrolerzy" mention_group="empty" near_identity="empty"></markable> | |
23 | + <markable id="markable_20" span="word_67" mmax_level="mention" mention_head="złotych" mention_group="empty" near_identity="empty"></markable> | |
24 | + <markable id="markable_21" span="word_73" mmax_level="mention" mention_head="Miasto" mention_group="set_7" near_identity="empty"></markable> | |
25 | + <markable id="markable_22" span="word_78..word_79" mmax_level="mention" mention_head="spółki" mention_group="empty" near_identity="empty"></markable> | |
26 | + <markable id="markable_23" span="word_86..word_87" mmax_level="mention" mention_head="projekt" mention_group="set_2" near_identity="empty"></markable> | |
27 | + <markable id="markable_24" span="word_92" mmax_level="mention" mention_head="udziałów" mention_group="empty" near_identity="empty"></markable> | |
28 | + <markable id="markable_25" span="word_91..word_92" mmax_level="mention" mention_head="wniesienie" mention_group="empty" near_identity="empty"></markable> | |
29 | + <markable id="markable_26" span="word_95..word_96" mmax_level="mention" mention_head="Budownictwa" mention_group="set_5" near_identity="empty"></markable> | |
30 | + <markable id="markable_27" span="word_97..word_99" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
31 | + <markable id="markable_28" span="word_94..word_99" mmax_level="mention" mention_head="Towarzystwie" mention_group="set_0" near_identity="empty"></markable> | |
32 | + <markable id="markable_29" span="word_102..word_103" mmax_level="mention" mention_head="Budownictwa" mention_group="set_5" near_identity="empty"></markable> | |
33 | + <markable id="markable_30" span="word_101..word_103" mmax_level="mention" mention_head="Towarzystwie" mention_group="set_0" near_identity="empty"></markable> | |
34 | + <markable id="markable_31" span="word_104..word_107" mmax_level="mention" mention_head="Dom" mention_group="empty" near_identity="empty"></markable> | |
35 | + <markable id="markable_32" span="word_101..word_107" mmax_level="mention" mention_head="" mention_group="set_0" near_identity="empty"></markable> | |
36 | + <markable id="markable_33" span="word_111..word_112" mmax_level="mention" mention_head="Budownictwa" mention_group="set_5" near_identity="empty"></markable> | |
37 | + <markable id="markable_34" span="word_109..word_112" mmax_level="mention" mention_head="Towarzystwa" mention_group="set_0" near_identity="empty"></markable> | |
38 | + <markable id="markable_35" span="word_115" mmax_level="mention" mention_head="piątek" mention_group="empty" near_identity="empty"></markable> | |
39 | + <markable id="markable_36" span="word_117..word_118" mmax_level="mention" mention_head="propozycję" mention_group="empty" near_identity="empty"></markable> | |
40 | + <markable id="markable_37" span="word_121..word_122" mmax_level="mention" mention_head="Gospodarki" mention_group="empty" near_identity="empty"></markable> | |
41 | + <markable id="markable_38" span="word_120..word_122" mmax_level="mention" mention_head="Komisja" mention_group="set_3" near_identity="empty"></markable> | |
42 | + <markable id="markable_39" span="word_124..word_125" mmax_level="mention" mention_head="Polityki" mention_group="set_1" near_identity="empty"></markable> | |
43 | + <markable id="markable_40" span="word_120..word_125" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
44 | + <markable id="markable_41" span="word_129" mmax_level="mention" mention_head="wtorek" mention_group="empty" near_identity="empty"></markable> | |
45 | + <markable id="markable_42" span="word_132" mmax_level="mention" mention_head="nią" mention_group="set_1" near_identity="empty"></markable> | |
46 | + <markable id="markable_43" span="word_133..word_134" mmax_level="mention" mention_head="Rada" mention_group="set_4" near_identity="empty"></markable> | |
47 | + <markable id="markable_44" span="word_138" mmax_level="mention" mention_head="połączenia" mention_group="empty" near_identity="empty"></markable> | |
48 | + <markable id="markable_45" span="word_137..word_138" mmax_level="mention" mention_head="Pomysł" mention_group="set_2" near_identity="empty"></markable> | |
49 | + <markable id="markable_46" span="word_142" mmax_level="mention" mention_head="wątpliwości" mention_group="empty" near_identity="empty"></markable> | |
50 | + <markable id="markable_47" span="word_147" mmax_level="mention" mention_head="kosztów" mention_group="empty" near_identity="empty"></markable> | |
51 | + <markable id="markable_48" span="word_151" mmax_level="mention" mention_head="Lewandowski" mention_group="empty" near_identity="empty"></markable> | |
52 | + <markable id="markable_49" span="word_150..word_151" mmax_level="mention" mention_head="Tomasz" mention_group="empty" near_identity="empty"></markable> | |
53 | + <markable id="markable_50" span="word_154" mmax_level="mention" mention_head="LiD" mention_group="empty" near_identity="empty"></markable> | |
54 | + <markable id="markable_51" span="word_157" mmax_level="mention" mention_head="komisji" mention_group="set_3" near_identity="empty"></markable> | |
55 | + <markable id="markable_52" span="word_156..word_157" mmax_level="mention" mention_head="członek" mention_group="empty" near_identity="empty"></markable> | |
56 | + <markable id="markable_53" span="word_153..word_157" mmax_level="mention" mention_head="radny" mention_group="empty" near_identity="empty"></markable> | |
57 | + <markable id="markable_54" span="word_163" mmax_level="mention" mention_head="dyskusja" mention_group="set_4" near_identity="empty"></markable> | |
58 | + <markable id="markable_55" span="word_166" mmax_level="mention" mention_head="towarzystw" mention_group="set_6" near_identity="empty"></markable> | |
59 | + <markable id="markable_56" span="word_165..word_166" mmax_level="mention" mention_head="przyszłości" mention_group="empty" near_identity="empty"></markable> | |
60 | + <markable id="markable_57" span="word_169" mmax_level="mention" mention_head="rząd" mention_group="empty" near_identity="empty"></markable> | |
61 | + <markable id="markable_58" span="word_173" mmax_level="mention" mention_head="ustawy" mention_group="empty" near_identity="empty"></markable> | |
62 | + <markable id="markable_59" span="word_172..word_173" mmax_level="mention" mention_head="zmianą" mention_group="empty" near_identity="empty"></markable> | |
63 | + <markable id="markable_60" span="word_178" mmax_level="mention" mention_head="mieszkań" mention_group="empty" near_identity="empty"></markable> | |
64 | + <markable id="markable_61" span="word_181..word_182" mmax_level="mention" mention_head="budownictwa" mention_group="set_5" near_identity="empty"></markable> | |
65 | + <markable id="markable_62" span="word_180..word_182" mmax_level="mention" mention_head="towarzystwach" mention_group="set_6" near_identity="empty"></markable> | |
66 | + <markable id="markable_63" span="word_186..word_188" mmax_level="mention" mention_head="sytuację" mention_group="empty" near_identity="empty"></markable> | |
67 | + <markable id="markable_64" span="word_197..word_198" mmax_level="mention" mention_head="kroków" mention_group="empty" near_identity="empty"></markable> | |
68 | + <markable id="markable_65" span="word_196..word_198" mmax_level="mention" mention_head="podjęcie" mention_group="empty" near_identity="empty"></markable> | |
69 | + <markable id="markable_66" span="word_200" mmax_level="mention" mention_head="miasto" mention_group="set_7" near_identity="empty"></markable> | |
70 | + <markable id="markable_67" span="word_202..word_203" mmax_level="mention" mention_head="" mention_group="empty" near_identity="empty"></markable> | |
71 | + <markable id="markable_68" span="word_206" mmax_level="mention" mention_head="klubu" mention_group="set_9" near_identity="empty"></markable> | |
72 | + <markable id="markable_69" span="word_205..word_206" mmax_level="mention" mention_head="szef" mention_group="set_8" near_identity="empty"></markable> | |
73 | + <markable id="markable_70" span="word_208" mmax_level="mention" mention_head="PiS" mention_group="empty" near_identity="empty"></markable> | |
74 | + <markable id="markable_71" span="word_214..word_215" mmax_level="mention" mention_head="względów" mention_group="empty" near_identity="empty"></markable> | |
75 | + <markable id="markable_72" span="word_217..word_218" mmax_level="mention" mention_head="spółki" mention_group="empty" near_identity="empty"></markable> | |
76 | + <markable id="markable_73" span="word_216..word_218" mmax_level="mention" mention_head="utworzenie" mention_group="empty" near_identity="empty"></markable> | |
77 | + <markable id="markable_74" span="word_241..word_242" mmax_level="mention" mention_head="klub" mention_group="set_9" near_identity="empty"></markable> | |
78 | + <markable id="markable_75" span="word_248..word_250" mmax_level="mention" mention_head="uchwały" mention_group="empty" near_identity="empty"></markable> | |
79 | +</markables> | |
0 | 80 | \ No newline at end of file |
... | ... |