Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (47 sloc) 2.52 KB
patterns {
$Trash = "([\w']+\s)*?";
$Filename = "([A-Za-z0-9_]+).(wav|txt)\t";
$Greeting = "good morning|good evening|good day|tag|hello|bonjour";
$Airline = "([A-Za-z]+)(\s[A-Za-z]+)?(\s[A-Za-z]+)?";
$FlightNumber = "(\d){2,4}|triple\d|(triple \d0)";
$Action = "descend|climb to|maintain|climb|descent";
$FlightLevel = "(flight )?level\s";
$FlightLevelNumber = "(\d){3,4}";
$Heading = "heading( of)?\s(\d){1,3}";
}
@RelaxNG
output-structure {
start = AtcMessage
AtcMessage = element atcMessage {Filename?,Airline,FlightNumber,Action,FlightLevelNumber}
Filename = element filename {text}
Greeting = element greeting {text}
Airline = element airline {text}
FlightNumber = element flightnumber {text}
Action = element action{text}
FlightLevelNumber = element flightLevelNumber{text}
}
analyser-rules {
start = AtcMessage
AtcMessage = $Trash,Filename?,$Trash,Greeting?,$Trash,MessageVariation,$Trash,Heading?,$Trash
MessageVariation = (amAllRequired|amOneOptional|amOneRequired|amAllOptional)
amAllRequired = FlightId,$Trash,Greeting?,$Trash,Heading?,$Trash,Action,$Trash,FlightLevel
amOneOptional = (amFlightIdOptional|amActionOptional|amFlightLevelOptional)
amFlightIdOptional = FlightId?,$Trash,Greeting?,$Trash,Heading?,$Trash,Action,$Trash,FlightLevel
amActionOptional = FlightId,$Trash,Greeting?,$Trash,Heading?,$Trash,Action?,$Trash,FlightLevel
amFlightLevelOptional = FlightId,$Trash,Greeting?,$Trash,Heading?,$Trash,Action,$Trash,FlightLevel?
amOneRequired = (amOnlyFlightIdRequired|amOnlyActionRequired|amOnlyFlightLevelRequired)
amOnlyFlightIdRequired = FlightId,$Trash,Greeting?,$Trash,Heading?,$Trash,Action?,$Trash,FlightLevel?
amOnlyActionRequired = FlightId?,$Trash,Greeting?,$Trash,Heading?,$Trash,Action,$Trash,FlightLevel?
amOnlyFlightLevelRequired = FlightId?,$Trash,Greeting?,$Trash,Heading?,$Trash,Action?,$Trash,FlightLevel
amAllOptional = FlightId?,$Trash,Greeting?,$Trash,Heading?,$Trash,Action?,$Trash,FlightLevel?
Filename = $Filename
Greeting = $Greeting
FlightId = (FlightIdOptionalAirline|FlightIdOptionalFlightNumber)
FlightIdOptionalAirline = atom(check(Airline{$Airline}, Airline.checkAirline)?,FlightNumber)
FlightIdOptionalFlightNumber = atom(check(Airline{$Airline}, Airline.checkAirline),FlightNumber?)
FlightNumber = check(FlightNumber{$FlightNumber}, Airline.checkFlightNumber)
Action = $Action
FlightLevel = $FlightLevel,FlightLevelNumber
FlightLevelNumber = $FlightLevelNumber
Heading = $Heading
}
You can’t perform that action at this time.