emilmont / pyStatParser

Simple Python Statistical Parser
Apache License 2.0
109 stars 49 forks source link

Error while parsing a sentence with brackets #4

Open Stolpovskaya opened 10 years ago

Stolpovskaya commented 10 years ago

The program trew an error while parsing a sentence with brackets in it. If the part in brackets is removed, the sentence gets parsed successfully.

print parser.parse ("(CCC 2313) Defending one's country against aggression is permitted, but we should never forget that every human life, from the moment of conception, is sacred because it is made in God's image and likeness.")

Traceback (most recent call last): File "<pyshell#224>", line 1, in print parser.parse ("(CCC 2313) Defending one's country against aggression is permitted, but we should never forget that every human life, from the moment of conception, is sacred because it is made in God's image and likeness.") File "stat_parser\parser.py", line 111, in nltk_parse return nltk_tree(self.raw_parse(sentence)) File "stat_parser\parser.py", line 106, in raw_parse tree = self.norm_parse(sentence) File "stat_parser\parser.py", line 92, in norm_parse if is_cap_word(words[0]): File "stat_parser\word_classes.py", line 6, in is_cap_word return CAP.match(word) is not None TypeError: expected string or buffer

print parser.parse ("Defending one's country against aggression is permitted, but we should never forget that every human life, from the moment of conception, is sacred because it is made in God's image and likeness.") (S+VP (VBG defending) (NP (NP (PRP one) (POS 's)) (NN country) (SBAR (IN against) (S (VP (VB aggression) (VBZ is) (UCP (VP (JJ permitted)) (, ,) (CC but) (S (NP (PRP we)) (VP (MD should) (ADVP (RB never)) (VB forget) (PP (IN that) (NP (DT every) (JJ human) (NN life))))) (, ,) (PP (IN from) (NP (NP (DT the) (NN moment)) (PP (IN of) (NP (NN conception))))) (, ,) (VP (VBZ is) (VBD sacred) (SBAR (IN because) (S (NP (PRP it)) (VP (VBZ is) (VBN made) (PP (IN in) (NP (NNP God) (POS 's))))))) (NN image) (CC and) (JJ likeness))) (. .)))))