Skip to content
BrRoman edited this page Nov 4, 2023 · 8 revisions

Welcome to the Accenteur wiki!

This page is designed for developers who want to understand how Accenteur works under the hood.

The most important files are static/js/data.js and static/js/accenteur_core.js. If you want to integrate Accenteur in your own web application, just copy those files where you want, and integrate them into your html page, like this:

<script src="path/to/data.js">
<script src="path/to/accenteur_core.js">

Then you can accentify any latin word in another JS file, calling the accentify function:

accentify("vidimus"); // Expected output: "vídimus".

Below are some details about the code.

Algorithm

The algorithm is quite simple in its outlines:

  • The input text is splitted into words.
  • Each word is split into all the possible couples of roots + terminations.
  • If a root and a termination are consistent, then their accented versions are joined.
  • Finally all the accented words are joined and paste in the output field.

For example: 'Domine' will be successively splitted into:

'' and 'Domine'

'D' and 'omine'

'Do' and 'mine'

'Dom' and 'ine'

'Domi' and 'ne'

'Domin' and 'e'

'Domine' and ''

The couple 'Dom' and 'ine' will be rejected, because, although 'dom' can be the root of 'domus', we can see in the model of 'domus' (model 'domus') that this word can't have the termination '-ine'.

On the contrary, 'domin' + 'e' will be retained, because 'domin' can be the root of 'dominus' (model 'lupus') with the vocative termination of the 'lupus' model.

Accenteur knows the enclitics, and thus he will retain a second combination: 'domi' + 'ne', i.e. 'dom' (from 'domus') + 'i' (locative) + 'ne' (enclitic).

Hence the result in the output field: 'Dómine|Domíne'.

Data

The file accenteur/data.js contains all the data necessary to accentify a latin word (models, roots and terminations).

The folder accenteur/sources/ contains the raw data files extracted from Collatinus (models.la and lemmes.la) and a script to convert them into JS Objects and write these Objects in the file accenteur/data.js.

Clone this wiki locally