GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Marpa::PP::Semantics::Order(3) User Contributed Perl Documentation Marpa::PP::Semantics::Order(3)

Marpa::PP::Semantics::Order - How Marpa Ranks Ambiguous Parses

This document details the order in which the recognizer's "value" method returns parse results. The same mechanism allows the selection of parse results. It can also be exploited to do the actual processing of parses, using side effects.

In a single parse series, Marpa will never return the same parse result twice. Marpa regards two parses as being the same if they are semantic duplicates.

Two parses are semantic duplicates if a recursive, top-down evaluation of each applies the same rules in the same order at the same earleme locations. When this is the case, a deterministic semantics will always produce the same value for both parses -- hence the term "semantic duplicate". When the Marpa documentation refers to duplicate parses, it will mean semantic duplicates unless otherwise stated.

By calling the recognizer's "value" method repeatedly, Marpa can produce all the parse results for a given parse. The default is for the parse results to be returned in an arbitrary order. This corresponds to the ""none"" value of the recognizer's "ranking_method" named argument.

The most general way to sort Marpa parses is for the application to take control. The application can set up the Marpa semantic actions so that the value of every parse result is a "<rank, true_value>" duple. The duples can then be sorted by "rank". Once the resuls are sorted, the "rank" element of the duple can be discarded. (Those familiar with the Schwartzian transform may note a resemblance. In Perl, duples can be implemented as references to arrays of 2 elements.)

The user needs to be careful. In theory, ambiguity can cause an exponential explosion in the number of results. In practice, ambiguity tends to get out of hand very easily. Producing and sorting all the parses can take a very long time.

In the past, Marpa supported a method of sorting parses, called the Constant Ranking Method. The Constant Ranking Method is now severely deprecated. It is unsupported and its documentation has been removed.

  Copyright 2012 Jeffrey Kegler
  This file is part of Marpa::PP.  Marpa::PP is free software: you can
  redistribute it and/or modify it under the terms of the GNU Lesser
  General Public License as published by the Free Software Foundation,
  either version 3 of the License, or (at your option) any later version.
  
  Marpa::PP 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
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser
  General Public License along with Marpa::PP.  If not, see
  http://www.gnu.org/licenses/.
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.