|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectaminePlatform.util.parserGenerator.ObjectParsing
aminePlatform.util.parserGenerator.LFParserGenerator
Title : parserGenerator.LFParserGenerator Class
Description : This class is responsible of two tasks :
- to parse the LF notation of a CG and generate its internal representation,
- to generate a LF notation of a CG from its internal representation.
The first task, LF-To-CG, is done by the method parse() that parses the LF notation of a CG and produces the internal representation of the CG. The second task, LF-From-CG, is done by the method toLF() that generates a LF notation from the internal representation of a CG.
NEW : Amine 2.5, by Adil. In the previous version, we considered only LF of connected CG. Now, we consider the possibility of LF of disconnected CG. A disconnected CG is a sequence of CG without any separator except space(s).
NEW Amine 2.5, by Adil: In SYNERGY, there is four primitive relations:
in, out, grd, next. Relations in and out can have a range and all these relations
can have other attributes, like functional attribute, cut forward propagation, ...
according to the semantic of SYNERGY. These information are recorded in the attribute
suffix.
The syntax of LF notation :
CG ::= (Concept [Relation | Relations])*
Concept ::= "[" [Comment] Conc_Type [ParameterModes (generate in EndComment)] [CoReferent]
[":"] [CoReferent] [Designator] [CoReferent] ["="] [Descriptor] [CoReferent] // Coreferent (defining/* | bound/? coreference label/Variable) can be specified before or after. Note also, a set of designator is not enclosed in {}
["$" State (generate in EndComment)] ["&" Point (generate in EndComment)] [EndComment] "]"
Conc_Type ::= Type | Variable | ComposedType | Term
Designator ::= IndividualIdent | SetOfIndividualIdent | Variable
CoReferent ::= ("*" | "?") Variable
Descriptor ::= Amine_Object | Variable
ParameterModes ::= ("in" | "out") Integer.
State ::= A byte that represents the state of a concept, according to SYNERGY
Point ::= Integer Integer
Relation ::= ("-" RelTypeIdentifier "->" CG) | ("<-" RelTypeIdentifier "-" CG)
Relations ::= "-" Relation {"," Relation}* [";"]
RelTypeIdentifier ::= Identifier [Suffix] {Rel_Point}*
Suffix ::= [Integer] ["," "f"] ["," "|<"] ["," ">|"]
Rel_Point ::= "(" Integer Integer ")"
Copyright : Copyright (c) Adil KABBAJ 2004-2009
Field Summary |
Fields inherited from class aminePlatform.util.parserGenerator.ObjectParsing |
generateCode, genericCoref, lexicon, txtTokenizer |
Constructor Summary | |
LFParserGenerator(Lexicon lexicon)
This constructor calls the corresponding constructor of the super-class |
|
LFParserGenerator(TextTokenizer txtTokenizer,
Lexicon lexicon)
This constructor calls the corresponding constructor of the super-class |
Method Summary | |
CG |
parse()
This method parses the LF formulation of a CG and produces its corresponding internal representation (Java Object) if this step is intended (this is determined by the attribute generateCode : if true, the internal representation is produced, if false only the parsing is done). |
CG |
parse(java.lang.String strgCG)
Parse a LF form of a CG to produce the internal representation of the CG. |
CG |
parse(java.lang.String strgCG,
AmineList newTypes)
|
CG |
parse(TextTokenizer textTokenizer)
This method is similar to parse(String strgCG) except that its argument is a TextTokenizer that is already created for the treatment of strgCG; the textual formulation of a CG. |
CG |
parse(TextTokenizer textTokenizer,
AmineList newTypes)
|
protected CG |
parseCG()
Parse the LF of a CG. |
(package private) Concept |
selectHead(java.util.ArrayList notVisitedConcs)
From the given ArrayList of concepts, choose the one with the high connections, the concept that have the high number of income & outcome relations. |
protected java.lang.String |
toCGLFBis(BindingContext bindContext,
CG cg,
java.lang.Object bindInf,
int indent)
This method corresponds basically to toLF(). |
java.lang.String |
toLF(BindingContext bindContext,
CG cg,
java.lang.Object bindInf,
int indent)
Generate the LF formulation from the internal representation of the specified CG (parameter cg). |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LFParserGenerator(TextTokenizer txtTokenizer, Lexicon lexicon) throws ParsingException
public LFParserGenerator(Lexicon lexicon) throws ParsingException
Method Detail |
public CG parse(java.lang.String strgCG) throws ParsingException
strgCG
- a LF formulation of a CG
throws
- ParsingException if lexico-syntaxic errors occurs during parsing
ParsingException
public CG parse(java.lang.String strgCG, AmineList newTypes) throws ParsingException
ParsingException
public CG parse(TextTokenizer textTokenizer) throws ParsingException
textTokenizer
- a TextTokenizer to treat the parsing of a textual formulation of a CG
throws
- ParsingException if lexico-syntaxic errors occurs during parsing
ParsingException
public CG parse(TextTokenizer textTokenizer, AmineList newTypes) throws ParsingException
ParsingException
public CG parse() throws ParsingException
ParsingException
- if lexico-syntaxic errors occur during parsingprotected CG parseCG() throws ParsingException
parseCG
in class ObjectParsing
ParsingException
- if an error occurs during parsingpublic java.lang.String toLF(BindingContext bindContext, CG cg, java.lang.Object bindInf, int indent) throws ToStringException
bindContext
- The Binding contextcg
- is the CG for which a LF formulation (production) is requiredbindInf
- The binding information related to the binding context and to cgindent
- is an integer that allows for a correct treatment of the indentation
ToStringException
- if no identifier is associated to a CS
in the specified lexicon (and in the main language if mixed language is allowed).protected java.lang.String toCGLFBis(BindingContext bindContext, CG cg, java.lang.Object bindInf, int indent) throws ToStringException
bindContext
- The Binding contextcg
- is the CG for which a LF formulation (production) is requiredbindInf
- The binding information related to the binding context and to cgindent
- is an integer that allows for a correct treatment of the indentation
ToStringException
- if no identifier is associated to a CS
in the specified lexicon (and in the main language if mixed language is allowed).Concept selectHead(java.util.ArrayList notVisitedConcs)
notVisitedConcs
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |