Commit bdfa81e3 authored by Nicolas Sannier's avatar Nicolas Sannier
Browse files

Pushing ARMLET for legislative text conversion

parent 8cbef046
Imports: { import gateStandAlone.* ;}
Phase: MarkPart1Head
Input: Part Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkPart1Head
{SpaceToken.kind=="control"}((({Token.string=="PREMIERE"}):id{SpaceToken.kind=="space"}{Token.string=="PARTIE"}):num{SpaceToken.kind=="control"}((({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"}))?({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+({Token.string=="."})?):title):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Part1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Part_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkSection1Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection1Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id{SpaceToken.kind=="space"}{Token.string=="."}):num(({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection2Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection2Head
{SpaceToken.kind=="control"}{SpaceToken.kind=="control"}(({Token,!Token within HeaderLabel, Token.kind=="word", Token.orth=="upperInitial"}(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+)?{Token.kind=="word"}{SpaceToken.kind=="control"}):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}{SpaceToken.kind=="control"}({Token.string=="Art"}{Token.string=="."}|{Token.string=="Article"})
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section2Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("title", title);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection3Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection3Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id):num({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section3Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection4Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection4Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id{Token.string=="."}{SpaceToken.kind=="space"}):num(({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section4Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection5Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection5Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id):num{Token.string=="."}({Token.subkind=="dashpunct"}|{Token.string=="-"})(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section5Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection6Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection6Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id):num{SpaceToken.kind=="control"}({SpaceToken.kind=="control"})?(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.kind=="word"}{SpaceToken.kind=="control"}|{Token.kind=="word", Token.orth=="upperInitial"}{SpaceToken.kind=="control"}):title):header
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section6Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection7Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection7Head
{SpaceToken.kind=="control"}{Token.kind=="punctuation"}(({Section}{SpaceToken.kind=="space"}(({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id{Token.string=="."}({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})):num(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section7Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Phase: MarkSection8Head
Input: Section Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSection8Head
{SpaceToken.kind=="control"}(({Section}{SpaceToken.kind=="space"}{Token.kind=="punctuation"}(({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id{Token.kind=="punctuation"}{Token.string=="."}({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})):num(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Section8Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Section_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkSubsection1Head
Input: Subsection Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSubsection1Head
{SpaceToken.kind=="control"}(({Token.string=="Sous-"}{Token.string=="Section"}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id):num({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{
Node numStart = numAnnotation.firstNode();
Node numEnd = numAnnotation.lastNode();
num = doc.getContent().toString().substring(numStart.getOffset().intValue(), numEnd.getOffset().intValue());
}
//create property block
String block = "";
AnnotationSet blockAnnotation = (AnnotationSet) bindings.get("block");
if (blockAnnotation != null)
{
Node blockStart = blockAnnotation.firstNode();
Node blockEnd = blockAnnotation.lastNode();
block = doc.getContent().toString().substring(blockStart.getOffset().intValue(), blockEnd.getOffset().intValue());
}
//create property ruleName
String ruleName = "Subsection1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Subsection_Head", features);
}
Phase: MarkSubsection2Head
Input: Subsection Token SpaceToken num HeaderLabel OpenQuote
Options: control = appelt
Rule: DoMarkSubsection2Head
{SpaceToken.kind=="control"}{SpaceToken.kind=="space"}(({Token.string=="Sous-"}{Token.string=="Section"}{SpaceToken.kind=="space"}({Token.string=="Ier"}|({Token.kind=="numberPrime"}|{Token.kind=="number"}|{Token.string=="Préliminaire"}|{Token.string=="Premier"}|{Token.string=="PREMIER"})):id):num({SpaceToken.kind=="space"})?({Token.subkind=="dashpunct"}|{Token.string=="-"})(({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+):title((({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?)):header{SpaceToken.kind=="control"}
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property id
String id = "";
AnnotationSet idAnnotation = (AnnotationSet) bindings.get("id");
if (idAnnotation != null)
{
Node idStart = idAnnotation.firstNode();
Node idEnd = idAnnotation.lastNode();
id = doc.getContent().toString().substring(idStart.getOffset().intValue(), idEnd.getOffset().intValue());
id = GateHeaderConverter.convertExpression(id);
}
//create property title
String title = "";
AnnotationSet titleAnnotation = (AnnotationSet) bindings.get("title");
if (titleAnnotation != null)
{
Node titleStart = titleAnnotation.firstNode();
Node titleEnd = titleAnnotation.lastNode();
title = doc.getContent().toString().substring(titleStart.getOffset().intValue(), titleEnd.getOffset().intValue());
}
//create property num
String num = "";
AnnotationSet numAnnotation = (AnnotationSet) bindings.get("num");
if (numAnnotation != null)
{