Spaces:
Sleeping
Sleeping
Update keyphrase_extraction.py
Browse files- keyphrase_extraction.py +14 -3
keyphrase_extraction.py
CHANGED
|
@@ -2,9 +2,20 @@ from rake_nltk import Rake
|
|
| 2 |
import re
|
| 3 |
|
| 4 |
# Define a list of obligation words
|
| 5 |
-
obligation_words = [
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def extract_sentences_with_obligations(text):
|
| 10 |
# Initialize Rake with stopwords set to None (to keep all words)
|
|
|
|
| 2 |
import re
|
| 3 |
|
| 4 |
# Define a list of obligation words
|
| 5 |
+
obligation_words = [
|
| 6 |
+
# English words
|
| 7 |
+
"must", "will", "use", "may", "provides", 'is obliged to',
|
| 8 |
+
'has to', 'needs to', 'is required to', "shall",
|
| 9 |
+
"should", "ought to", "required", "obligated", "duty",
|
| 10 |
+
"agrees to", "has a duty to", "is expected to", "commits to",
|
| 11 |
+
|
| 12 |
+
# German words
|
| 13 |
+
"muss", "wird", "nutzen", "darf", "stellt bereit", "ist verpflichtet",
|
| 14 |
+
"muss", "muss", "muss", "ist erforderlich", "soll",
|
| 15 |
+
"sollte", "sollte", "erforderlich", "verpflichtet", "Pflicht",
|
| 16 |
+
"stimmt zu", "hat die Pflicht", "wird erwartet", "verpflichtet sich"
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
|
| 20 |
def extract_sentences_with_obligations(text):
|
| 21 |
# Initialize Rake with stopwords set to None (to keep all words)
|