-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Look at "input_text_1" and "input_text_2".
There are some obvious spelling errors in the input sentence. There is a fatal error, when processing with PredPatt.from_sentence(sen). However, when using parse tree with PredPatt.from_constituency(sen), it is fine.
=====================================================
Python 3.5.4 (v3.5.4:3f56838976, Aug 7 2017, 12:56:33)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import nltk
from nltk.tokenize import sent_tokenize
from predpatt import PredPattinput_text_1 = "Items that are not dishwasher safemay melt and create a potential fire hazard. NSF certified residential dishwashers are not intended for licensed food establishments."
input_text_2 = "Items that are not dishwasher safemay melt and create a potential fire hazard. NSF certified residential dishwashers are not intended for licensed food establishments. NSF certified residential dishwashers are not intendedfor licensed food establishments."
def sen_2_arg(paragraph):
... sent_tokenize_list = sent_tokenize(paragraph)
... for sen in sent_tokenize_list:
... print(sen)
... decomposed_sen = PredPatt.from_sentence(sen)
... for ds in decomposed_sen.instances:
... print(ds, ds.phrase())
... for a in ds.arguments:
... print(' ', a, a.phrase())
...sen_2_arg(input_text_1)
Items that are not dishwasher safemay melt and create a potential fire hazard.
Predicate(safemay/5) ?a are not dishwasher safemay
Argument(that/1) that
Predicate(melt/6) ?a melt
Argument(Items/0) Items that are not dishwasher safemay
Predicate(create/8) ?a create ?b
Argument(Items/0) Items that are not dishwasher safemay
Argument(hazard/12) a potential fire hazard
NSF certified residential dishwashers are not intended for licensed food establishments.
Predicate(intended/6) ?a are not intended for ?b
Argument(dishwashers/3) NSF certified residential dishwashers
Argument(establishments/10) licensed food establishmentssen_2_arg(input_text_2)
Items that are not dishwasher safemay melt and create a potential fire hazard.
Predicate(safemay/5) ?a are not dishwasher safemay
Argument(that/1) that
Predicate(melt/6) ?a melt
Argument(Items/0) Items that are not dishwasher safemay
Predicate(create/8) ?a create ?b
Argument(Items/0) Items that are not dishwasher safemay
Argument(hazard/12) a potential fire hazard
NSF certified residential dishwashers are not intended for licensed food establishments.
Predicate(intended/6) ?a are not intended for ?b
Argument(dishwashers/3) NSF certified residential dishwashers
Argument(establishments/10) licensed food establishments
NSF certified residential dishwashers are not intendedfor licensed food establishments.
A fatal error has been detected by the Java Runtime Environment:
SIGBUS (0xa) at pc=0x0000000101863f49, pid=75707, tid=0x0000000000000307
JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode bsd-amd64 compressed oops)
Problematic frame:
C [libsystem_platform.dylib+0x4f49] _platform_memmove$VARIANT$Haswell+0x29
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
=============================
Python 3.5.4 (v3.5.4:3f56838976, Aug 7 2017, 12:56:33)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import nltk
from nltk.tokenize import sent_tokenize >>> from stanfordcorenlp import StanfordCoreNLP
from predpatt import PredPatt
stfd_nlp = StanfordCoreNLP('http://localhost', port=9000)input_text_1 = "Items that are not dishwasher safemay melt and create a potential fire hazard. NSF certified residential dishwashers are not intended for licensed food establishments."
input_text_2 = "Items that are not dishwasher safemay melt and create a potential fire hazard. NSF certified residential dishwashers are not intended for licensed food establishments. NSF certified residential dishwashers are not intendedfor licensed food establishments."
def sen_2_arg(paragraph):
... sent_tokenize_list = sent_tokenize(paragraph)
... for sen in sent_tokenize_list:
... print(sen)
... pst = stfd_nlp.parse(sen)
... decomposed_sen = PredPatt.from_constituency(pst)
... for ds in decomposed_sen.instances:
... print(ds, ds.phrase())
...sen_2_arg(input_text_1)
Items that are not dishwasher safemay melt and create a potential fire hazard.
Predicate(dishwasher/4) ?a are not dishwasher safemay
Predicate(melt/6) ?a melt ?b
Predicate(create/8) ?a create
NSF certified residential dishwashers are not intended for licensed food establishments.
Predicate(certified/1) ?a certified ?b
Predicate(intended/6) ?a are not intended for ?bsen_2_arg(input_text_2)
Items that are not dishwasher safemay melt and create a potential fire hazard.
Predicate(dishwasher/4) ?a are not dishwasher safemay
Predicate(melt/6) ?a melt ?b
Predicate(create/8) ?a create
NSF certified residential dishwashers are not intended for licensed food establishments.
Predicate(certified/1) ?a certified ?b
Predicate(intended/6) ?a are not intended for ?b
NSF certified residential dishwashers are not intendedfor licensed food establishments.
Predicate(certified/1) ?a certified ?b
Predicate(establishments/9) ?a are not intendedfor licensed food establishments