<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>An Exploration of Datalog Applications to Language Documentation and Reclamation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Anita Baral</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Pratiksha Shrestha</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jitendra Sharma</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hunter Lockwood</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniela Inclezan</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Miami University</institution>
          ,
          <addr-line>Oxford, OH</addr-line>
          <country country="US">USA</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Myaamia Center</institution>
          ,
          <addr-line>Oxford, OH</addr-line>
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <fpage>23</fpage>
      <lpage>29</lpage>
      <abstract>
        <p>Language documentation and reclamation involve the systematic recording, preservation, analysis, and revitalization of endangered or dormant languages to safeguard linguistic diversity and cultural heritage. This paper explores the application of Datalog in these eforts, with a particular focus on the Myaamia language. We introduce a stem decomposition tool designed for the Myaamia language, highlighting its contributions to both the documentation process and the testing of linguistic hypotheses. Our tool uses the DLV system.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;DLV</kwd>
        <kwd>linguistics</kwd>
        <kwd>Language Documentation and Reclamation</kwd>
        <kwd>Datalog</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>possibilities; enabling testing of linguistic theories; and facilitating the identification of errors in the
database for improved documentation.
2. Stem Decomposition for Myaamia Language
Let us start by introducing some linguistic terms. A stem is a part of a word responsible for its lexical
meaning. A morpheme is the smallest meaningful constituent of a linguistic expression. An afix
is a morpheme that is attached to a word stem to form a new word or word form. Afixes could be
derivational (leading to the formation of a new word with a new meaning and possibly a diferent
syntactic category) or inflectional (expressing some grammatical category such as tense, person, number,
gender, etc.). Stem decomposition is the process of breaking words into their stem and afixes.</p>
      <p>Here, we present a tool for derivational stem decomposition for the Myaamia language, developed
using Datalog (specifically the DLV system) and Python. The tool’s underlying process is described in
Figure 1. Initially, information about stems and morphemes is downloaded from the ILDA Database
in the form of csv files ( stems.csv and morphemes.csv respectively) that are pre-processed by a Python
script to produce a Datalog program consisting of facts, facts.lp. This file together with an additional
Datalog program in which we encode the stem decomposition rules of Myaamia language, stemmer.lp,
are fed together into the DLV system. The resulting answer sets are post-processed by a second Python
script that produces a more readable output in a format adapted from linguistics scholars, a so-called
interlinear gloss [7].</p>
      <p>Next, we provide further details about the tool’s main Datalog components.
3. Datalog Encoding of Facts about Stems and Morphemes: facts.lp
ILDA Database entries for both stems and morphemes consist of a unique ID, the stem/morpheme itself
in Myaamia language, its English translation, an identifier denoting its part-of-speech classification,
and other fields not relevant to our task. Some examples of stems are nawi- meaning “go get (?)” and
apikaateesi- meaning “warm one’s feet.” In Algonquian languages like Myaamia, morphemes can be
initial, medial, or final, which is noted in the ILDA Database by a dash symbol at the position where the
morpheme may be attached to other morphemes/stems. Some examples of morphemes as specified in
the ILDA Database are:
• initial: naw- meaning “go and, andative” ; ap- meaning “warm”
• medial: -ikaatee- meaning “foot”
• final : -i indicating an “abstract final” ; -esi meaning “by heat”</p>
      <p>We use the predicate  to denote Myaamia stems coming from the stems.csv file, and the predicates
, , and   for the three diferent types of Myaamia morphemes in the morphemes.csv
ifle. Each stem or morpheme is represented as a list of characters and the dash symbol is omitted, as
shown in the facts below:</p>
      <p>Additionally, we capture the other pieces of information for stems and morphemes using a predicate
 with four parameters: the Myaamia stem/morpheme, its type (which could be stem, initial,
medial, or final), its English translation, and its part-of-speech classification. Here are the glosses
for the stem and morphemes introduced above:
gloss(["n","a","w","i"], stem, "go get (?)", "v.an.intran").
gloss(["a","p","i","k","a","a","t","e","e","s","i"], stem, "warm one's feet",
"v.an.intran").
gloss(["n","a","w"], initial, "go and, andative", "initial").
gloss(["a","p"], initial, "warm", "initial").
gloss(["i","k","a","a","t","e","e"], medial, "foot", "medial").
gloss(["i"], final, "abstract final", "an.intran.final").
gloss(["e","s","i"], final, "by heat", "an.intran.final").
4. Derivational Stem Decomposition: stemmer.lp
Our Datalog encoding makes use of the following built-in list predicates from DLV:
• #(, , ) –  is a list obtained by appending the elements of  to 
• #ℎ(,  ) –  is the size of list 
• #ℎ(, , ) –  is the element at position  in list 
• #ℎ(, , ) –  is a list obtained by deleting the element of list  at position</p>
      <sec id="sec-1-1">
        <title>4.1. Primary Derivation</title>
        <p>In Myaamia, a stem can be derivationally decomposed according to the following three cases outlined
by Goddard [8]:</p>
        <sec id="sec-1-1-1">
          <title>1. The stem itself is an initial morpheme. 2. The stem is an initial morpheme followed by a final morpheme. 3. The stem is an initial morpheme, followed by a medial morpheme, followed by a final morpheme.</title>
          <p>Each case is encoded by a rule for predicates _1, _2, and _3,
respectively:
decompose_1(S, S) :- initial(S), stem(S).
decompose_2(S, I, F) :- #append(I, F, S), initial(I), final(F), stem(S).
decompose_3(S, I, M, F) :- #append(I, M, T), #append(T, F, S), initial(I),
medial(M), final(F), stem(S).</p>
          <p>Next, we define a set of predicates that make the output of the Datalog program more readable. These
predicates gather information about the English translation and the part-of-speech classification of the
morphemes into which a stem is decomposed, as illustrated by the next rules. Here, variables starting
with T stand for an English translation and variables starting with P denote part-of-speech information:</p>
          <p>The _ atoms in the DLV output serve as input for the post-processing Python code
that generates the actual interlinear gloss in the format illustrated by an example below:
nawi = naw
go and, andative
initial
'go get (?)'
+ i
+ abstract final
+ an.intran.final
The first line of the interlinear gloss specifies the decomposition of a stem into morphemes; the second
line captures the English translation of the morphemes; the third line represents the part-of-speech
classification of the morphemes; the last line is the English translation of the stem to be decomposed.</p>
        </sec>
      </sec>
      <sec id="sec-1-2">
        <title>4.2. Testing Linguistics Theories</title>
        <p>
          The use of Datalog enables linguistics scholars to more easily test theories. We illustrate here a “dropped
w” hypothesis, which says that ‘w’ at the end of a morpheme can be dropped as more morphemes are
appended to it in the stem derivation process in Myaamia. We use new predicates _2_
and _3_ to encode this hypothesis, which allows us to determine whether it leads to any
new decompositions. Note that there are three diferent rules for _3_, for the cases when
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) the initial, (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) the medial, or (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) both the initial and medial morphemes end in ‘w’.
decompose_2_w(S, I, F)
:stem(S), initial(I), final(F), #length(I, N), #getnth(I, N, "w"),
#delnth(I, N, New_I), #append(New_I, F, S).
decompose_3_w(S, I, M, F)
:stem(S), initial(I), medial(M), final(F), #length(I, N), #getnth(I, N, "w"),
#delnth(I, N, New_I), #append(New_I, M, T),#append(T, F, S).
decompose_3_w(S, I, M, F)
:stem(S), initial(I), medial(M), final(F), #append(I, M, T), #length(T, N1),
#getnth(T, N1, "w"), #delnth(T, N1, New_T), #append(New_T, F, S).
decompose_3_w(S, I, M, F)
:stem(S), initial(I), medial(M), final(F), #length(I, N),
#getnth(I, N, "w"), #delnth(I, N, New_I), #append(New_I, M, T),
#length(T, N1), #getnth(T, N1, "w"), #delnth(T, N1, New_T), #append(New_T, F, S).
        </p>
        <p>These rules led to the identification of 107 additional derivations. Around 45% of these fell somewhere
in the range of “plausible (but wrong)” to “absolutely correct” according to Myaamia linguists.</p>
      </sec>
      <sec id="sec-1-3">
        <title>4.3. Secondary Derivation</title>
        <p>In Myaamia and other Algonquian languages, secondary stem decomposition occurs when a stem
created through primary derivation (as described so far) is further extended with a sufix to form a new
stem. There is a limited number of sufixes used for secondary derivation. One such sufix is -aakan,
which indicates an instrument. We mark these via the predicate __  as in
the example:</p>
        <sec id="sec-1-3-1">
          <title>The rule for secondary derivation then becomes:</title>
          <p>sec_decompose(S, S1, F)
:</p>
          <p>stem(S), stem(S1), secondary_derivation_final(F), #append(S1, F, S).</p>
          <p>An example of a secondary derivation is niimaakan- (“flag” ), decomposed as illustrated by the
interlinear gloss below, where niim- is an instance of the first case of primary derivation (i.e., the stem
itself is an initial morpheme):
niimaakan = niim + aakan</p>
          <p>Carry him aloft (in hand) + instrument
v.tran.an + n.final
'Flag'</p>
          <p>Another example is maawihšinaakan- meaning “band, hunting party,” obtained through secondary
derivation from the stem maawihšin- and the sufix -aakan:
maawihšinaakan = maawihšin + aakan
head of a band or hunting party + instrument
v.an.intran + n.final
'band, hunting party'
where maawihšin- is obtained through primary derivation as follows:
maawihšin = maaw + ihšin
together, collect + be in position, lie
initial + an.intran.final
'head of a band or hunting party'</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>5. Discussion</title>
      <p>The stem decomposition tool ofers three key contributions to Myaamia language documentation and
reclamation:
1. It encourages new perspectives on how words may have been derived.
2. It enables the testing of linguistic theories, such as the “dropped w” hypothesis discussed earlier.
3. It enhances the documentation process by identifying errors or inconsistencies in the ILDA</p>
      <p>Database.</p>
      <p>We include here a few examples of ILDA Database inconsistencies that were detected by the stem
decomposition tool.</p>
      <p>Example 1: The morpheme eeli with the meaning “by boat” was marked incorrectly as a medial
morpheme in the database via the use of dashes, as in -eeli-. Instead, this should have been marked as a
ifnal morpheme, stated as -eeli. This issue was detected by analyzing the decomposition shown below
for the stem ciileelim- meaning “like him, think well of him, think highly of him.” Note the incompatibility
between the meanings of the morphemes (second line of the interlinear gloss) and the meaning of the
decomposed stem (on the last line of the interlinear gloss):
ciileelim = ciil + eeli + m
intense + by boat + (abstract final)
initial + tran.an.final + tran.an.final
'Like him, think well of him, think highly of him'
The correct decomposition, also identified among the results from our tool, is:
ciileelim = ciil + eelim
intense + by thought
initial + tran.an.final
'Like him, think well of him, think highly of him'
Example 2: Some incorrect part-of-speech annotations of morphemes were detected. Such observations
can speed up the database cleaning and consolidation process. For instance, the morpheme
alamonwas discovered to have duplicate entries, one marked as an initial morpheme, the other as an inanimate
noun, in terms of the part-of-speech information.</p>
      <p>Example 3: Another observation facilitated by our tool was that stems used in secondary derivation
were entered into the ILDA Database’s morpheme table, along with their part of speech information.
This contrasts with the usual practice of labeling morphemes’ part of speech information as ,
, or  , thus prompting a cleanup of the morpheme table.</p>
    </sec>
    <sec id="sec-3">
      <title>6. Challenges and Opportunities</title>
      <p>Our initial exploration indicated some areas of improvement for our stem decomposition tool. Some
decompositions were deemed incorrect by Myaamia linguists due to a mismatch in parts-of-speech
between the morphemes combined to form a stem. For instance, the following decomposition for the
stem nawi- is incorrect because an ‘adverb formative’ cannot be added to a verb; it can only be added to
an adverb.
nawi = naw + i
go and, andative + adverb formative
initial + final
'go get (?)'</p>
      <p>Other decompositions were mistakenly identified as derivational when they were, in fact, inflectional.
For example, the tool incorrectly decomposed alamoni- (“red ocher, paint, vermillion” ), as shown below:
alamoni = alamon + i
ochre, vermillion + abstract final
n.inan + an.intran.final
'red ocher, paint, vermillion'
when, in this case, the final -i is an inflection for nouns that marks gender.</p>
      <p>Some derivations went undetected by our tool because phonological transformations occur when
morphemes are attached to stems, adhering to the language’s phonological rules. For instance, the
decomposition of apikaateesi- (“warm one’s feet” ) into ap- + -ikaatee- + -esi was missed by the tool, as
the stem appears with only two e’s instead of three, following the application of surface phonological
rules.</p>
      <p>A final source of incorrect decompositions was a meaning mismatch between the individual
morphemes assumed to combine to form a stem. Here is one such example (see the second and last lines of
the interlinear gloss):
niimantam = niim + antam
dance + by mouth
v.an.intran + tran.inan.final
'carry it by mouth'
The morpheme niim- has two potential meanings (i.e., it is a homophone): “dance” and “carry him aloft
(in hand).” The inapplicable meaning was selected in this decomposition. In the future, we intend to
leverage the full expressive power of DLV and expand our initial encoding with constraints that would
prevent invalid decompositions of this type.</p>
      <p>DLV vs DLV2: We encoded stems and morphemes as lists of characters to take advantage of the built-in
list predicates present in DLV. However, such lists are dificult to read. We additionally explored the
use of DLV2 for the stem decomposition application, as DLV2 provides built-in operations for strings.
However, when using strings and DLV2, and working with all stems and morphemes in the ILDA
Database, we experienced decreased performance. The DLV2-based tool would not finish the task even
in an hour, whereas our original DLV-based tool completed it in 28 seconds with a maximum memory
usage of 1,112 MB on a regular laptop. We acknowledge that this would not be an issue if a single stem
would need to be decomposed, which is a valid application, but we note that, for database cleaning or
update operations, a more eficient implementation would be desirable.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gelfond</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          ,
          <article-title>Classical Negation in Logic Programs</article-title>
          and Disjunctive Databases,
          <source>New Generation Computing</source>
          <volume>9</volume>
          (
          <year>1991</year>
          )
          <fpage>365</fpage>
          -
          <lpage>386</lpage>
          . doi:
          <volume>10</volume>
          .1007/BF03037169.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M.</given-names>
            <surname>Kanazawa</surname>
          </string-name>
          ,
          <article-title>Parsing and Generation as Datalog Queries, in: Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics</article-title>
          ,
          <string-name>
            <surname>ACL</surname>
          </string-name>
          ,
          <year>2007</year>
          , pp.
          <fpage>176</fpage>
          -
          <lpage>183</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Inclezan</surname>
          </string-name>
          ,
          <article-title>An application of answer set programming to the field of second language acquisition</article-title>
          ,
          <source>Theory Pract. Log. Program</source>
          .
          <volume>15</volume>
          (
          <year>2015</year>
          )
          <fpage>1</fpage>
          -
          <lpage>17</lpage>
          . doi:
          <volume>10</volume>
          .1017/S1471068413000653.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>P.</given-names>
            <surname>Schüller</surname>
          </string-name>
          , Answer Set Programming in Linguistics, Künstliche Intell.
          <volume>32</volume>
          (
          <year>2018</year>
          )
          <fpage>151</fpage>
          -
          <lpage>155</lpage>
          . doi:
          <volume>10</volume>
          . 1007/S13218-018-0542-Z.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>G.</given-names>
            <surname>Matlatipov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Vetulani</surname>
          </string-name>
          , Representation of Uzbek Morphology in Prolog, in: M.
          <string-name>
            <surname>Marciniak</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          . Mykowiecka (Eds.),
          <source>Aspects of Natural Language Processing: Essays Dedicated to Leonard Bolc on the Occasion of His 75th Birthday</source>
          , Springer Berlin Heidelberg,
          <year>2009</year>
          , pp.
          <fpage>83</fpage>
          -
          <lpage>110</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>642</fpage>
          -04735-
          <issue>0</issue>
          _
          <fpage>4</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J.</given-names>
            <surname>Nerbonne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Konstantopoulos</surname>
          </string-name>
          ,
          <article-title>Phonotactics in Inductive Logic Programming</article-title>
          , in: M. A.
          <string-name>
            <surname>Kłopotek</surname>
            ,
            <given-names>S. T.</given-names>
          </string-name>
          <string-name>
            <surname>Wierzchoń</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          Trojanowski (Eds.),
          <source>Intelligent Information Processing and Web Mining</source>
          , Springer, Berlin, Heidelberg,
          <year>2004</year>
          , pp.
          <fpage>493</fpage>
          -
          <lpage>502</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -39985-8_
          <fpage>58</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>S. L.</given-names>
            <surname>Chelliah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Burke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Heaton</surname>
          </string-name>
          , Using Interlinear Gloss Texts to Improve Language Description,
          <source>Indian linguistics 82</source>
          (
          <year>2021</year>
          ). URL: https://par.nsf.gov/biblio/10383818.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>I. Goddard</surname>
          </string-name>
          , Primary and Secondary Stem Derivation in Algonquian,
          <source>International Journal of American Linguistics</source>
          <volume>56</volume>
          (
          <year>1990</year>
          )
          <fpage>449</fpage>
          -
          <lpage>483</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>