From e4124efa846f824e7b918a0af87f3e3002293317 Mon Sep 17 00:00:00 2001
From: PickleNik <31113245+PickleNik@users.noreply.github.com>
Date: Sat, 25 Nov 2023 02:52:58 -0500
Subject: [PATCH 1/5] fix Compromise and NLTK link in README
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f060de93e..09002a913 100644
--- a/README.md
+++ b/README.md
@@ -856,7 +856,7 @@ nlp.extend({
##### Comparisons
- [Compromise and Spacy](https://observablehq.com/@spencermountain/compromise-and-spacy)
-- [Compromise and NLTK](https://observablehq.com/@spencermountain/compromise-and-NLTK)
+- [Compromise and NLTK](https://observablehq.com/@spencermountain/compromise-and-nltk)
From 70d91d3bd1c950aefc930ab477e67e855614054a Mon Sep 17 00:00:00 2001
From: rcasburn
Date: Wed, 3 Jan 2024 09:31:46 -0500
Subject: [PATCH 2/5] New tests
---
tests/three/sentences/svo.test.js | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/tests/three/sentences/svo.test.js b/tests/three/sentences/svo.test.js
index 1ed4444f5..d261b44eb 100644
--- a/tests/three/sentences/svo.test.js
+++ b/tests/three/sentences/svo.test.js
@@ -17,9 +17,29 @@ test('svo parser', function (t) {
[`every year, we gather in Baltimore`, `we`, `gather`],
[`if only i was awake, we could have eaten the breakfast`, `we`, `could have eaten`],
['Every night before I go to bed, I eat bananas.', 'i', 'eat'],
- ['Diane decided to plant tomatoes in the back of the yard, where the sun blazed the longest during the day.', 'diane', 'decided to plant'],
+ [
+ 'Diane decided to plant tomatoes in the back of the yard, where the sun blazed the longest during the day.',
+ 'diane',
+ 'decided to plant',
+ ],
['Once Adam smashed the spider, he ran into the bathroom', 'he', 'ran into'],
[`We are introducing ourselves to the class.`, 'we', 'are introducing ourselves'],
+ [
+ 'Throughout the day, as the sun gradually set, the temperature dropped significantly, creating a chilly evening.',
+ 'the temperature',
+ 'dropped significantly',
+ ],
+ [
+ 'He collaborated with the university to develop comprehensive academic proposals across the entire campus, encompassing academic priorities in every department at the university and course structure typologies for each academic program.',
+ 'he',
+ 'collaborated',
+ ],
+ ['Despite Susan walking the dog, she was not wearing a coat.', 'she', 'was not wearing'],
+ [
+ 'Taking diligent notes throughout the entire class, the students remained focused during the lecture.',
+ 'the students',
+ 'remained',
+ ],
// ['every day the kitten tries to eat the mouse', 'the kitten', 'tries to eat'],
// ['The boy who you saw at the store committed a robbery.', 'the boy', 'committed'],
From c7214352b06ef3d0ea01e772da9b5078e1c89f62 Mon Sep 17 00:00:00 2001
From: rcasburn
Date: Wed, 3 Jan 2024 09:32:50 -0500
Subject: [PATCH 3/5] update subordinating conjunctions to be beginning of
clause only
---
src/3-three/sentences/parse/mainClause.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/3-three/sentences/parse/mainClause.js b/src/3-three/sentences/parse/mainClause.js
index 609f43d61..94dafb77e 100644
--- a/src/3-three/sentences/parse/mainClause.js
+++ b/src/3-three/sentences/parse/mainClause.js
@@ -28,7 +28,8 @@ const mainClause = function (s) {
return m
}
- m = m.ifNo('(despite|during|before|through|throughout)')
+ // check for subordinating conjunctions -- must be at the beginning of the clause
+ m = m.ifNo('(^despite|^during|^before|^through|^throughout)')
if (m.length === 1) {
return m
}
From ea477d9f31a1790b09190166af0f6dc0b0a593c2 Mon Sep 17 00:00:00 2001
From: rcasburn
Date: Wed, 3 Jan 2024 09:35:26 -0500
Subject: [PATCH 4/5] Add Gerund start clause check -- all tests pass
---
src/3-three/sentences/parse/mainClause.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/3-three/sentences/parse/mainClause.js b/src/3-three/sentences/parse/mainClause.js
index 94dafb77e..af95cae68 100644
--- a/src/3-three/sentences/parse/mainClause.js
+++ b/src/3-three/sentences/parse/mainClause.js
@@ -33,6 +33,13 @@ const mainClause = function (s) {
if (m.length === 1) {
return m
}
+
+ // check for clauses beginning with Gerund ("Taking ..., ...")
+ m = m.ifNo('^#Gerund')
+ if (m.length === 1) {
+ return m
+ }
+
// did we go too far?
if (m.length === 0) {
m = s
From 84ab5eca1521e483f7a3be064e21747793f8d8c9 Mon Sep 17 00:00:00 2001
From: rcasburn
Date: Wed, 3 Jan 2024 09:48:53 -0500
Subject: [PATCH 5/5] fix test to use "throughout" as I intended to test.
---
tests/three/sentences/svo.test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/three/sentences/svo.test.js b/tests/three/sentences/svo.test.js
index d261b44eb..a527914f0 100644
--- a/tests/three/sentences/svo.test.js
+++ b/tests/three/sentences/svo.test.js
@@ -30,7 +30,7 @@ test('svo parser', function (t) {
'dropped significantly',
],
[
- 'He collaborated with the university to develop comprehensive academic proposals across the entire campus, encompassing academic priorities in every department at the university and course structure typologies for each academic program.',
+ 'He collaborated with the university to develop comprehensive academic proposals throughout the entire campus, encompassing academic priorities in every department at the university and course structure typologies for each academic program.',
'he',
'collaborated',
],