stanford-nlp

Get corresponding verbs and nouns for adverbs and adjectives

最后都变了- 提交于 2019-12-10 10:24:08
问题 How can I get corresponding verbs and nouns for adverbs and adjectives in python? It seems simple succession and precedence may not be very accurate. There may be stopwords like to eg. in I am delighted to learn... I can't any library or even problem statement formalised as such. Code right now. Now I want to return the corresponding the verb for adverb and noun for each adjective in the sentence. Please help. Code: def pos_func(input_text): #pos tagging code: text=input_text tokens=tokenize

Does the Stanford NLP Parser have methods for semantic role labelling?

纵然是瞬间 提交于 2019-12-10 10:13:08
问题 I'm trying to find the semantic labels of english sentences. I am using the Stanford NLP parser. Does it have methods for this? I was going through the documentation but the closest thing I could find was: CoreAnnotations.SemanticWordAnnotation CoreAnnotations.SemanticTagAnnotation 回答1: No, we currently don't have a semantic role labeling (SRL) system in CoreNLP. Unless you already have a system that explicitly requires semantic role labels, I would recommend taking a look at the Universal

NLTK CoreNLPDependencyParser: Failed to establish connection

落爺英雄遲暮 提交于 2019-12-10 10:03:05
问题 I'm trying to use the Stanford Parser through NLTK, following the example here. I follow the first two lines of the example (with the necessary import) from nltk.parse.corenlp import CoreNLPDependencyParser dep_parser = CoreNLPDependencyParser(url='http://localhost:9000') parse, = dep_parser.raw_parse('The quick brown fox jumps over the lazy dog.') but I get an error saying: [...] Failed to establish a new connection: [Errno 61] Connection refused" I realize that it must be an issue with

Example for Stanford NLP Classifier

会有一股神秘感。 提交于 2019-12-10 09:47:28
问题 I am trying to learn the Stanford NLP Classifier and would like to work on the problem of document classification. Can anyone suggest a place where I can find a working example? I was also looking at the Open NLP libraries and was able to find many working examples, like http://tharindu-rusira.blogspot.com/2013/12/opennlp-text-classifier.html So, as we can see here, it is quite easy to figure out what's going on and create a small working prototype. However, I can't find a simple example for

Using StanfordParser to get typed dependencies from a parsed sentence

旧巷老猫 提交于 2019-12-10 03:14:34
问题 Using NLTK's StanfordParser, I can parse a sentence like this: os.environ['STANFORD_PARSER'] = 'C:\jars' os.environ['STANFORD_MODELS'] = 'C:\jars' os.environ['JAVAHOME'] ='C:\ProgramData\Oracle\Java\javapath' parser = stanford.StanfordParser(model_path="C:\jars\englishPCFG.ser.gz") sentences = parser.parse(("bring me a red ball",)) for sentence in sentences: sentence The result is: Tree('ROOT', [Tree('S', [Tree('VP', [Tree('VB', ['Bring']), Tree('NP', [Tree('DT', ['a']), Tree('NN', ['red'])])

Stanford CoreNLP wrong coreference resolution

。_饼干妹妹 提交于 2019-12-10 00:32:44
问题 I am still playing with Stanford's CoreNLP and I am encountering strange results on a very trivial test of Coreference resolution. Given the two sentences : The hotel had a big bathroom. It was very clean. I would expect "It" in sentence 2 to be coreferenced by "bathroom" or at least "a big bathroom" of sentence 1. Unfortunately it point to "The hotel" which in my opinion is wrong. Is there a way to solve this problem ? Do I need to train anything or is it supposed to work out of the box ?

How to make a tree from the output of a dependency parser?

徘徊边缘 提交于 2019-12-09 20:30:01
问题 I am trying to make a tree (nested dictionary) from the output of dependency parser. The sentence is "I shot an elephant in my sleep". I am able to get the output as described on the link: How do I do dependency parsing in NLTK? nsubj(shot-2, I-1) det(elephant-4, an-3) dobj(shot-2, elephant-4) prep(shot-2, in-5) poss(sleep-7, my-6) pobj(in-5, sleep-7) To convert this list of tuples into nested dictionary, I used the following link: How to convert python list of tuples into tree? def build

NLP to classify/label the content of a sentence (Ruby binding necesarry)

会有一股神秘感。 提交于 2019-12-09 13:36:27
问题 I am analysing a few million emails. My aim is to be able to classify then into groups. Groups could be e.g.: Delivery problems (slow delivery, slow handling before dispatch, incorrect availability information, etc.) Customer service problems (slow email response time, impolite response, etc.) Return issues (slow handling of return request, lack of helpfulness from the customer service, etc.) Pricing complaint (hidden fee's discovered, etc.) In order to perform this classification, I need a

NLP to find relationship between entities

混江龙づ霸主 提交于 2019-12-09 12:59:05
问题 My current understanding is that it's possible to extract entities from a text document using toolkits such as OpenNLP, Stanford NLP. However, is there a way to find relationships between these entities? For example consider the following text : "As some of you may know, I spent last week at CERN, the European high-energy physics laboratory where the famous Higgs boson was discovered last July. Every time I go to CERN I feel a deep sense of reverence. Apart from quick visits over the years, I

How to remove non-valid unicode characters from strings in java

匆匆过客 提交于 2019-12-09 11:33:33
问题 I am using the CoreNLP Neural Network Dependency Parser to parse some social media content. Unfortunately, the file contains characters which are, according to fileformat.info, not valid unicode characters or unicode replacement characters. These are for example U+D83D or U+FFFD. If those characters are in the file, coreNLP responds with errors messages like this one: Nov 15, 2015 5:15:38 PM edu.stanford.nlp.process.PTBLexer next WARNING: Untokenizable: ? (U+D83D, decimal: 55357) Based on