Skip to content

Commit e0e8f28

Browse files
committed
update notebook demos
1 parent d550131 commit e0e8f28

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

examples/RuleBasedNLP.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"metadata": {},
8484
"outputs": [],
8585
"source": [
86-
"from dackar.causal.RuleBasedMatcher import RuleBasedMatcher\n",
86+
"from dackar.causal.CausalSentence import CausalSentence\n",
8787
"from dackar import config\n",
8888
"from dackar.utils.nlp.nlp_utils import generatePatternList"
8989
]
@@ -173,7 +173,7 @@
173173
"outputs": [],
174174
"source": [
175175
"name = 'ssc_entity_ruler'\n",
176-
"matcher = RuleBasedMatcher(nlp, entID=entId, causalKeywordID=causalID)\n",
176+
"matcher = CausalSentence(nlp, entID=entId, causalKeywordID=causalID)\n",
177177
"matcher.addEntityPattern(name, patternsOPM)\n",
178178
"\n",
179179
"causalName = 'causal_keywords_entity_ruler'\n",

examples/WorkOrderProcessing.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"frameworkDir = os.path.abspath(os.path.join(cwd, os.pardir, 'src'))\n",
3939
"sys.path.append(frameworkDir)\n",
4040
"\n",
41-
"from dackar.causal.WorkOrderProcessing import WorkOrderProcessing\n",
41+
"from dackar.causal.CausalPhrase import CausalPhrase\n",
4242
"from dackar.utils.nlp.nlp_utils import generatePatternList\n",
4343
"\n",
4444
"logging.basicConfig(format='%(asctime)s %(name)-20s %(levelname)-8s %(message)s', datefmt='%d-%b-%y %H:%M:%S', level=logging.INFO)\n",
@@ -50,7 +50,7 @@
5050
"id": "485dacf2",
5151
"metadata": {},
5252
"source": [
53-
"#### Generate entities patterns and process text using WorkOrderProcessing class\n",
53+
"#### Generate entities patterns and process text using CausalPhrase class\n",
5454
"\n",
5555
"The following information will be identified:\n",
5656
"\n",
@@ -71,7 +71,7 @@
7171
"entId = \"OPM\"\n",
7272
"# Load language model\n",
7373
"nlp = spacy.load(\"en_core_web_lg\", exclude=[])\n",
74-
"matcher = WorkOrderProcessing(nlp, entID=entId)\n",
74+
"matcher = CausalPhrase(nlp, entID=entId)\n",
7575
"\n",
7676
"entIDList = ['1-91120-P1', '1-91120-PM1', '91120']\n",
7777
"patternsEnts = generatePatternList(entIDList, label=entLabel, id=entId, nlp=nlp, attr=\"LEMMA\")\n",

examples/Workflow_Demo.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"########################\n",
4040
"\n",
4141
"# Internal Modules #\n",
42-
"from dackar.causal.RuleBasedMatcher import RuleBasedMatcher\n",
42+
"from dackar.causal.CausalSentence import CausalSentence\n",
4343
"from dackar import config\n",
4444
"from dackar.utils.nlp.nlp_utils import generatePatternList\n",
4545
"from dackar.text_processing.Preprocessing import Preprocessing\n",
@@ -170,7 +170,7 @@
170170
"metadata": {},
171171
"outputs": [],
172172
"source": [
173-
"matcher = RuleBasedMatcher(nlp, entID=entId, causalKeywordID=causalID)\n",
173+
"matcher = CausalSentence(nlp, entID=entId, causalKeywordID=causalID)\n",
174174
"\n",
175175
"matcher.addEntityPattern('ssc_entity_ruler', patternsEnts)\n",
176176
"matcher.addEntityPattern('causal_keywords_entity_ruler', patternsCausal)"

tests/causal/test_causal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from dackar.causal.RuleBasedMatcher import RuleBasedMatcher
1+
from dackar.causal.CausalSentence import CausalSentence
22
from dackar.causal.OperatorShiftLogsProcessing import OperatorShiftLogs
3-
from dackar.causal.WorkOrderProcessing import WorkOrderProcessing
3+
from dackar.causal.CausalPhrase import CausalPhrase
44
from dackar.config import nlpConfig
55
from dackar.utils.nlp.nlp_utils import generatePatternList
66
import spacy
@@ -44,9 +44,9 @@ def processCausalEnt(self):
4444

4545
def get_matcher(self, method):
4646
if method == 'general':
47-
matcher = RuleBasedMatcher(self.nlp, entID=self.entId, causalKeywordID=self.causalID)
47+
matcher = CausalSentence(self.nlp, entID=self.entId, causalKeywordID=self.causalID)
4848
elif method == 'wo':
49-
matcher = WorkOrderProcessing(self.nlp, entID=self.entId, causalKeywordID=self.causalID)
49+
matcher = CausalPhrase(self.nlp, entID=self.entId, causalKeywordID=self.causalID)
5050
elif method == 'osl':
5151
matcher = OperatorShiftLogs(self.nlp, entID=self.entId, causalKeywordID=self.causalID)
5252
else:

0 commit comments

Comments
 (0)