From 5cd99ebd593e5c90e0a52614102cdc18c51a496d Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Thu, 23 Mar 2023 21:34:17 -0700 Subject: [PATCH] Initial commit --- justfile | 6 ++ leipzig-gloss-examples.typ | 138 +++++++++++++++++++++++++++++++++++ leipzig-gloss.typ | 104 ++++++++++++++++++++++++++ linguistic-abbreviations.typ | 128 ++++++++++++++++++++++++++++++++ 4 files changed, 376 insertions(+) create mode 100644 justfile create mode 100644 leipzig-gloss-examples.typ create mode 100644 leipzig-gloss.typ create mode 100644 linguistic-abbreviations.typ diff --git a/justfile b/justfile new file mode 100644 index 0000000..b7973cc --- /dev/null +++ b/justfile @@ -0,0 +1,6 @@ +default: + just --list + + +build-example: + typst leipzig-gloss-examples.typ diff --git a/leipzig-gloss-examples.typ b/leipzig-gloss-examples.typ new file mode 100644 index 0000000..7e446e9 --- /dev/null +++ b/leipzig-gloss-examples.typ @@ -0,0 +1,138 @@ +#import "leipzig-gloss.typ": gloss, numbered_gloss +#import "linguistic-abbreviations.typ": * + += Leipzig Glossing Examples + +This is the classic example of the inflected Georgian verb with an 8-segment consonant cluster: + +#gloss( + source_text: ([გვ-ფრცქვნ-ი],), + source_text_style: none, + transliteration: ([gv-prtskvn-i],), + morphemes: ([1pl.#obj\-peel-#fmnt],), + translation: "You peeled us", +) + +Some more Georgian: + +#gloss( + header_text: [from "Georgian and the Unaccusative Hypothesis", Harris, 1982], + source_text: ([ბავშვ-ი], [ატირდა]), + source_text_style: (item) => text(fill: red)[#item], + transliteration: ([bavšv-i], [aṭirda]), + morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]), + translation: [The child burst out crying], +) + +```typst + +#gloss( + header_text: [from "Georgian and the Unaccusative Hypothesis", Harris, 1982], + source_text: ([ბავშვ-ი], [ატირდა]), + source_text_style: (item) => text(fill: red)[#item], + transliteration: ([bavšv-i], [aṭirda]), + morphemes: ([child-#smallcaps[nom]], [3S/cry/#smallcaps[incho]/II]), + translation: [The child burst out crying], +) +``` + +And how about an example in English: + +#gloss( + source_text: ([I'm], [eat-ing], [your], [head]), + morphemes: ([1#sg.#sbj\=to.be], [eat-#prog], [2#sg.#pos], [head]), + morphemes_style: text.with(fill: blue), + translation: text(weight: "semibold")[I'm eating your head!], +) + +```typst +#gloss( + source_text: ([I'm], [eat-ing], [your], [head]), + morphemes: ([1#sg.#subj\=to.be], [eat-#prog], [2#sg.#pos], [head]), + morphemes_style: text.with(fill: blue), + translation: text(weight: "semibold")[I'm eating your head!], +) +``` + +== Leipzig Glossing Rules PDF examples + +See https://www.eva.mpg.de/lingua/pdf/Glossing-Rules.pdf + + +#numbered_gloss( + header_text: [Indonesian (Sneddon 1996:237)], + source_text: ([Mereka], [di], [Jakarta], [sekarang.]), + morphemes: ([they], [in], [Jakarta], [now]), + translation: "They are in Jakarta now", +) + +#numbered_gloss( + header_text: [Lezgian (Haspelmath 1993:207)], + source_text: ([Gila], [abur-u-n], [ferma], [hamišaluǧ], [güǧüna], [amuq’-da-č.]), + morphemes: ([now], [they-#obl\-#gen], [farm], [forever], [behind], [stay-#fut\-#neg]), + translation: "Now their farm will not stay behind forever.", +) + +#numbered_gloss( + header_text: [West Greenlandic (Fortescue 1984:127)], + source_text: ([palasi=lu], [niuirtur=lu]), + morphemes: ([priest=and], [shopkeeper=and]), + translation: "both the priest and the shopkeeper", +) + +#numbered_gloss( + header_text: [Hakha Lai], + source_text: ([a-nii -láay],), + morphemes: ([3#sg\-laugh-#fut],), + translation: [s/he will laugh], +) + +#numbered_gloss( + header_text: [Russian], + source_text: ([My], [s], [Marko], [poexa-l-i], [avtobus-om], [v], [Peredelkino]), + morphemes: ([1#pl], [#com], [Marko], [go-#pst\-#pl], [bus-#ins], [#all], [Peredelkino]), + additional_gloss_lines: (([we], [with], [Marko], [go-#pst\-#pl], [bus-by], [to], [Peredelkino]),), + translation: "Marko and I went to Perdelkino by bus", +) + +#numbered_gloss( + header_text: [Turkish], + source_text: ([çık-mak],), + morphemes: ([come.out-#inf],), + translation: "to come out", +) + +#numbered_gloss( + header_text: [Latin], + source_text: ([insul-arum],), + morphemes: ([island-#gen\-#pl],), + translation: "of the islands", +) + +#numbered_gloss( + header_text: [French], + source_text: ([aux], [chevaux]), + morphemes: ([to-#art\-#pl],[horse.#pl]), + translation: "to the horses", +) + +#numbered_gloss( + header_text: [German], + source_text: ([unser-n], [Väter-n]), + morphemes: ([our-#dat\-#pl],[father.#pl\-#dat.#pl]), + translation: "to our fathers", +) + +#numbered_gloss( + header_text: [Hittite (Lehmann 1982:211)], + source_text: ([n=an], [apedani], [mehuni],[essandu.]), + morphemes: ([#smallcaps[conn]=him], [that.#dat.#sg], [time.#dat.#sg], [eat.they.shall]), + translation: "They shall celebrate him on that date", +) + +#numbered_gloss( + header_text: [Jaminjung (Schultze-Berndt 2000:92)], + source_text: ([nanggayan], [guny-bi-yarluga?]), + morphemes: ([who], [2#du.#A.3#sg.#P\-#fut\-poke]), + translation: "Who do you two want to spear?", +) diff --git a/leipzig-gloss.typ b/leipzig-gloss.typ new file mode 100644 index 0000000..49e4b55 --- /dev/null +++ b/leipzig-gloss.typ @@ -0,0 +1,104 @@ +#let gloss_count = counter("gloss_count") + +#let gloss_lines(spacing_between_items, formatters, gloss_line_lists) = { + assert(gloss_line_lists.len() > 0, message: "Gloss line lists cannot be empty") + + let len = gloss_line_lists.at(0).len() + + for line in gloss_line_lists { + assert(line.len() == len) + } + + assert(formatters.len() == gloss_line_lists.len(), message: "The number of formatters and the number of gloss line lists should be equal") + + let make_item_box(..args) = { + box(stack(dir: ttb, spacing: 0.5em, ..args)) + } + + for item_index in range(0, len) { + let args = () + for line_idx, formatter in formatters { + let formatter_fn = if formatter == none { + (x) => x + } else { + formatter + } + + let item = gloss_line_lists.at(line_idx).at(item_index) + args.push(formatter_fn(item)) + } + make_item_box(..args) + h(spacing_between_items) + } +} + + +#let gloss( + header_text: none, + source_text: (), + source_text_style: emph, + transliteration: none, + transliteration_style: none, + morphemes: (), + morphemes_style: none, + additional_gloss_lines: (), //List of list of content + translation: none, + spacing_between_items: 1em, + numbering: false, +) = { + + assert(type(source_text) == "array", message: "source_text needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") + assert(type(morphemes) == "array", message: "morphemes needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") + + assert(source_text.len() == morphemes.len(), message: "source_text and morphemes have different lengths") + + if transliteration != none { + assert(transliteration.len() == source_text.len(), message: "source_text and transliteration have different lengths") + } + + let gloss_items = { + + if header_text != none { + header_text + linebreak() + } + + let formatters = (source_text_style,) + let gloss_line_lists = (source_text,) + + if transliteration != none { + formatters.push(transliteration_style) + gloss_line_lists.push(transliteration) + } + + formatters.push(morphemes_style) + gloss_line_lists.push(morphemes) + + for additional in additional_gloss_lines { + formatters.push(none) //TODO fix this + gloss_line_lists.push(additional) + } + + + gloss_lines(spacing_between_items, formatters, gloss_line_lists) + + if translation != none { + linebreak() + ["#translation"] + } + } + + let gloss_number = if numbering { + [(#gloss_count.display())] + } else { + none + } + + [#gloss_number #pad(left: 1em)[#gloss_items]] + + if numbering { + gloss_count.step() + } +} + +#let numbered_gloss = gloss.with(numbering: true) diff --git a/linguistic-abbreviations.typ b/linguistic-abbreviations.typ new file mode 100644 index 0000000..5c4e370 --- /dev/null +++ b/linguistic-abbreviations.typ @@ -0,0 +1,128 @@ +#let fmnt = smallcaps([fmnt]) + + +/* +Appendix: List of Standard Abbreviations + +1 first person +2 second person +3 third person +A agent-like argument of canonical transitive verb +ABL ablative +ABS absolutive +ACC accusative +ADJ adjective +ADV adverb(ial) +AGR agreement +ALL allative +ANTIP antipassive +APPL applicative +ART article +AUX auxiliary +BEN benefactive +*/ +#let A = smallcaps([a]) +#let all = smallcaps([all]) +#let art = smallcaps([art]) + +/* +CAUS causative +CLF classifier +COM comitative +COMP complementizer +COMPL completive +COND conditional +COP copula +CVB converb +DAT dative +DECL declarative +DEF definite +DEM demonstrative +DET determiner +DIST distal +*/ +#let com = smallcaps([com]) +#let dat = smallcaps([dat]) + +/* +DISTR distributive +DU dual +DUR durative +ERG ergative +EXCL exclusive +F feminine +FOC focus +FUT future +GEN genitive +IMP imperative +INCL inclusive +IND indicative +INDF indefinite +INF infinitive +INS instrumental +INTR intransitive +IPFV imperfective +*/ + +#let du = smallcaps([du]) +#let fut = smallcaps([fut]) +#let gen = smallcaps([gen]) +#let inf = smallcaps([inf]) +#let ins = smallcaps([ins]) + +/* +IRR irrealis +LOC locative +M masculine +N neuter +N- non- (e.g. NSG nonsingular, NPST nonpast) +NEG negation, negative +NMLZ nominalizer/nominalization +NOM nominative +OBJ object +OBL oblique +P patient-like argument of canonical transitive verb +PASS passive +PFV perfective +PL plural +*/ + +#let obl = smallcaps([obl]) +#let neg = smallcaps([neg]) +#let obj = smallcaps([obj]) +#let pl = smallcaps([pl]) +/* +POSS possessive +PRED predicative +PRF perfect +PRS present +PROG progressive +PROH prohibitive +PROX proximal/proximate +PST past +PTCP participle +PURP purposive +Q question particle/marker +QUOT quotative +RECP reciprocal +REFL reflexive +*/ +#let P = smallcaps([p]) +#let pos = smallcaps([pos]) +#let prog = smallcaps([prog]) +#let pst = smallcaps([pst]) + +/* +REL relative +RES resultative +S single argument of canonical intransitive verb +SBJ subject +SBJV subjunctive +SG singular +TOP topic +TR transitive +VOC vocative +*/ + +#let sg = smallcaps([sg]) +#let sbj = smallcaps([sbj])