GithubHelp home page GithubHelp logo

Comments (21)

gkotsis avatar gkotsis commented on September 5, 2024

Unfortunately, I have never tested it in a Windows environment. I imagine firing up the HTTP server includes POSIX threads.

To my knowledge this is only available in Unix environments.

It should work on any MacOS/Linux/Unix environment though...

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

It appears you have not installed Java? or maybe it's not in your PATH?

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

Try reducing the heap size, i.e.

-Xmx2g

maybe?

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024
  • for the last error you probably need to install setuptools (google it, depends on your current python installation)

  • for the negation error, it appears you are either trying to run it from a different folder (stanford core nlp) or that you have not installed stanford_corenlp_pywrapper (see installation guideline in my repo)

Else, try removing everything and starting from scratch; if you follow the steps one by one, I believe you may be successful

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

hmm, it appears this may be an error.

try negation_detection.predict(sentence, 'suicide')

let me know if this worked

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

try:

import nltk
nltk.download('all')

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

That is great!

Assuming you used the example sentence, this is indeed correct (i.e. 'suicide attempts' is affirmed/True).

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

gkotsis avatar gkotsis commented on September 5, 2024

Hi,

I am afraid I cannot share/publish this dataset. The dataset originates from real-world Electronic Health Records and I am not allowed to share this data.

from negation-detection.

thavasimaniraj avatar thavasimaniraj commented on September 5, 2024

from negation-detection.

kaushikepi avatar kaushikepi commented on September 5, 2024

@thavasimaniraj @gkotsis How did you get the parse key value when you have used mode as 'pos'.
have you used shift-reduce parse?

from negation-detection.

kaushikepi avatar kaushikepi commented on September 5, 2024

Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 15:01:53)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import negation_detection
INFO:CoreNLP_PyWrapper:mode given as 'parse' so setting annotators: tokenize, ssplit, pos, lemma, parse
INFO:CoreNLP_PyWrapper:Starting java subprocess, and waiting for signal it's ready, with command: exec java -Xmx4g -XX:ParallelGCThreads=1 -cp '/Users/kaushikjaiswal/anaconda3/envs/DOS/lib/python3.6/site-packages/stanford_corenlp_pywrapper/lib/:/Users/kaushikjaiswal/Desktop/Negation/negation-detection/stanford-corenlp-full-2018-10-05/' corenlp.SocketServer --outpipe /tmp/corenlp_pywrap_pipe_pypid=6089_time=1586333049.602601 --configdict '{"annotators":"tokenize, ssplit, pos, lemma, parse"}'
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[main] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.4 sec].
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator lemma
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator parse
[main] INFO edu.stanford.nlp.parser.common.ParserGrammar - Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... done [1.0 sec].
INFO:CoreNLP_JavaServer: CoreNLP pipeline initialized.
INFO:CoreNLP_JavaServer: Waiting for commands on stdin
INFO:CoreNLP_PyWrapper:Successful ping. The server has started.
INFO:CoreNLP_PyWrapper:Subprocess is ready.
Traceback (most recent call last):
File "", line 1, in
File "/Users/kaushikjaiswal/Desktop/Negation/negation-detection/negation_detection.py", line 439, in predict
INFO:CoreNLP_JavaServer: INPUT: 1 documents, 101 characters, 19 tokens, 101.0 char/doc, 19.0 tok/doc RATES: 0.880 doc/sec, 16.7 tok/sec

sentence = preprocess(sentence, keyword)

File "/Users/kaushikjaiswal/Desktop/Negation/negation-detection/negation_detection.py", line 152, in preprocess
for e in rs['sentences']:
TypeError: 'NoneType' object is not subscriptable

from negation-detection.

kaushikepi avatar kaushikepi commented on September 5, 2024
{"sentences":
	[
		{	"pos":["NNP","VBD","DT","JJ","NNS","IN","JJ","NN",",","VBD","WRB","IN","DT","JJ","PRP","VBD","JJ","NN","NNS"],

			"lemmas":["ZZZZ","report","no","recent","period","of","low","mood",",","discuss","how","in","the","past","she","make","many","suicide","attempt"],

			"tokens":["ZZZZ","reported","no","recent","periods","of","low","mood",",","discussed","how","in","the","past","she","made","many","suicide","attempts"],

			"char_offsets":[[0,4],[5,13],[14,16],[17,23],[24,31],[32,34],[35,38],[39,43],[43,44],[45,54],[55,58],[59,61],[62,65],[66,70],[71,74],[75,79],[80,84],[85,92],[93,101]]
		}
	]
}

There is no parse key in it then how did you get the values when the p = tmp['sentences'][i]['parse'] of the below function gets called:

def findSentencePTreeToken(sentence, keyword):
	import nltk
	from nltk.tree import ParentedTree
	stemmed = _lemma_(keyword)
	tmp = proc.parse_doc(sentence)
	i = 0
	numSentences = len(tmp['sentences'])
	rs = []
	for i in range(0, numSentences):
		p = tmp['sentences'][i]['parse']
		ptree = ParentedTree.fromstring(p)

		# rs = []
		for i in range(0, len(ptree.leaves())):
			tree_position = ptree.leaf_treeposition(i)

			node = ptree[tree_position]

			if _stem_(node)==stemmed:
				tree_position = tree_position[0:len(tree_position)-1]
				rs.append(ptree[tree_position])
		# if len(rs)>0:
		# 	return rs
	return rs

@gkotsis

from negation-detection.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.