Obsługa skrótów

Jak działa wykrywanie skrótów

Snapper używa wykrywania granic zdań Unicode UAX #29 jako punktu wyjścia. UAX #29 czasem dzieli tekst przy kropkach należących do skrótów, a nie zakończeń zdań. Snapper przetwarza wyniki dzielenia, łącząc segmenty, w których podział wystąpił przy znanym skrócie.

Select a language with --lang to use the appropriate abbreviation set:

snapper --lang de paper.tex    # German abbreviations
snapper --lang fr article.md   # French abbreviations

Available languages: en (default), de, fr, is, pl. Set in config: lang = "de" in .snapperrc.toml.

Built-in abbreviations (English, default)

Tytuły i zwroty grzecznościowe

Mr., Mrs., Ms., Dr., Prof., Sr., Jr., St., Rev., Gen., Gov., Sgt., Cpl., Pvt., Capt., Lt., Col., Maj., Cmdr., Adm.

Naukowe

Fig., Figs., Eq., Eqs., Ref., Refs., Tab., Sec., Ch., Vol., No., Nos., Ed., Eds., Trans., Dept., Thm., Lem., Prop., Def., Cor., Rem., Ex.

Łacińskie

e.g., i.e., et al., cf., etc., viz., ibid., ca., approx., v.s.

Czas i daty

Jan., Feb., Mar., Apr., Jun., Jul., Aug., Sep., Oct., Nov., Dec., Mon., Tue., Wed., Thu., Fri., Sat., Sun., a.m., p.m.

Popularne

vs., misc., est., govt., dept., univ., inc., corp., ltd., Ave., Blvd., Rd., pp., pg., pt., pts.

Jednoliterowe inicjały

  1. od A. do Z. (dla nazwisk typu J. K. Rowling).

Journal titles (every language)

Reference lists print journal titles in ISO 4 form, as a run of abbreviated words (J. Chem. Phys., SIAM J. Sci. Comput., ACM Trans. Math. Softw.). ISO 4 abbreviates the same words whatever the language, so this list applies under every --lang:

Acad., Adv., Am., Anal., Angew., Annu., Appl., Arch., Astron., Astrophys., Biochem., Biol., Biophys., Bull., Catal., Chem., Chim., Clin., Comb., Commun., Comp., Comput., Crystallogr., Curr., Electrochem., Electron., Eng., Environ., Eur., Exp., Geophys., Ind., Inf., Inorg., Instrum., Int., Jpn., Lett., Lond., Macromol., Mater., Math., Mech., Med., Microsc., Mol., Nanotechnol., Natl., Nucl., Numer., Opt., Optim., Philos., Photochem., Phys., Polym., Proc., Psychol., Rep., Res., Sci., Ser., Simul., Soc., Softw., Spectrosc., Stat., Struct., Surf., Syst., Technol., Theor., Thermodyn.

Words that also end ordinary sentences (Front., Org., Ann.) are left out. A run still holds across them: a capitalised word and its period stay joined to the next piece when that piece opens with a listed journal word, so Front. Chem. 8 and J. Org. Chem. stay on one line. A title or a figure reference after the period still opens a sentence, so We used Python. Fig. 3 shows splits. Add a missing journal word with extra_abbreviations.

German abbreviations (--lang de)

Hr., Fr., Dr., Prof., Abb., Bd., Hrsg., Kap., Nr., S., Verl., Aufl., Jg., Anm., Anh., Beil., Tab., Gl., Abschn., Bsp., Str., Pl., bzw., ca., etc., evtl., ggf., vgl., usw.

Multi-word: z.B., d.h., u.a., o.g., s.o., u.U.

French abbreviations (--lang fr)

M., Mme., Mlle., Dr., Prof., Me., fig., eq., chap., vol., p., pp., ed., trad., n., t., av., apr., env., cf., etc.

Multi-word: c.-a-d., p.ex.

Icelandic abbreviations (--lang is)

Hr., Fr., Dr., sbr., frk., sk., nr.

Multi-word: m.a., o.fl.

Polish abbreviations (--lang pl)

dr., mgr., prof., doc., rys., tab., wyd., red., t., s., nr., poz., zob., por., ul., al., pl., os.

Multi-word: m.in., t.j., j.w., t.zw., b.r.

Dodawanie skrótów specyficznych dla projektu

Utwórz plik .snapperrc.toml w katalogu głównym projektu:

extra_abbreviations = ["GROMACS", "LAMMPS", "DFT", "VASP", "Abstr", "Suppl"]

Są one łączone z wbudowaną listą w czasie wykonywania.

Ochrona tokenów inline

Kropki wewnątrz tokenów inline nigdy nie powodują podziału zdań, niezależnie od list skrótów:

  • Linki Org: [[https://example.com][Ex. Site]]

  • Org macros: {{{cite(Smith. 2020)}}}, {{{title}}}

  • Org radio / angle targets: <<<the Fourier. transform>>>, <<sec. intro>>

  • Org inline footnotes: [fn:: the Fourier. transform], [fn:note: the Fourier. transform]

  • RST substitution references: |fig. 1|, |version|, |name|_, |name|__

  • LaTeX math: $x = 3.14$, \( x = 1. \), \(\alpha. \beta\)

  • LaTeX commands: \cite{smith.2024}, \sqrt[2]{a. b}

  • Markdown links: [Example Inc.](url), [the Fourier. transform][wiki]

  • Kod inline: ~std.io.Read~,

Tokeny te są zastępowane bezpiecznymi symbolami zastępczymi przed wykryciem zdań i przywracane po zakończeniu.