\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{mc3_functions}[2021/09/13 v0.0.9012]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE MC3_FUNCTIONS	(to be used with class multicast3!)
% by Nils Norman Schiborr, University of Bamberg
% CC-BY-SA 4.0 International

% ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ %
% CHANGELOG
%	0.0.9000	19-02-05	initial version

% ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ %
% KNOWN ISSUES
%	[  ]	


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COLLECTION OVERVIEW

% add corpus metadata for overview tables
\newcounter{Cmetacorpora}
\newcounter{Cmetatexts}
\newcounter{Cmetatime}
\newcounter{Cmetaclauses}

\NewDocumentCommand{\addcorpusmeta}{mmm}{%
	\addtolist{metatexts}{{#1}}
	\addtolist{metatime}{{#2}}
	\addtolist{metaclauses}{{#3}}

	% count total number of corpora, texts, and clauses
	\addtocounter{Cmetacorpora}{1}
	\addtocounter{Cmetatexts}{#1}
	\addtocounter{Cmetaclauses}{#3}

	% convert h:mm:ss to seconds
	\StrRight{#2}{2}[\metaseconds]
	\StrRight{#2}{5}[\metaminutes]
	\StrLeft{\metaminutes}{2}[\metaminutes]
	\StrLeft{#2}{1}[\metahours]

	% count total number of seconds
	\setcounter{Cmetatime}{\theCmetatime + \metaseconds}
	\setcounter{Cmetatime}{\theCmetatime + 60*\metaminutes}
	\setcounter{Cmetatime}{\theCmetatime + 3600*\metahours}
}


% ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ %

% arrow for annotation symbol changes in changelog
\NewDocumentCommand{\carr}{}{\hspace{0.5em}\textcolor{MCgrayF}{\ding{222}}\hspace{0.5em}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ANNOTATION NOTES

% canned introduction to the list of GRAID symbols
\NewDocumentCommand{\graidlistintroduction}{}{%
	The following is a list of the non-standard GRAID symbols used in the annotation of the Multi-CAST \getlist[1]{corpus} corpus.
	Please refer to the \tit{GRAID manual} \pcite[54\tnd55]{Haig.Schnell2014} for an inventory of basic GRAID symbols.
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LIST OF REFERENTS

% canned introduction to the list of referents
\NewDocumentCommand{\referentsintroduction}{}{%
	\section{Notes on the list of referents}

	This document collects lists of the indexed referents in version \tcode{\getlist[1]{vkey}} (from \getlist[2]{vkey}) of the Multi-CAST \getlist[1]{corpus} corpus. Unless a more recent version of this document exists, it also applies to any later versions of the annotations. The information listed here is also available in TSV format from the Multi-CAST website.
	%	
	Please refer to the RefIND annotation guidelines \pcite{Schiborr.Schnell.Thiele2018} for details on the annotations.

%	\smallskip
%	\phantomsection
%	\addcontentsline{toc}{subsection}{Semantic classes of referents}
%	\subsubsection*{Semantic classes of referents}

	\vspace*{7mm}
	\noindent\tit{\large\tcolm{Semantic classes of referent}}

	\begin{refabbrevlist}
		\TabPositions{6em}
		\item[hum]	\tit{human}		\tab	human beings and anthropomorphized non-humans
		\item[anm]	\tit{animate}		\tab	animals
		\item[inm]	\tit{inanimate}	\tab	inanimate physical objects
		\item[bdp]	\tit{body part}	\tab	body parts of human beings and animals
		\item[mss]	\tit{mass}		\tab	non-individuable masses like water or sand
		\item[loc]	\tit{location}		\tab	physical locations and places
		\item[tme]	\tit{time}		\tab	points or periods of time
		\item[abs]	\tit{abstract}	\tab	emotions, thoughts, ideas, speech, etc.
	\end{refabbrevlist}

%	\smallskip
%	\phantomsection
%	\addcontentsline{toc}{subsection}{Relations between referents}
%	\subsubsection*{Relations between referents}

	\vspace*{3mm}
	\noindent\tit{\large\tcolm{Relations between referents}}

	\begin{refabbrevlist}
		\item[~~\textless]		\tit{set member of}\quad(partial co-reference)\\
						\hspace*{1em}is member of a previously introduced referent containing multiple entities
		\item[~~\textgreater]	\tit{includes}	\quad(split antecedence)\\
						\hspace*{1em}contains multiple entities previously established as separate referents
		\item[~~M]			\tit{part-whole}\\
						\hspace*{1em}is part of another entity or mass that was previously established
	\end{refabbrevlist}

	\vfill
%	\phantomsection
%	\addcontentsline{toc}{subsection}{References}
	\subsection*{References}
	{
		\printbibliography[heading=none]
	}
	\clearpage

	\section{Lists of referents}
	\setlength{\parindent}{0em}							%	set parindent to zero
	\setlength{\parskip}{0.15em}%							%	set paragraph skip
	\sloppy%										%	most languages do not have hyphenation rules, so set to \sloppy
	\small%										%	save paper and reduce underfull boxes
}


% ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ %

% lists of abbreviated referent class labels
\newlist{refabbrevlist}{description}{1}							%	define list of label abbreviations

\setlist[refabbrevlist]{%
	leftmargin=!,
	rightmargin=3em,
	labelindent=1em,
	labelsep=1em,
	labelwidth=3em,
	itemindent=0em,
	itemsep=1mm,
	font=\normalfont\small\ttfamily\color{descriptioncolour}
}

% shorthand for coloured monospaced text, used for referent indices in list
\NewDocumentCommand{\tttR}{m}{\tcolm{\ttt{#1}}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CORPUS COUNTS

% canned instruction page
\NewDocumentCommand{\countsintroduction}{mO{default}}{%
	\section{Notes on the GRAID counts}
	
	This document collects tables with frequency counts for combinations of selected GRAID symbols in version \tcode{\getlist[1]{vkey}} (from \getlist[2]{vkey}) of the Multi-CAST \getlist[1]{corpus} corpus. Unless a more recent version of this document exists, it also applies to any later versions of the annotations.
	Note that the tables are intended to offer only cursory impressions of the relative proportions between different types of referring expression. They do not provide exact summaries of the annotations.

	\medskip
	\noindent Only a small number of basic GRAID symbols are counted:
	
	\vspace*{5mm}
	\noindent\tit{\large\tcolm{Function symbols}}
	%
	\begin{countscatlist}
		\item[\tann{0}]		zero
		\item[\tann{pro}]		definite pronoun
		\item[\tann{np}]		full noun phrase
		\item[\tann{other}]		form not further specified
	\end{countscatlist}

	\vspace*{3mm}
	\noindent\tit{\large\tcolm{Person/Animacy symbols}}
	%
	\begin{countscatlist}
		\item[\tann{.1}]		first person
		\item[\tann{.2}]		second person
		\item[\tann{.h}]		third person, human
		\item[\tann{.d}]		third person, anthropomorphic
		\item[~\o]			third person, non-human
	\end{countscatlist}

	\vspace*{3mm}
	\noindent\tit{\large\tcolm{Function symbols}}
	%
	\begin{countscatlist}
		\IfStrEq{#2}{voice}{%
			\item[\tann{:s}]		subject of an intransitive clause
			\item[\tann{:a\_a}]		A argument of a transitive clause, actor voice
			\item[\tann{:p\_a}]		P argument of a transitive clause, actor voice
			\item[\tann{:a\_a}]		A argument of a transitive clause, undergoer voice
			\item[\tann{:p\_a}]		P argument of a transitive clause, undergoer voice
		}{%
			\item[\tann{:s}]		subject of an intransitive clause
			\item[\tann{:a}]		subject of a transitive clause
			\item[\tann{:ncs}]		non-canonical subject
		}
		\item[\tann{:p}]		direct object
		\item[\tann{:obl}]		oblique argument
		\item[\tann{:g}]		goal argument
		\item[\tann{:l}]		locational argument
		\item[\tann{:pred}]		predicate
		\item[\tann{:poss}]		possessive
		\item[\tann{:other}]	function not further specified
	\end{countscatlist}

	\vspace*{3mm}
	\noindent\tit{\large\tcolm{Clause boundary symbols}}
	%
	\begin{countscatlist}
		\item[\tann{\#\#}]		independent clause
		\item[\tann{\#}]		other clause
	\end{countscatlist}
	%
	\bigskip
	%
	Only basic categories are listed; categories represented by complex symbols with additional specifiers (e.g. \tann{dem\_pro} \sqt{de\-monstrative pronoun}) have been subsumed under the more basic category (e.g. \tann{pro} \sqt{definite pronoun}). Please refer to the annotation notes for this corpus for information on all annotated categories, including those not listed here.

	
	% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %
	
%	\hfill
%	\smallskip
	
%	The tables in this document can be recreated with the \tcode{mc\_table} function from \tit{multicastR}, the companion package to Multi-CAST for the statistical computing language R. Please refer to the package documentation (\tcode{?multicastR}, \tcode{?mc\_table}) for more information.
	
%	To do so,
%	
%	\tcode{library(multicastR)}
%	
%	\tcode{mc <- multicast("#1")}
%	
%	\tcode{mc\_table(data = mc[corpus == "\getlist[2]{corpus}"])      \# counts for the entire corpus}
%	
%	\tcode{mc\_table(data = mc[file == "#1"])      \# counts for a specific text} 
%	
%	
%	help \tcode{?mc\_table}
%	
%	Refer to the \tit{multicastR} manual included in the \tit{Multi-CAST collection overview} for detailed instructions.
}

% ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ %

% lists of abbreviated referent class labels
\newlist{countscatlist}{description}{1}							%	define list of label abbreviations

\setlist[countscatlist]{%
	leftmargin=!,
	rightmargin=3em,
	labelindent=1em,
	labelsep=1em,
	labelwidth=4em,
	itemindent=0em,
	itemsep=1mm,
	font=\normalfont\ttfamily\color{MCgrayF}
}

% annotation values without colouring
\NewDocumentCommand{\tannC}{m}{\mbox{\texttt{\tchv{#1}}}}		%	for annotation values

% table wrapper
\NewDocumentCommand{\inputtable}{mmo}{%
	\begin{landscape}									%	PDF is rotated
		\strictpagecheck								%	check whether current page is even or odd
		\checkoddpage
		\ifoddpage
			\begin{vplace}[0.5]							%	page is vertically centered, above-below ratio for odd pages
		\else
			\begin{vplace}[-0.304]						%	page is vertically centered, above-below ratio for even pages
		\fi
			\IfValueTF{#3}{%
				\section{#1}							%	section heading
			}{%
				\subsection{\textit{#1}}					%	subsection heading
			}
			\input{#2}								%	input TEX file with table
		\end{vplace}
	\end{landscape}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\endinput