From 6d41ff008fe8f65a1e65ef918c6d6d209be66a2a Mon Sep 17 00:00:00 2001
From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl>
Date: Wed, 5 Dec 2012 14:53:51 +0100
Subject: [PATCH] update noprep.ccl, WCCL rules for removing prepositions from
 NP chunks: handle AgP and AdjP chunks as well

---
 tools/noprep.ccl | 83 ++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 76 insertions(+), 7 deletions(-)

diff --git a/tools/noprep.ccl b/tools/noprep.ccl
index 583ef6b..ede0168 100644
--- a/tools/noprep.ccl
+++ b/tools/noprep.ccl
@@ -1,28 +1,97 @@
-// generates "real" NP chunks by removing chunk-initial prepositions
-// the new chunks are added as "cut_np"
+// generates "real" NP, AdjP and AgP chunks by removing
+// chunk-initial prepositions
+// the new chunks are added as cut_np, cut_adjp and cut_agp
+// the prepositions cut from np and adjp are marked as cut_prep
 
 // to be used with wccl-rules
 
 tag_rules(
-	rule("noprep",
+	rule("noprep_np",
 		and(
 			isannbeg(0, "chunk_np"),
 			not(in({prep}, class[0])),
 			rlook(0, end, $End,
 				isannend($End, "chunk_np")
+			),
+			or(
+				rlook(0, $End, $Hd, isannhead($Hd, "chunk_np")),
+				setvar($Hd, 0)
 			)
 		),
-		mark(0, $End, "cut_np")
+		mark(0, $End, $Hd, "cut_np")
 	);
-	rule("withprep",
+	rule("withprep_np",
 		and(
 			isannbeg(0, "chunk_np"),
 			in({prep}, class[0]),
 			rlook(0, end, $End,
 				isannend($End, "chunk_np")
+			),
+			or(
+				rlook(1, $End, $Hd, isannhead($Hd, "chunk_np")),
+				setvar($Hd, 1)
 			)
 		),
-		mark(1, $End, "cut_np")
+		mark(0, 0, "cut_prep"),
+		mark(1, $End, $Hd, "cut_np")
+	);
+
+	rule("noprep_adjp",
+		and(
+			isannbeg(0, "chunk_adjp"),
+			not(in({prep}, class[0])),
+			rlook(0, end, $End,
+				isannend($End, "chunk_adjp")
+			),
+			or(
+				rlook(0, $End, $Hd, isannhead($Hd, "chunk_adjp")),
+				setvar($Hd, 0)
+			)
+		),
+		mark(0, $End, $Hd, "cut_adjp")
+	);
+	rule("withprep_adjp",
+		and(
+			isannbeg(0, "chunk_adjp"),
+			in({prep}, class[0]),
+			rlook(0, end, $End,
+				isannend($End, "chunk_adjp")
+			),
+			or(
+				rlook(1, $End, $Hd, isannhead($Hd, "chunk_adjp")),
+				setvar($Hd, 1)
+			)
+		),
+		mark(0, 0, "cut_prep"),
+		mark(1, $End, $Hd, "cut_adjp")
+	);
+
+	rule("noprep_agp",
+		and(
+			isannbeg(0, "chunk_agp"),
+			not(in({prep}, class[0])),
+			rlook(0, end, $End,
+				isannend($End, "chunk_agp")
+			),
+			or(
+				rlook(0, $End, $Hd, isannhead($Hd, "chunk_agp")),
+				setvar($Hd, 0)
+			)
+		),
+		mark(0, $End, $Hd, "cut_agp")
+	);
+	rule("withprep_agp",
+		and(
+			isannbeg(0, "chunk_agp"),
+			in({prep}, class[0]),
+			rlook(0, end, $End,
+				isannend($End, "chunk_agp")
+			),
+			or(
+				rlook(1, $End, $Hd, isannhead($Hd, "chunk_agp")),
+				setvar($Hd, 1)
+			)
+		),
+		mark(1, $End, $Hd, "cut_agp")
 	)
 )
-
-- 
GitLab