1

Currently I am working on PartOfSpeech(POS) tagging in Python using Stanford POStagger. I have set the java home

 java_path = "Path to java bin"
 os.environ['JAVAHOME'] = java_path

Below is my code

def getPOSandSentiment(sentence):
    path_to_model = 'Path/to/Tagger/wsj-0-18-left3words-distsim.tagger'
    path_to_jar = "path/to/stanford-postagger.jar"
    tagger=StanfordPOSTagger(path_to_model, path_to_jar)
    tagger.java_options='-mx2048m'
    posWords = tagger.tag(sentence.split())
    for words,pos in posWords: 
        print('Word : ',words)
        print('POS :', pos)

Everytime I pass a sentence, The java.exe command prompt gets popped up. Is there any way to hide that command prompt? I am using Anaconda3 and spyder IDE for python. Is there any way to set Java_Home in Spyder or Anaconda? Thanks

Deepa Huddar
  • 321
  • 1
  • 4
  • 15
  • use javaw, not java. – pvg Mar 08 '17 at 05:42
  • Where should I use javaw? Not clear. Could you please elaborate? – Deepa Huddar Mar 08 '17 at 05:46
  • Configure (or modify, if it's not directly configurable) StanfordPOSTagger to invoke javaw instead of java. Should be pretty straightforward, all you have to find is the invocation of the java VM and replace it with javaw. – pvg Mar 08 '17 at 05:50

0 Answers0