# THIS IS A GENERATED FILE, DO NOT EDIT!
# Copyright (C) 2017–2019, Kevin Brubeck Unhammer <unhammer@fsfe.org>

# This program is free software: you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation, either version 3 of the License, or

# (at your option) any later version.

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License

# along with this program.  If not, see <http://www.gnu.org/licenses/>.

#

#  Root element:

namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"

pipespec = element pipespec { attlist.pipespec, pipeline+ }
attlist.pipespec &=

  attribute language { text },
  attribute developer { text }?,
  attribute copyright { text }?,
  attribute contact { text }?,
  attribute version { text }?,
  attribute depversions { text }?,
  attribute default-pipe { text }?
# == pipespec attributes ==
#   language:    BCP-47, default language code for pipelines in this spec
#   contact:     typically an e-mail address
#   version:     version of this module
#   depversions: versions of sub-modules used by the pipeline, e.g. hfst
pipeline =
  element pipeline {
    attlist.pipeline,
    prefs?,
    (sh
     | cg
     | cgspell
     | tokenize
     | tokenise
     | mwesplit
     | blanktag
     | suggest)+
  }
attlist.pipeline &=

  attribute name { xsd:ID },
  attribute language { text }?,
  attribute type { text }?
# == pipeline attributes ==
#   name:        user-readable, but unique name of the pipeline
#   language:    BCP-47, may override the language code of the pipespec
prefs = element prefs { attlist.prefs, pref+ }
attlist.prefs &= empty

pref = element pref { attlist.pref, option+ }
attlist.pref &=

  attribute type { text },
  attribute name { text }
# type and name are *not* unique here; several pipelines may have a pref for e.g. "Oxford comma"
option = element option { attlist.option, (label | description)+ }
attlist.option &= attribute err-id { text }

Text = (text | em)*
label = element label { attlist.label, Text }
attlist.label &= attribute xml:lang { text }

description = element description { attlist.description, Text }
attlist.description &= attribute xml:lang { text }

# General "system" command – pipelines with this can only be used
# in settings where we can open processes:
sh = element sh { attlist.sh, arg* }
# NOT IMPLEMENTED YET
attlist.sh &= attribute prog { text }

# Library-based commands – no IPC/process open() required since
# these just use linked libraries:
cg = element cg { attlist.cg, \grammar }
attlist.cg &= empty

# arg: grammar.cg3
cgspell =
  element cgspell {
    attlist.cgspell,
    ((lexicon, errmodel) | (errmodel, lexicon))
  }
# arg1: acceptor.hfstol, arg2: errmodel.hfst
attlist.cgspell &=

  [ a:defaultValue = "10" ] attribute limit { text }?,
  [ a:defaultValue = "15.0" ] attribute beam { text }?,
  [ a:defaultValue = "5000.0" ] attribute max-weight { text }?,
  [ a:defaultValue = "0.4" ] attribute max-unknown-rate { text }?
tokenize = element tokenize { attlist.tokenize, tokenizer }
# arg: tokeniser.pmhfst
tokenise = element tokenise { attlist.tokenise, tokenizer }
# en_GB alias of the above
attlist.tokenize &= attribute weight-classes { text }?

# no limit if not specified
attlist.tokenise &= attribute weight-classes { text }?

# no limit if not specified
mwesplit = element mwesplit { attlist.mwesplit, empty }
attlist.mwesplit &= empty

# takes no arguments
blanktag = element blanktag { attlist.blanktag, blanktagger }
attlist.blanktag &= empty

# arg: blanktagger.hfst
suggest =
  element suggest {
    attlist.suggest,
    ((generator, messages) | (messages, generator))
  }
# arg1: generator.hfstol, arg2: error_messages.xml
attlist.suggest &=

  [ a:defaultValue = "false" ]
  attribute generate-all { "true" | "false" }?
normalise =
  element normalise {
    attlist.normalise, normaliser, analyser, generator, tags
  }
attlist.normalise &= empty

normalize =
  element normalize {
    attlist.normalize, normaliser, analyser, generator, tags
  }
attlist.normalize &= empty

# en_US variant of above
phon = element phon { attlist.phon, text2ipa, alttext2ipa* }
attlist.phon &= empty

# arg: text2ipa.hfst

# Is there a way to generalize over these apart from shifting to <arg key=… val=…>?
arg = element arg { attlist.arg, empty }
attlist.arg &= attribute n { text }

\grammar = element grammar { attlist.grammar, empty }
attlist.grammar &= attribute n { text }

lexicon = element lexicon { attlist.lexicon, empty }
attlist.lexicon &= attribute n { text }

errmodel = element errmodel { attlist.errmodel, empty }
attlist.errmodel &= attribute n { text }

tokenizer = element tokenizer { attlist.tokenizer, empty }
attlist.tokenizer &= attribute n { text }

blanktagger = element blanktagger { attlist.blanktagger, empty }
attlist.blanktagger &= attribute n { text }

generator = element generator { attlist.generator, empty }
attlist.generator &= attribute n { text }

messages = element messages { attlist.messages, empty }
attlist.messages &= attribute n { text }

normaliser = element normaliser { attlist.normaliser, empty }
attlist.normaliser &= attribute n { text }

analyser = element analyser { attlist.analyser, empty }
attlist.analyser &= attribute n { text }

text2ipa = element text2ipa { attlist.text2ipa, empty }
attlist.text2ipa &= attribute n { text }

alttext2ipa = element alttext2ipa { attlist.alttext2ipa, empty }
attlist.alttext2ipa &=

  attribute s { text },
  attribute n { text }
tags = element tags { attlist.tags, tag+ }
attlist.tags &= empty

tag = element tag { attlist.tag, empty }
attlist.tag &= attribute n { text }

em |= notAllowed
start = normalize | phon | normalise | pipespec
