Chapter 4. Searching

The ELAN tool allows you:

4.1. Searching in a single annotation file

To search for text, do the following:

  1. Click on Search menu.

  2. Go to Find (And Replace)... (alternatively you can press CTRL+F) The following dialog window is displayed:

    Search dialog

    Figure 4.1. Search dialog


  3. The following search options are available:

    1. Go to Annotation on tier and, from the pull-down menu, select the tier to be searched.

    2. Go to matches and type in the item to be searched. If the tier type of the selected tier has a Controlled Vocabulary (see Section 2.4.9), this field is a pull down menu containing the entries of the controlled vocabulary. Note that it is still possible to enter a string that is not in the list.

You can always make use of regular expressions to conduct your searches when “regular expression” is checked. (see Appendix A for the regular expression syntax).

By default the search is not case sensitive. To change this, select the “case sensitive” checkbox.

Optionally, specify the interval to search in (from ... s …ms to … s … ms). Make a choice between searching within a time interval and finding annotations that overlap with a certain interval. Click on Add new constraint to add a second tier and search item. Up to 10 constraints can be used. There exist 2 kinds of them:

  1. Constraints based on structural distance. (Annotation units “around” a certain annotation entity). This option is only available for tiers that are symbolically associated to (or are a symbolical subdivision of) the tier mentioned in the first search box.

    For example: annotations contained in a structural distance of –1 to 2 tx-annotations from trees on the tier tx are sees, trees, and, flowers.

    Table 4.1. Annotation example

    tierannotations
    st (sentence)He sees trees and flowers.
    tx (word)heseestreesandflowers
    mb (morpheme break)see-stree-sflower-s
    ps (part of speech)VSUFNSUFNSUF


  2. Constraints based on temporal distance. This means search results are restricted on the basis of the temporal relation between two intervals:

    • is inside: the annotation is completely contained within a given interval

    • overlaps: at least a part of the annotation is contained within the given interval

    • overlaps only begin time of: the annotation only has its end part in common with the given interval

    • overlaps only end time of: the annotation only has its begin part in common with the given interval

    • is within … around: the annotation is contained in an interval around either the begin time or the end time

    • is within … around begin time of: the annotation is contained in an interval around the begin time

    • is within … around end time of: the annotation is contained in an interval around the begin time

    It is possible to search on different tiers within one annotation. For example, the search parameters illustrated below search for all annotations on the tier tx, which contain “-s” in one of their morpheme breaks and “N” in one of their parts of speech. (Both “-s” and “N” are in distance of “0 words”, i.e., they occur within the same word as specified on the tier tx.) I.e., these parameters would find “trees” and “flowers” in the above example, but not “sees”.

    Find with constraints

    Figure 4.2. Find with constraints


    Another option is searching for sequences of utterances, words or other annotations on the same tier, e.g.:

    Find sequences

    Figure 4.3. Find sequences


    You can delete the second (or third) search item. Click on Delete last constraint to delete it.

  3. Right click in a text box to change the input character set and select the suitable language from the pull-down menu.

    You only need this option if you want to select a non-default character set. The box automatically displays the default set of the selected tier (see Section 2.4.4).

    After you have specified your search parameters, click OK to start the search process.

[Note]Note

Make sure the box next to Regular Expression is checked when you search for “special” characters (i.e. all characters that are not plain letters or digits) like diacritic characters.

4.1.1. Advanced searching: an example

Suppose we are investigating turn taking and we want to find all switches from speaker W to speaker K that don’t overlap, with gaps of at most 2 seconds. In order to find this, we fill in the search form as follows:

Advanced searching example

Figure 4.4. Advanced searching example


4.1.2. Displaying search results

After the Search is completed, ELAN displays the following search results:

  • The number of annotations where the search item was found.

  • The full content of each annotation where the search item was found along with full content of its parent annotation and all its child annotation.

  • The begin, end time and duration of each annotation where the search item was found. To see more information per match, right click in the results and check the other desired fields (file – tier – before – after ).

  • Clicking the header of a column sorts the result table based on that column. Depending on the column, sorting is by alphabet or by time value. Clicking the header again changes the sorting from descending to ascending or vice versa.

Search results

Figure 4.5. Search results


4.1.2.1. The search history

When performing multiple search actions one after another, a search history is created. With this feature it becomes possible to browse through all the entered queries:

  1. Enter a query and click OK to activate it.

  2. Click on the New Query icon

  3. Enter another query and choose OK

  4. Now you can use the back and forward icons to browse through the search history.

Search history

Figure 4.6. Search history


[Note]Note

When closing the search dialog, the query history is removed. If nonetheless you want to save a certain search command, have a look at Section 4.1.2.3.

4.1.2.2. Refining a search

After a search operation, one can perform another search within the results of the previous action. To achieve this, select Search on current result from the Query menu in the Search dialog window. This will get you the following window:

Refining a search

Figure 4.7. Refining a search


By specifying extra search constraints, you can narrow down the results. This is similar to the addition of an extra search constraint.

4.1.2.3. Saving and loading queries

When using complex queries, or one is repeating the same search on annotation files, it is convenient to reuse a query. This is possible in ELAN thanks to the save and load query functionality.

Saving a query

  1. Specify a query in the search dialog

  2. Either choose Query > Save or click on the save icon in the toolbar.

  3. Enter a file name for the active query.

  4. Choose save.

Saving a query

Figure 4.8. Saving a query


Loading a query

  1. Either choose Query > Open or click on the Open icon in the toolbar.

  2. Select an existing query from the file dialog.

  3. Choose Open.

4.1.2.4. Exporting the search results

To export the results of a query to a tab-separated file, go through these steps:

  1. In the query dialog, select Query > Export matches

  2. Specify a file name

  3. Click on save

An exported file looks as follows:

Exported search results

Figure 4.9. Exported search results


If you right click in the table containing the search results, a popup menu appears. Tick the checkboxes to show or hide columns that are related to the found annotations. In the same popup menu you will find the option Export Table as tab-delimited text, which literally saves the displayed result table to a text file, as shown in the example below.

Export search results

Figure 4.10. Export search results


4.1.2.5. Search and replace

ELAN offers the possibility to replace all of the found search results. Choose Edit > Replace in the Search Dialog:

Search and replace

Figure 4.11. Search and replace


Then enter the text that should replace the found results and choose OK.

4.1.3. Jumping from the search results to annotations

You can jump from the annotations displayed in the Search-Dialog window to the corresponding annotations in the ELAN window. This option allows you to access other types of information that are linked to the annotations found: to listen to the audio, to watch the video, to view the waveform or to read the annotations on different tiers.

Do the following: In the Search-Dialog window, click on the annotation that you want to jump to. It will be highlighted in blue color. In the ELAN window, the corresponding annotation is automatically accessed.

The screen display should look similar to the following illustration:

From search results to annotations

Figure 4.12. From search results to annotations