<!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>in the C@merata Task at MediaEval 2016</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Marina Mytrova</string-name>
          <email>mytrova@keldysh.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Keldysh Institute of Applied Mathematics Russian Academy of Sciences Moscow</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2016</year>
      </pub-date>
      <fpage>20</fpage>
      <lpage>21</lpage>
      <abstract>
        <p>The KIAM system is an attempt to solve the C@merata task at MediaEval 2016 [4] using regular expressions. The aim of the KIAM system is to try the suitability of regular expressions for text recognition in a limited dictionary. The system answers natural language queries over musical scores. The C@merata project has existed since 2014 and there are 200 questions each year which a participant's system has to answer automatically. A question consists of a short noun phrase in English referring to a musical feature in the music score like "three consecutive thirds in the left hand in measures 22-30" together with a classical music score in MusicXML [2]. The required answer to this question is a set of one or more passages specifying exact places in the score relevant with input string.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>•
•
•
•
•
•
•
•
•
•
melodic elements (e.g. note, number of notes, note sequence
or melodic interval),
harmonic elements (harmonic interval, chord or triad),
performance styles,
qualifications by instrument/clef/time signature/key,
qualifications by section/bar/beat/number.</p>
      <p>Elements can follow one another or be synchronous with one
another. Also, queries may contain information about texture,
cadence and counterpoint.</p>
      <p>The required answer (passage) is the location in the score of
the requested musical feature. A passage consists of a start point
and an end point in the score associated with the question. The
passage is specified as follows:
a start time signature,
an end time signature,
a start divisions value,
an end divisions value,
a start beat,
an end beat.</p>
      <p>The XML formats for the training data and run submissions
for C@merata 2016 task were as shown below:</p>
      <p>The phrase in the &lt;text&gt; tag is a natural language query.
Attributes of the &lt;passage&gt; tag are the answer. It shows the
location in the given MusicXML score of the requested musical
feature.</p>
    </sec>
    <sec id="sec-2">
      <title>2. APPROACH</title>
    </sec>
    <sec id="sec-3">
      <title>2.1 Description</title>
      <p>
        The vocabulary of musical terms is limited and the
specification of queries in the 2016 task contains many examples
of its components. It can be used to construct a large amount of
regular expressions. So, regular expressions were chosen for
query recognition, following the model of the UNLP work [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] in
the 2015 task [
        <xref ref-type="bibr" rid="ref4">5</xref>
        ]. The approach consists of two parts: query
recognition and music passage search. This is similar to UNLP
but the KIAM system contains different regular expression for
each example of query components.
      </p>
      <p>The diagram below summarizes the approach which can be
summarised as follows: The XML file containing the C@merata
task is processed by XML-processor to get the question string;
The question string goes to input of the query recognizer; There it
passes through a large number of regular expressions; If no match
is found, the operation is stopped and KIAM system does not
create a &lt;passage&gt; tag; Otherwise the request is sent to the music
passage search engine.
•
•
•
•
•
•
•
•
•
•
•
•
•
time signature,
number,
section,
clef,
beat.</p>
      <p>This paper will consider only the first two checks because
these worked the best on the C@merata 2016 task data.</p>
      <p>To simplify the problem it is considered that this data
(instrument and measures) can only occur at the end of string. It is
also considered that only one instance of this data can occur in the
string. All found data are stored in the resulting object. It is an
object that stores all the data needed to find music entities in the
MusicXML file.</p>
      <p>The remaining part of the string is checked for compliance
with one of the two patterns:
• string contains 'followed by',
• elements in the string are divided by commas.</p>
      <p>This information is also stored in the resulting object.
Melodic elements, coming one after the other, are considered
separately in the next step.</p>
      <p>Originally, the KIAM system should have also been checking
synchronous elements but this work was not completed in time for
this year’s task.</p>
      <p>The last action is recognition of a note or rest. A note’s
attributes, such as pitch, duration and accidentals, are saved in the
resulting object.</p>
      <p>At the end, the resulting object sends the entity sequences to
the music passage searcher. The music passage searcher processes
a given MusicXML file. In the file it searches for occurrences of
data received from the query recognizer. These occurrences pass
through the XML-processor to get an answer XML file.</p>
    </sec>
    <sec id="sec-4">
      <title>2.2 Regular Expressions</title>
      <p>Regular expressions used for question recognition are listed
below. They can be divided into eight types of recognition:
Each regular expression of the query recognizer corresponds
to a different function in the music passage searcher. So,
depending on the matched regular expression, it calls the
appropriate function. This function takes as input a given
MusicXML file and searches for the appearance of a certain tag
sequence. The music passage searcher returns the location in the
score of the requested musical feature. Finally, this location is
converted into &lt;passage&gt; tag attributes.</p>
      <p>Here is a diagram of query recognizer:</p>
      <p>First of all it gets an input string from the XML-processor.
Then the end of the string is checked for the presence of one of
the following data:
•
•
instrument,
measures,
instrument
measures
sequence ('followed by')
repeats
type of note/rest
dotted note definition
rest recognition
accidentals, pitch and octave</p>
      <p>Regular expressions are used in the order as listed above. If a
regex matches the query, data received from the regular
expression are saved into the resulting object. Then the matching
string is removed from the query. Regular expressions are used in
a specific sequence. So, there cannot be a situation where multiple
regular expressions match a particular query.</p>
      <p>The regexes were derived manually from the C@merata 2016
task description.</p>
      <p>The following examples describe what KIAM's function
returns using regular expressions in specific cases.
1) '/(?: in the| in)
(first|1st|second|2nd|third|3rd|fourth|4th|fifth|5th|sixth|6th|seventh|
7th|eighth|8th|ninth|9th|tenth|10th) ([A-Za-z]+)$/'
2) '/(?: in the| in) ([A-Za-z]+) part$/'
These regular expressions recognize such descriptions of musical
instruments as:</p>
      <p>
        G followed by Eb in the viola part
(returns 'viola')
dotted quarter note D6 in the first violin
(returns 'violin I')
3) '/(?: in the| in) (?:measures|bars) ([
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">0-9</xref>
        ]+)[\s]*-[\s]*([
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">0-9</xref>
        ]+)$/'
4) '/(?: in the| in) (?:measure|bar) ([
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">0-9</xref>
        ]+)$/'
These regular expressions recognize information about measures
such as:
quarter-note rest in measures 1-5
(returns an array of integers from 1 to 5)
A#1 in bars 44-59
(returns an array of integers from 44 to 59)
      </p>
      <sec id="sec-4-1">
        <title>Sequence</title>
        <p>5) '/(.+) (?:followed by a|followed by) (.+)/'
6) '/(.+),[\s]*(.+)/'
The first regex recognizes the string 'followed by', as in the
following examples:</p>
        <sec id="sec-4-1-1">
          <title>G followed by Eb</title>
          <p>(returns an array of strings 'G' and 'Eb'),</p>
        </sec>
        <sec id="sec-4-1-2">
          <title>5 B4s followed by a C5 (returns an array of strings '5 B4s' and 'C5'). The second regular expression recognizes a sequence of strings separated by commas, as in the following examples:</title>
          <p>
            Bb3, A3, G3, F3, E3
(returns an array of strings 'Bb3', 'A3', 'G3', 'F3' and 'E3').
Repeats
7) '/repeated (one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight
|8|nine|9|ten|10) times/'
8) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|ten|
10) ([A-Ga-g]#[
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])s/'
9) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|ten|
10) ([A-Ga-g]b[
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])s/'
10) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|
ten|10) ([A-Ga-g][
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])s/'
11) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|
ten|10) ([A-Ga-g]#)s/'
12) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|
ten|10) ([A-Ga-g]b)s/'
13) '/(one|1|two|2|three|3|four|4|five|5|six|6|seven|7|eight|8|nine|9|
ten|10) ([A-Ga-g])s/'
These regular expressions recognize repeats:
quarter-note A repeated four times
(returns an array of string 'quarter-note A' repeated four times),
5 B4s
(returns an array of string 'B4' repeated five times).
          </p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Type of note/rest</title>
        <p>14) '/(whole-note|whole note|whole|half-note|half note|half|
quarter-note|quarter note|quarter|crotchet|eight-note|eight
note|eight)/'
This regex recognizes type of note or rest:
quarter-note rest
(returns 'quarter'),
dotted quarter note D6
(returns 'quarter'),
crotchet D6
(returns 'quarter').</p>
      </sec>
      <sec id="sec-4-3">
        <title>Dotted note definition</title>
        <p>15) '/dotted/'</p>
        <sec id="sec-4-3-1">
          <title>This regex checks if note is dotted: dotted quarter note D6 (returns true).</title>
        </sec>
      </sec>
      <sec id="sec-4-4">
        <title>Rest recognition</title>
        <p>16) '/rest/'</p>
        <sec id="sec-4-4-1">
          <title>This regex recognizes a rest: quarter-note rest (returns true).</title>
          <p>
            Accidentals, pitch and octave
17) '/([A-Ga-g])#([
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])/'
18) '/([A-Ga-g])b([
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])/'
19) '/([A-Ga-g])([
            <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5">1-9</xref>
            ])/'
20) '/([A-Ga-g])#/'
21) '/([A-Ga-g])b/'
These regular expressions recognize properties of notes:
String 'Eb' matches regular expression #21:
Eb
(returns an array ['pitch' =&gt; 'E', 'octave' =&gt; 1, 'flat' =&gt; true]),
Bb3
(returns an array ['pitch' =&gt; 'B', 'octave' =&gt; 3, 'flat' =&gt; true]),
A#1
(returns an array ['pitch' =&gt; 'A', 'octave' =&gt; 1, 'sharp' =&gt; true]).
          </p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>2.3 Search Functions</title>
      <p>Search functions correspond to the regular expressions
outlined above. First, an executed function searches an
appropriate part. It is a part of an instrument received from the
query recognizer.</p>
      <p>Next, a function searches for the correct measures of the part.
They are used in the next iteration.</p>
      <p>The search function then compares each note in the measures
with the first note of the list returned by the query recognizer. It is
repeated until a match is found, whereupon, the corresponding
note’s position is stored. It is considered to be a starting point in
the score associated with the question.</p>
      <p>The following note of the list is then verified in the same
way. Notes found in this way should follow directly after each
other.</p>
      <p>When a match is found for the last note in the list, the note’s
position is again stored. It is the end point in the score associated
with the question.</p>
      <p>The search continues until all passages associated with the
question are found.</p>
    </sec>
    <sec id="sec-6">
      <title>2.4 Example</title>
      <p>Here is a worked example based on the regular expressions
and general search algorithm outlined above. Consider the input
question:
'G followed by Eb in the viola part'
The end of the string matches regular expression #2:
'/(?: in the| in) ([A-Za-z]+) part$/'
Instrument 'viola' is saved in the result object. The question is
now reduced to:
'G followed by Eb'
None of the 'measures'-type regex matches the question string.
However, the string matches regular expression #5:
'/(.+) (?:followed by a|followed by) (.+)/'
This regex divides the query string into two parts:
'G',
'Eb'
String 'G' matches regular expression #22:
'/([A-Ga-g])b/'
instrument — 'viola'
measures — all
first note — G
second note — E, flat
So, the result object includes the the following information:</p>
      <p>The music passage searcher starts by searching the different
parts of the score. After finding the viola part other parts are not
considered.</p>
      <p>The searcher then goes through all the notes of the viola part.
A note’s position is stored when the current pitch matches 'G'.</p>
      <p>If next note matches 'Eb', its position is stored as the end
point in the score associated with the question. Then, the music
passage searcher returns the location in the score of the requested
musical feature. In order to do this, the location is first converted
into &lt;passage&gt; tag attributes, according to the rules of the
C@merata task.</p>
      <p>Otherwise, the search continues again from note 'G'. This is
repeated until either a correct answer is found or the parts end.</p>
    </sec>
    <sec id="sec-7">
      <title>2.5 Implementation of the System</title>
      <p>The PHP programming language was used to implement the
system. It supports regular expressions without the use of
additional libraries and also PHP has a built-in functionality to
parse XML. In future, PHP will allow us to create a Web-interface
for the KIAM system.</p>
    </sec>
    <sec id="sec-8">
      <title>3. RESULTS AND DISCUSSION</title>
      <p>The KIAM system was designed to try the suitability of
regular expressions for text recognition, working in a domain
witha limited vocabulary.</p>
      <p>The system was able to recognize pitch, octave and
accidentals for each note. These cases were handled correctly if
references to notes in a query followed one after the other
separated by commas or by 'followed by'.</p>
      <p>KIAM was also able to determine musical instruments and
measures.</p>
      <p>Regular expressions were created only for the simplest
queries. So, KIAM recognized correctly only seven requests such
as:
•
•
•
•
•
•
•
'G followed by Eb in the viola part',
'quarter-note rest in measures 1-5',
'Bb3, A3, G3, F3, E3',
'dotted quarter note D6 in the first violin',
'quarter-note A repeated four times',
'5 B4s followed by a C5',
'A#1 in bars 44-59'.</p>
      <p>Unfortunately, the C@merata questions were very difficult
this year, so the results are not as good as we had hoped. The
actual scores for the KIAM system for all questions presented in
the table below:</p>
      <p>The best system this year was DMUN which score BF 0.070
- a very low figure reflecting the difficulty of the task. The second
system was KIAM with BF 0.021 as shown in the table above. As
would be expected, MF for KIAM was higher at 0.066 - generally
it is easier to determine the correct measure than the exact beat in
the measure. It is interesting that MP was 0.613 which means that
for some queries, the correct measure was identified quite
accurately.</p>
      <p>Considering the KIAM performance across different question
types, the results for 1_melod, n_melod and follow queries are
shown below.</p>
      <p>BP
1_melod 0.273
n_melod 0.000
follow
0.600</p>
      <p>BR
0.044
0.000
0.140</p>
      <p>BF
0.076
0.000
0.227</p>
      <p>MP
0.727
0.333
1.000</p>
      <p>MR
0.118
0.021
0.233</p>
      <p>MF
0.203
0.040
0.378</p>
      <p>We can clearly see that 1_melod questions showed the best
performance with BF 0.076. The MP was also the highest for
these, showing that KIAM can find the measure for a note but not
its exact beat. MP overall is high because it is high here, and in
addition, KIAM did not answer many of the queries overall.</p>
      <p>For n_melod queries, the correct beat was not recognised for
any query (BF 0) but the correct measure was in some cases (MF
0.040).</p>
      <p>Queries of type follow were complex in this task, but KIAM
was able to tackle some of these, resulting in relatively high BF
0.227 and MF 0.378.</p>
    </sec>
    <sec id="sec-9">
      <title>4. CONCLUSION</title>
      <p>This was our first year of particating at C@merata; it is an
extremely complex task and it took as quite a while to get a basic
system running, especially as we chose to work in php and not to
use the Python Baseline System provided by the organisers. Our
approach was based on regular expressions and this proved
surprisingly succesful for the simpler queries. Next steps will
include refining our regular expressions via a detailed analysis of
the Gold Standard data, and combining this approach with others
more suited to the more complex query types.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Asooja</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ernala</surname>
            ,
            <given-names>S. K.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Buitelaar</surname>
            <given-names>P.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>UNLP at the MediaEval 2015 C@merata Task</article-title>
          .
          <source>In Proceedings of the MediaEval 2015 Workshop</source>
          , Dresden, Germany, September 14-15
          <year>2015</year>
          . http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>1436</volume>
          /Paper86.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Mytrova</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <source>Music Information Retrieval Based On Automated Reasoning Methods. RuSSIR Young Scientist Conference</source>
          , Kazan, Russia,
          <source>September 16-20</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>R. F. E.</given-names>
          </string-name>
          , Collins,
          <string-name>
            <given-names>T.</given-names>
            ,
            <surname>Hovy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Lewis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Fox</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            , &amp;
            <surname>Root</surname>
          </string-name>
          ,
          <string-name>
            <surname>D. L.</surname>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>The C@merata task at MediaEval 2016: Natural Language Queries Derived from Exam Papers, Articles and Other Sources against Classical Music Scores in MusicXML</article-title>
          .
          <source>In Proceedings of the MediaEval 2016 Workshop</source>
          , Amsterdam, The Netherlands,
          <source>October</source>
          <volume>20</volume>
          -21
          <year>2016</year>
          . http://ceur-ws.
          <source>org.</source>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Sutcliffe</surname>
            ,
            <given-names>R. F. E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fox</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Root</surname>
            ,
            <given-names>D. L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hovy</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Lewis</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>The C@merata Task at MediaEval 2015: Natural language queries on classical music scores</article-title>
          .
          <source>In Proceedings of the MediaEval 2015 Workshop</source>
          , Dresden, Germany, September 14-15
          <year>2015</year>
          . http://ceur-ws.org/Vol1436/Paper12.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Tabolin</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mytrova</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Korukhova</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          (
          <year>2012</year>
          ).
          <source>Music Theory Ontology. Reasoning Web Summer School</source>
          , Vienna University of Technology,
          <source>Austria, September 3-8</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>