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

Copyright notice + example of processing with NCPC files

parent 1069b294
This diff is collapsed.
This diff is collapsed.
Imports: { import gateStandAlone.* ;}
Phase: MarkActHead
Input: Token SOD Preamble_start Article_Head Part_Head Book_Head Title_Head Chapter_Head Section_Head Subsection_Head NamedParagraph_Head
Options: control = once
Rule: DoMarkActHead
(({Token} ({Token})+):title):header({Preamble_start}|{Article_Head}|{Part_Head}|{Book_Head}|{Title_Head}|{Chapter_Head}|{Section_Head}|{Subsection_Head}|{NamedParagraph_Head}):right
-->
{
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 the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("title", title);
features.put("num", num);
features.put("block", block);
outputAS.add(headerStart, headerEnd, "Act_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkAlinea1Head
Input: Alinea Article_Head Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkAlinea1Head
({SpaceToken.kind=="control"}{Token.string=="Art"}{Token.string=="."}{SpaceToken.kind=="space"}{Token.kind=="numberPrime"}|{Token.kind=="number"}({Token.string=="-"}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+)?{Token.string=="."}({SpaceToken.kind=="space"}({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?){SpaceToken.kind=="space"}{Token.string=="("}{Token.kind=="numberPrime"}|{Token.kind=="number"}{Token.string==")"}{SpaceToken.kind=="space"}({Token.kind=="word", Token.orth=="upperInitial"}):header
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//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 = "Alinea1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Alinea_Head", features);
}
Phase: MarkAlinea2Head
Input: Alinea Article_Head Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkAlinea2Head
({SpaceToken.kind=="control"}{Token.string=="Art"}{Token.string=="."}{SpaceToken.kind=="space"}{Token.kind=="numberPrime"}|{Token.kind=="number"}({Token.string=="-"}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+)?{Token.string=="."}({SpaceToken.kind=="space"}({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?){SpaceToken.kind=="space"}({Token.kind=="word", Token.orth=="upperInitial"}):header
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//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 = "Alinea2Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Alinea_Head", features);
}
Phase: MarkAlinea3Head
Input: Alinea Article_Head Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkAlinea3Head
{Token.string=="."}{SpaceToken.kind=="control"}{Token.string=="("}{Token.kind=="numberPrime"}|{Token.kind=="number"}{Token.string==")"}{SpaceToken.kind=="space"}({Token.kind=="word", Token.orth=="upperInitial"}):header
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//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 = "Alinea3Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Alinea_Head", features);
}
Phase: MarkAlinea4Head
Input: Alinea Article_Head Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkAlinea4Head
{Token.string=="."}{SpaceToken.kind=="control"}({Token.kind=="word", Token.orth=="upperInitial"}):header
-->
{
AnnotationSet headerAnnotation = (AnnotationSet) bindings.get("header");
Node headerStart = headerAnnotation.firstNode();
Node headerEnd = headerAnnotation.lastNode();
//create property ruleName
String ruleName = "Alinea4Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Alinea_Head", features);
}
//Clean the Alinea_Head annotations (remove duplicates and the annotations within other)
Phase: MarkCleanAlineaAnnotations
Input: Act_Head Part_Head Book_Head Title_Head Chapter_Head Section_Head Subsection_Head Article_Head Paragraph_Head Alinea_Head
Options: control = appelt
Rule: DoMarkCleanAlinea
(
({Alinea_Head within Act_Head} | {Alinea_Head within Part_Head} | {Alinea_Head within Book_Head} | {Alinea_Head within Title_Head} | {Alinea_Head within Chapter_Head} | {Alinea_Head within Section_Head} | {Alinea_Head within Subsection_Head} | {Alinea_Head within Article_Head} | {Alinea_Head within Paragraph_Head})
):reference
-->
{
AnnotationSet toRemove = (gate.AnnotationSet) bindings.get("reference");
outputAS.removeAll(toRemove);
inputAS.removeAll(toRemove);
}
\ No newline at end of file
Imports: { import gateStandAlone.* ;}
Phase: MarkArticle1Head
Input: Article Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkArticle1Head
{SpaceToken.kind=="control"}(({Token.string=="Art"}{Token.string=="."}{SpaceToken.kind=="space"}({Token.kind=="numberPrime"}|{Token.kind=="number"}({Token.string=="-"}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+)?):id{Token.string=="."}):num({SpaceToken.kind=="space"}({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?):header({SpaceToken.kind=="space"}{Token.string=="("})?
-->
{
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 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 = "Article1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Article_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkBook1Head
Input: Book Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkBook1Head
{SpaceToken.kind=="control"}(({Token.string=="LIVRE"}{SpaceToken.kind=="space"}({Token.string=="Ier"}|{Token.kind=="numberPrime"}|{Token.kind=="number"}):id):num{Token.string=="."}({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 = "Book1Head";
//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, "Book_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkChapter1Head
Input: Chapter Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkChapter1Head
{SpaceToken.kind=="control"}(({Token.string=="Chapitre"}{SpaceToken.kind=="space"}({Token.string=="Ier"}|{Token.kind=="numberPrime"}|{Token.kind=="number"}):id):num{Token.string=="."}({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 = "Chapter1Head";
//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, "Chapter_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkParagraph1Head
Input: Paragraph Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkParagraph1Head
({SpaceToken.kind=="control"}{Token.string=="Art"}{Token.string=="."}{SpaceToken.kind=="space"}{Token.kind=="numberPrime"}|{Token.kind=="number"}({Token.string=="-"}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+)?{Token.string=="."}({SpaceToken.kind=="space"}({Token.string=="("}({Token,!Token.string=="("}|{SpaceToken.kind=="space"})+{Token.string==")"}):block)?):article{SpaceToken.kind=="space"}(({Token.string=="("}({Token.kind=="numberPrime"}|{Token.kind=="number"}):id{Token.string==")"}):num):header{SpaceToken.kind=="space"}
-->
{
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 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 = "Paragraph1Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("num", num);
features.put("block", block);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Paragraph_Head", features);
}
Phase: MarkParagraph2Head
Input: Paragraph Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkParagraph2Head
{Token.string=="."}{SpaceToken.kind=="control"}(({Token.string=="("}({Token.kind=="numberPrime"}|{Token.kind=="number"}):id{Token.string==")"}):num):header{SpaceToken.kind=="space"}
-->
{
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 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 = "Paragraph2Head";
//create the new token
FeatureMap features = Factory.newFeatureMap();
features.put("id", id);
features.put("num", num);
features.put("ruleName", ruleName);
outputAS.add(headerStart, headerEnd, "Paragraph_Head", features);
}
Imports: { import gateStandAlone.* ;}
Phase: MarkPart1Head
Input: Part Token SpaceToken num HeaderLabel OpenQuote Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkPart1Head
{SpaceToken.kind=="control"}((({Token.string=="PREMIERE"}):id{SpaceToken.kind=="space"}{Token.string=="PARTIE"}):num{SpaceToken.kind=="control"}(({Token.string=="."}({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 Footnote_Anchor Footnote_Content
Options: control = appelt
Rule: DoMarkSection1Head
{SpaceToken.kind=="control"}(({Token.string=="Section"}{SpaceToken.kind=="space"}({Token.string=="Ier"}|{Token.kind=="numberPrime"}|{Token.kind=="number"}):id):num{Token.string=="."}({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);