The university of Tromsø > Giellatekno
 

Extracting text from xml elements in sámi xml corpus

Introduction

This document describes the overall process of processing the xml corpus into plain text for the needs of testing the languega tools.

catxml is a perl script that takes either a file(s) or a directory as input and outputs plain text. It has a funtionality to include certain xml elements in output or it can be used to produce an analysis of the corpus text.

ccat

ccat replaces the catxml-script. It is now installed in victorio to /usr/local/bin so you may try it out. All the relevant functionality is not yet implemented, such as selecting the language of the text. The -analyze option which was present in catxml is not implemented either. The basic function of ccat is to print paragraphs that have text type (empty type in our xml-files), that is the default. In addition to text paragraphs, it is possible to print titles, lists and tables and to traverse directories recursively. Usage:

    Usage: ccat <options> [FileName]
    Print the contents of a corpus file in XML format.
    The default is to print paragraphs with no type (=text type).
    The possible options include:
        -a              Print all text elements.
        -p              Print plain paragraphs. (default)
        -T              Print paragraphs with title type.
        -L              Print paragraphs with list type.
        -t              Print paragraphs with table type.
        -r <dir>        Recursively process directory dir and subdirs enountered.
        -h              Print this help message.

The basic type of usage is for example to print out the contents of text paragraphs in all the files under /usr/local/share/corp/gt/sme/admin/:

    $ ccat -r /usr/local/share/corp/gt/sme/admin

If you want to use ccat in your own computer do the following:

    $ cvs co gt
    $ cd gt/script/samiXMLparser/
    $ make
    $ cp ccat ~/bin/

Assuming that you have bin directory under your home directory, and it is along PATH. The program is under development, so you will be later asked to update your version of the ccat.

Last modified: $Date: 2006/06/01 07:53:09 $, by $Author: boerre $

by Tomi Pieski, Saara Huhmarniemi