<!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>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>A. Kinship Term Possessive Sequences</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>B. Family Tree Visualization</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Alyona Belova Faculty of Infocommunication Technologies ITMO University St. Petersburg</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Anna Golub Faculty of Infocommunication Technologies ITMO University St. Petersburg</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Darya Karmaz Faculty of Infocommunication Technologies ITMO University St. Petersburg</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Gleb Bondarenko Faculty of Infocommunication Technologies ITMO University St. Petersburg</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>-As frequently as they are encountered in texts of various genres, Russian kinship term possessive sequences remain confusing even for the native speakers. The paper presents the authors' original computer science project, whose goal was to suggest a method of extracting such word sequences from a piece of text and visualizing them in an easily comprehensible way. Such an attempt of kinship relations analysis automatization might contribute to future research in history, linguistics, and literary studies and be of use to those studying Russian as a foreign language.</p>
      </abstract>
      <kwd-group>
        <kwd>kinship term</kwd>
        <kwd>possessive structure</kwd>
        <kwd>family tree</kwd>
        <kwd>natural language processing</kwd>
        <kwd>Russian</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        Russian possessive sequences including several kinship
terms (e. g. сестра мужа моей тёщи — my mother-in-law’s
husband’s sister, бабушка шурина его брата — his
brother’s brother-in-law’s grandma) often appear confusing
in written text as well as in oral speech since it is difficult to
quickly calculate the relations between the relatives
mentioned. Besides, such phrases often include names of
relatives by marriage (тёща — a wife’s mother, шурин — a
wife’s brother, etc.). Those kinship terms are becoming
increasingly obsolescent in modern Russian as they only
constitute for 1.4 per cent of all kinship term entries in Russian
National Corpus [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] in 1990—2020. Therefore, appearing in
a sequence, they make it even harder to comprehend.
      </p>
      <p>The goal of the authors’ original computer science project
was to create a computational tool that would extract the
sequences in question from a given piece of text and visualize
them in an easily comprehensible way. Such an attempt of
kinship relations analysis automatization might contribute to
future research in history, linguistics, and literary studies, e. g.
scientific analysis and systematization of fiction and memoirs.
Moreover, this technology might be utilized by those studying
Russian as a foreign language in order to ease the process of
Russian kinship terms’ meaning comprehension and
memorization.</p>
      <p>The following text processing stages were suggested for
the computational tool:
1. finding kinship term possessive sequences in the
given text;</p>
      <p>
        In terms of visualization, there are many software tools
that are suitable for depicting family trees. To begin with,
specialized packages (e. g. ggenealogy [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]) provide plotting
methods for genealogical data. However, the hierarchical
nature of a structure does not allow horizontal edges and node
skipping, which are required for valid representation of
relationships in kinship term possessive sequences. This is
accurate for the libraries with more general visualizing
functionality (e. g. Graphviz [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], Plotly [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], Toytree [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]) as
well. Furthermore, these visualization tools have rather
limited customization options while the goal was to display
confusing lineages in the most efficient way.
      </p>
      <p>
        Additionally, to our knowledge, some other family tree
visualization tools appropriate for the assigned task [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] are
unfortunately unavailable for public use.
      </p>
      <p>
        Moreover, there is genealogy software with intuitive
family tree builders for illustrating pedigrees (e.g. Family
Historian, Legacy Family Tree, etc. [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]). Despite the
representation of kinship relationships in a comprehensive,
visually organized manner, these applications require user
interaction, which makes automatic visualization significantly
more complicated.
      </p>
      <p>
        Taking all of the aforementioned into account, we decided
to use NetworkX [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and Matplotlib [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] to develop our own
visualization algorithm best fitting the requirements.
      </p>
    </sec>
    <sec id="sec-2">
      <title>III. SOLUTION</title>
      <sec id="sec-2-1">
        <title>A. Text Search</title>
        <p>
          All the source code is written in Python. At first, using
NLTK, a Python library for natural language processing [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ],
the given piece of text is split into sentences; then each of them
is tokenized into words. Next, employing pymorphy2 [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] for
part-of-speech tagging and further morphological analysis,
continuous word sequences are extracted from sentences. At
this point the sequences consist of:
• one or more kinship terms, the first one of them in any
case while all the rest in the genitive case exclusively;
• certain kinds of modifiers, namely long- or
shortformed adjectives and participles, ordinal numerals
and adjective pronouns;
• not more than one non-kinship noun in the genitive
case. If included, this word is the last one in the
sequence (see sequence type 4 below).
        </p>
        <p>Afterwards, each of the sequences is recognized as one of
the sequence types listed below, which depict most instances
of kinship term possessive sequences in Russian. The GEN
abbreviation stands for the genitive case while  signifies the
possible number of the word’s occurrences.</p>
        <sec id="sec-2-1-1">
          <title>1. possessive adjective / possessive pronoun + kinship term (GEN)</title>
          <p>Example: бабушкиному мужу
grandma's husband
‘grandma’s husband’</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>2. kinship term</title>
          <p>+ kinship term (GEN)  = 0,1,2..
+ possessive adjective / possessive pronoun
+ kinship term (GEN)</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>Example: муж бабушки моей сестры</title>
        <p>husband grandma my sister
‘my sister’s grandma’s husband’</p>
        <sec id="sec-2-2-1">
          <title>3. kinship term</title>
          <p>+ kinship term (GEN)  = 0,1,2..</p>
          <p>+ possessive adjective / possessive pronoun
Example: мужа бабушки сестры
husband grandma sister
‘my sister’s grandma’s husband’
моей
my</p>
        </sec>
        <sec id="sec-2-2-2">
          <title>4. kinship term</title>
          <p>+ kinship term (GEN)  = 0,1,2..
+ noun (non-kinship) (GEN)</p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>Example: мужем бабушки подруги</title>
        <p>husband grandma friend
‘friend’s grandma’s husband’</p>
        <sec id="sec-2-3-1">
          <title>5. kinship term</title>
          <p>+ kinship term (GEN)  = 0,1,2..</p>
        </sec>
      </sec>
      <sec id="sec-2-4">
        <title>Example: мужу бабушки сестры</title>
        <p>husband grandma sister’s
‘sister’s grandma’s husband’
Then, the sequence is cast to the so-called normal form:
• kinship terms are put in the nominative singular form;
• non-kinship nouns are put in the nominative case with
the number unchanged;
• possessive adjectives are replaced with their stem
nouns in the nominative singular form;
• possessive pronouns are replaced with the
corresponding personal ones in the nominative case
(the forms of the свой pronoun are substituted by
некто).</p>
        <p>Afterwards, the sequence is reshuffled so as to put the
words in the direct relation order (see examples below). If the
sequence then starts with a kinship term, the first-person
singular pronoun я is inserted into the beginning.</p>
        <p>Examples:
a. бабушкиному мужу — я бабушка муж
grandma’s husband — me grandma husband
b. мужу бабушки сестры моей — я сестра
husband grandma sister my — me sister
бабушка муж
grandma husband</p>
        <p>Thus, all the words in the sequence, except for the first
one, turn out to be kinship terms in the nominative singular
form. Preprocessed this way, the sequence is fit for further
analysis.</p>
      </sec>
      <sec id="sec-2-5">
        <title>B. Kinship Relations Analysis</title>
        <p>For each word in the sequence, except for the first one, the
following actions are performed.</p>
        <p>First, a graph fragment template is uploaded. The template
presents the relationship between this and the previous
character in the sequence. Here, by character we mean any
relative in the chain of connections described by the sequence.
Within the template all the characters are connected directly,
either through parent—child or wife—husband type of
connection. See the сестра (sister) template below as an
example.</p>
        <p>Next, the template is incorporated in the graph that has
been built so far, namely the root of this template is aligned
with the top of the previous one. Here, by the template top we
mean the character signified by this template’s corresponding
word. In turn, the template’s root is the character whose
relation to the top of the template is being described by the
template word. (In the sister template above я (me) is the root
while сестра (sister) is the top.) Consequently, by the tree
root we mean the root of the first template and by the tree top
the top of the last template included in the graph. See example
below: the бабушка (grandmother) template being aligned
with the сестра (sister) template. (For now, we only discuss
the maternal grandmother.)</p>
        <p>Finally, if multiple nodes of the graph correspond to the
same character of the sequence, they are merged into one.
Such cases are unraveled based on the heuristic that each
character may only have one mother and one father. The graph
above is thus transformed into the following one.</p>
        <p>Thus, in the resulting graph all the characters are
connected directly to each other. It is worth mentioning that
due to linguistic polysemy, the relationship reflected in a
kinship term might be described by a few different templates
(e. g. in the above example the grandmother might be both
maternal and paternal). Consequently, several graph structures
are built, considering all the possible template combinations
for the kinship terms in the sequence.</p>
      </sec>
      <sec id="sec-2-6">
        <title>C. Graph Visualization</title>
        <p>The family trees are drawn using NetworkX and
Matplotlib in Python. All the edges of the graph are added to
the list in the loop that goes through the characters and their
connections. The root node gets zero coordinates, for other
nodes the following rules apply:
• parent is positioned one point higher than their child;
• child is positioned one point lower than their parent;
•
wife/husband is drawn at the same level and one point
to the right from their spouse;
• if the determined spot is already taken, the node is
shifted one point to the right.</p>
        <p>As to colors, the following rules apply:
• for the tree top and the tree root nodes, blue color is
used;
• otherwise, if the character is directly mentioned in the
kinship term sequence, the node has a light blue color;
• if there is no direct mention of the character, the node
is painted light gray.</p>
        <p>The gender is displayed through the shape of the nodes:
circles for females, squares for males; a rhombus is used for
the root node. As a result, a PNG file presents the graph with
a gray background, the kinship term sequence and the original
sentence. The file is the final program output. See the
visualization of the sequence муж бабушки моей сестры
(my sister's grandmother's husband) as an example.</p>
        <p>In order to evaluate the tool’s performance, it was run on
a purposefully collected corpus of texts, selected manually
from the Russian National Corpus. The corpus consists of
3067 words and includes at least five entries of each of the
kinship terms while keeping a rough balance between the
sequence types.</p>
        <p>For text search evaluation, each kinship term possessive
sequence in the corpus was manually classified as follows:
•
•</p>
        <p>True Positive — the sequence was found, and its
boundaries were identified correctly;
• False Positive — the sequence was found, but extra
words were included;
True Negative — there are no sequences in the
sentence, and none were found;
• False Negative — the sequence was found, but some
necessary words were excluded.</p>
        <p>The precision and recall scores were then calculated,
turning out 0.96 and 0.93 respectively.
input data; however, suggested paths for further development
might push its limits significantly.</p>
        <p>Then, for each of the sequences found by the program the
graphs were drawn to evaluate the kinship relations analysis
and visualization. For each of the sequences, the number of
expected and present correct visualizations was estimated
manually with the resulting accuracy score being 0.95.</p>
      </sec>
      <sec id="sec-2-7">
        <title>B. Discussion</title>
        <p>As the evaluation test has outlined flaws in the tool’s
performance, a few areas for future work are suggested.
•
•
•
•
•</p>
        <p>Processing proper names. As for now, the tool cannot
correctly process input sequences including first name
+ patronym collocations (e. g. сын Анны Ивановны —
Anna Ivanovna’s son) or abbreviated name forms (e. g.
сын Вл. Набокова — V. Nabokov’s son).</p>
        <p>Broadening the range of sequence types. For example,
the tool cannot correctly process the sequence below
because it does not fit any of the sequence type
schemas.
a.</p>
        <p>шурина моего
wife’s brother my
‘my wife’s brother’s son’
сын
son
Adding context analysis features for
differentiation between the sequence types.
better
Updating the template approach. At the relations
analysis stage, complex kinship terms can be replaced
with their simpler explanations, e. g. turning тёща
(mother-in-law) into мать жены (a wife’s mother),
allowing to only store templates for the basic kinship
terms, namely parents, children, siblings and spouses.
• Identifying coreference. At this point, the program
does not register several words referring to the same
character as in сын моего отца (my dad’s son) and is
unable to depict that in the graph.</p>
        <p>Making the tool adjustable for other languages by
eradicating the language dependencies in the code.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>V. CONCLUSION</title>
      <p>This paper has presented kinship term possessive
sequences as a field for natural language processing
development, presenting the authors’ original tool for the
sequences’ human-readable visualization. The program
appears quite efficient and performs well on a broad range of
The project source code is available on github. The
evaluation corpus, as well as the list of kinship terms
processed by the program, can also be viewed there.</p>
      <p>The tool is also available for public use as a Python
package. As for now, the users are able to:
•
•
•
extract sequences from a given piece of text;
build a graph upon a given sequence;
visualize an already-built graph or sequences from a
given piece of unprocessed text.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>[1] https://ruscorpora.ru/new/</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Dahl</surname>
            ,
            <given-names>Östen</given-names>
          </string-name>
          &amp;
          <string-name>
            <surname>Koptjevskaja-Tamm</surname>
            ,
            <given-names>Maria.</given-names>
          </string-name>
          (
          <year>2001</year>
          ).
          <fpage>11</fpage>
          . Kinship in grammar.
          <volume>10</volume>
          .1075/tsl.47.
          <year>12dah</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Paykin</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>van Peteghem</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <article-title>External vs</article-title>
          .
          <source>Internal Possessor Structures and Inalienability in Russian. Russian Linguistics</source>
          <volume>27</volume>
          ,
          <fpage>329</fpage>
          -
          <lpage>348</lpage>
          (
          <year>2003</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Jones</surname>
            ,
            <given-names>Doug.</given-names>
          </string-name>
          (
          <year>2010</year>
          ).
          <article-title>Human kinship, from conceptual structure to grammar</article-title>
          .
          <source>The Behavioral and brain sciences. 33</source>
          .
          <fpage>367</fpage>
          -
          <lpage>404</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Rutter</surname>
            <given-names>L</given-names>
          </string-name>
          ,
          <string-name>
            <surname>VanderPlas</surname>
            <given-names>S</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cook</surname>
            <given-names>D</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Graham</surname>
            <given-names>MA</given-names>
          </string-name>
          (
          <year>2019</year>
          ).
          <article-title>“ggenealogy: An R Package for Visualizing Genealogical Data</article-title>
          .
          <source>” Journal of Statistical Software</source>
          ,
          <volume>89</volume>
          (
          <issue>13</issue>
          ),
          <fpage>1</fpage>
          -
          <lpage>31</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>[6] "Graphviz and Dynagraph - Static and Dynamic Graph Drawing Tools"</article-title>
          , by John Ellson, Emden R. Gansner, Eleftherios Koutsofios, Stephen C. North, and Gordon Woodhull, in Jünger &amp; Mutzel (
          <year>2004</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Plotly</given-names>
            <surname>Technologies Inc</surname>
          </string-name>
          .
          <article-title>Collaborative data science</article-title>
          .
          <source>Montréal, QC</source>
          ,
          <year>2015</year>
          . https://plot.ly
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>[8] https://toytree.readthedocs.io/en/latest/</mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Borges</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          (
          <year>2019</year>
          ).
          <article-title>A contextual family tree visualization design</article-title>
          .
          <source>Information Visualization.</source>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>[10] https://www.toptenreviews.com/software/home/best-genealogysoftware/</mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Aric</surname>
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Hagberg</surname>
          </string-name>
          , Daniel A. Schult and
          <string-name>
            <surname>Pieter J. Swart</surname>
          </string-name>
          , “
          <article-title>Exploring network structure, dynamics, and function using NetworkX”</article-title>
          ,
          <source>in Proceedings of the 7th Python in Science Conference (SciPy2008)</source>
          , Gäel Varoquaux, Travis Vaught, and Jarrod Millman (Eds), (Pasadena, CA USA), pp.
          <fpage>11</fpage>
          -
          <lpage>15</lpage>
          , Aug 2008
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>J. D.</given-names>
            <surname>Hunter</surname>
          </string-name>
          ,
          <article-title>"Matplotlib: A 2D Graphics Environment"</article-title>
          ,
          <source>Computing in Science &amp; Engineering</source>
          , vol.
          <volume>9</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>90</fpage>
          -
          <lpage>95</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Bird</surname>
          </string-name>
          , Steven, Edward Loper and Ewan
          <string-name>
            <surname>Klein</surname>
          </string-name>
          (
          <year>2009</year>
          ),
          <article-title>Natural Language Processing with Python. O'Reilly Media Inc</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Korobov</surname>
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Morphological Analyzer and Generator for Russian and</article-title>
          Ukrainian Languages // Analysis of Images,
          <source>Social Networks and Texts</source>
          , pp
          <fpage>320</fpage>
          -
          <lpage>332</lpage>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>