Digital resources in the Social Sciences and Humanities OpenEdition Our platforms OpenEdition Books OpenEdition Journals Hypotheses Calenda Libraries OpenEdition Freemium Follow us

FROM LEGACY FORMATS AND DATABASES TO TEI: Converting the Academy of Sciences Portuguese Dictionary to TEI Lex-0

Ana de Castro Salgado
NOVA CLUNL
Lisbon, Portugal

1. Project
In Portugal, the last, unique and complete print edition of an academic Portuguese dictionary was published in 2001. At that time, the authors decided on a computational approach, developing a database using Microsoft Access. In 2015, the Academy wanted a new dictionary. With the goal of updating the dictionary, making it available through the web, a team was put together in order to develop a database and prepare a back-end to manage the revision, through a protocol between the Academy and a computer science team of the University of Minho, Portugal. 
The only media that survived these last 15 years was the PDF that originated the printed version. The inexistence of a database led us to convert the print version into an XML document and, later on, to import the data into a SQL database (eXist-db). The next step was to transform the obtained document into a valid XML file. Instead of trying to define our own XML format, we decided to target the Text Encoding Initiative, with a syntax adapted to our needs. Now, to create, edit, delete and validate entries, we are using Oxygen XML Editor (Simões et al., 2016).
I’m coordinating the Portuguese Academy Dictionary and I’m also a researcher at NOVA CLUNL (Lisbon, Portugal), and my interest in following the Lexical DataMasterclass 2018 was to switch the Academy of Sciences Portuguese Dictionary to TEI-Lex0 format, deepen my knowledge in managing digital data as online resources and improving my competences in XML editors.

2. Workflow
During this week, I worked on the normalization of a pre-TEI export from the database within which the Academy of Sciences Portuguese Dictionary was encoded.
A lot of procedural aspects were identified. All of them were documented since they are very important to proceed with my project’s work.
«TEI Lex-0 should not be thought of as a replacement of the Dictionary Chapter in the TEI Guidelines or as the format that must be used for editing or managing individual resources, […] should be primarily seen as a format that existing TEI dictionaries can be univocally transformed to in order to be queried, visualised, or mined in an uniform way.»(cf. [Romary, 2015])
We worked in Oxygen XML editor and with a TEI Lex-0 schema.

a) The TEI Header
After attending the session («Introduction to encoding dictionaries withthe TEI guidelines», by Laurent Romary), the first output was a full-fledged TEI header.

b) Typology of entries
The first step was to identify the structural components of the dictionary. I only considered an entry (the core of all lexicographic encoding) of each type.
The lexical units could be: a Portuguese/foreign single word (trimensário, workshop); a Portuguese/foreign compound word (decreto-lei, self-government); a morpheme (ab-, (-)carpo(-),-agem); a multiword expression (bilhete de identidade; pena capital); a phrase (fiat lux); an abbreviation (Ag, Cf., VIP). Each of these different types of entries were encoded in TEI-Lex0.
I also analysed some «special entries», like: part of speech homonymous (capital1, capital2, capital3, etc.); homographs (bola1 /ó/, bola2 /ô/); two variant forms (ouro, oiro); trademarks…
The goal was to model and create a standard format for each of the different entries types.

c) ACL Dictionary Schema (XML changings)
In the context of TEI-Lex-0, the elements “entryFree”, “superEntry”,“hom” are not allowed. To encode the basic element of the dictionary (the entry) microstructure that groups all the information, we use only “entry” (compounds, phrases, homographs) with these attributes “xml:id” and “xml:lang”. The entries invariably start with a lemma, so we use now <form type=”lemma”, and no <term>.

A typical entry has a structure like this:
<entry>
    <form type=”lemma”>…
      <orth>
    </form>
        <gramGrp>
          <pos>…
         <gen>…
      </gramGrp>…
         <sense…
   </entry>

d) Data worked in the sessions
I reviewed the proper use of several elements (cf. see the images below with some examples).

One of our goals was to know how we could encode multiword expressions, such as “poço de ciência” or “pena capital”, and now they are seen as real entries:

          <orth>capital</orth>
            <lbl>:1</lbl>
              <pron>kɐpitˈał</pron>
               </form>
             <gramGrp>…
              <entryxml:id=”DACL.PENA.CAPITAL” xml:lang=”pt”>
                 <form>
               <orth>pena capital</orth>
              </form>
             </entry>

Prepositions also deserved our attention. The microstructure of prepositions entries is very specific, so the creation of a script has not proved very adequate. The number of entries classified as preposition is 43 therefore the correction can be manually.

Pre-TEI export:

Convert to TEI Lex-0 format:

Another issue was to record the forms that have been impacted by the Portuguese spelling reform that concerns the Community of Portuguese Speaking Countries and how it impacts lexicographical outputs.

We would like to emphasize that our customization of the TEI Lex-0 dictionary module has proved to be a good module to this lexicographic work.

Some examples of encoding of lexicographic information in TEI-Lex0 can be found here: https://github.com/DARIAH-ERIC/lexicalresources/blob/master/Events/LexMC2018/Participants/Salgado,%20Ana/Test_ACL_TE_ILex0L.xml

3. Future work
Continue working on the adaptation.
How to differentiate collocations from lexical co-occurrences in the encoding?
Deep encoding of etymological information.
More illustrative samples
Test with the TEI-Lex0 schema updates.
Comment what is missing.
Fix what is wrong.

Special thanks
The sessions were amazing, very useful and the instructors (Laurent Romary, Toma Tasovac, Jack Bowers, Axel Herold) were relentless. Thank you also to Charly Moerth for his fabulous keynote on Arabic dictionaries developed at the Austrian Centre for Digital Humanities of the Austrian Academy of Sciences. In the near future, I would like to attend GROBID-Dictionaries workshop series with Mohamed Khemakhem. With so much work ahead, switching the Academy of Sciences Portuguese Dictionary to TEI-Lex0 format, I had to make an option. I hope there are more workshops in the near future.
Last but not least, I am very grateful to my PhD supervisor’s, Rute Costa (NOVACLUNL), for all her guidance and great inspiration.

References
DLPC = Dicionário da Língua Portuguesa Contemporânea, 2001, João Malaca Casteleiro (coord.), 2 vols. Lisboa: Academia das Ciências de Lisboa & Editorial Verbo.
TEI Consortium, eds. (2016). TEI P5: Guidelines for Electronic Text Encoding and Interchange. [Version 3.1.0]. [Last updated on 15th December 2016]. TEI Consortium. URL: http://www.tei-c.org/Guidelines/P5/.
Alberto SIMÕES, J. J. ALMEIDA, A. SALGADO, 2016. Building a Dictionary using XML Technology. In Marjan Mernik, José Paulo Leal e Hugo Gonçalo Oliveira, Eds., 5th Symposium on Languages, Applications and Technologies (SLATE’16), vol. 51 of OpenAccess Series in Informatics (OASIcs), pp. 14:1-14:8, Dagstuhl, Germany. Schloss Dagstuhl-Leibniz-Zentrum fur Informatik. DOI: http://dx.doi.org/10.4230/OASIcs.SLATE.2016.14.
Jack BOWERS and Laurent ROMARY, «Deep Encoding of Etymological Information in TEI», Journal of the Text Encoding Initiative [Online], Issue 10 | 2016. URL: [http://journals.openedition.org/jtei/1643]
Piotr BAŃSKI, Jack BOWERS, Tomaz ERJAVEC, «TEI-Lex0 guidelines for the encoding of dictionary information on written and spoken forms», Electronic Lexicography in the 21st Century: Proceedings of ELex 2017 Conference, Sep 2017, Leiden, Netherlands. 〈hal-01757108>