Skip to content

Instantly share code, notes, and snippets.

@cboulanger
cboulanger / evaluation.log
Last active March 3, 2026 10:56
Evaluation results for LLM-based TEI annotation via tei-annotator
uv run scripts/evaluate_llm.py --max-items 10 --show-annotations --output-file .local/evaluate-llm.log --match-mode overlap --provider kisski
────────────────────────────────────────────────────────────────
Provider : Gemini 2.0 Flash
Gold file : tests/fixtures/blbl-examples.tei.xml
Records : 10 match-mode: overlap
GLiNER : disabled
────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────
@cboulanger
cboulanger / grobid.training.segmentation.rng
Last active February 14, 2026 07:30
RNG Schema for validating GROBID *.training.segmentation.tei.xml files
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://relaxng.org/relaxng.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<!--
RNG Schema for validating GROBID *.training.segmentation.tei.xml files
-->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ns="http://www.tei-c.org/ns/1.0">
@cboulanger
cboulanger / adventskalender.py
Last active November 30, 2025 19:47
Adventskalender für drei Personen: jede schenkt jeder jeweils 4 Geschenke, niemand sollte zweimal hintereinander etwas bekommen (sofern lösbar), und eine Person ist an mehreren Tagen abwesend
from datetime import datetime, timedelta
from collections import defaultdict
def solve_advent_calendar():
persons = ['T', 'C', 'K']
c_absent_days = {1, 2, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17}
# Jede Person muss jedem anderen genau 4 Geschenke geben
# T->C: 4, T->K: 4, C->T: 4, C->K: 4, K->T: 4, K->C: 4
gifts_needed = {
@cboulanger
cboulanger / README.md
Last active November 2, 2025 11:58
crossref_to_ris.py

Crossref to RIS Converter

This Python script converts Crossref API bibliographic data into RIS format, specifically designed to handle books with chapters. It enriches chapter records with complete book information (title, editors, ISBN) that is typically missing in the Crossref API response.

Features

  • Fetches bibliographic data from Crossref API using ISBN
  • Generates complete RIS records for both the book and all chapters
  • Includes full book metadata (title, editors, publisher, ISBNs) in each chapter entry
  • Can work with pre-downloaded JSON files when API access is restricted
@cboulanger
cboulanger / grobid.training.segmentation.rng
Created September 23, 2025 10:59
RNG Schema for Grobid's *.training.segmentation files with an optional TEI header
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://relaxng.org/relaxng.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<!--
To validate TEI documents against this schema, add this processing instruction
to the beginning of your TEI document (after the XML declaration):
<?xml-model href="http://localhost:3001/api/files/872ab" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
-->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ns="http://www.tei-c.org/ns/1.0"
@cboulanger
cboulanger / js-plugin.mjs
Created July 14, 2025 07:47
js-plugin as an ESM module
/**
* patched version of https://www.npmjs.com/package/js-plugin
*/
var _plugins = [];
var _byName = {};
var _cache = {};
// Only support debug mode on browser and node, not web workers.
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
@cboulanger
cboulanger / counter.css
Created May 26, 2025 14:45
A CSS-only counter widget
/**
* Displays Countdown clock
* Usage: <div class="countdown" style="--duration-seconds: 15;"></div>
*/
@property --total-seconds-remaining {
syntax: "<number>";
initial-value: 0;
inherits: true;
}
@cboulanger
cboulanger / hedgedoc-slide-quadrant.md
Last active March 19, 2025 07:59
Hedgedoc/Reveal.js Slide Template: Quadrant layout

Lorem ipsum dolor sit amet

Lorem

  • dolor sit amet
  • consectetur adipiscing
  • sed do eiusmod tempor
@cboulanger
cboulanger / reference-extraction-experiment-text-davinci-003.md
Created December 19, 2024 09:50
OpenAI reference extraction via API (text-davinci-003): Code/Result

OpenAI reference extraction via API: Code/Result

December 2022

Code

import openai
import json
import time
@cboulanger
cboulanger / 10.1111_1467-6478.00057.xml
Last active August 17, 2024 20:51
TEI file as auto-generated from AnyStyle XML
<?xml version="1.0" ?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>10.1111_1467-6478.00057</title>
</titleStmt>
<publicationStmt>
<publisher>mpilhlt</publisher>
</publicationStmt>