docs: def _executeMaltparser( input_string, maltparser_dir, maltparser_jar, model_name ):
      ''' Executes Maltparser on given (CONLL-style) input string, and 
          returns the result. The result is an array of lines from Maltparser's 
          output.
          
          Parameters
          ----------
          input_string: string
                input text in CONLL format;
          maltparser_jar: string
                name of the Maltparser's jar file that should be executed;
          model_name: string
                name of the model that should be used;
          maltparser_dir: string
                the directory containing Maltparser's jar and the model file; 
          
          Few of the ideas were also borrowed from NLTK's MaltParser class,
          see  http://www.nltk.org/_modules/nltk/parse/malt.html   for the reference;
      '''
  
      temp_input_file = \
        tempfile.NamedTemporaryFile(prefix='malt_in.', mode='w', delete=False)
      temp_input_file.close()
      # We have to open separately here for writing, because Py 2.7 does not support
      # passing parameter   encoding='utf-8'    to the NamedTemporaryFile;
      out_f = codecs.open(temp_input_file.name, mode='w', encoding='utf-8')
      out_f.write( input_string )
      out_f.close()
  
      temp_output_file = tempfile.NamedTemporaryFile(prefix='malt_out.', mode='w', delete=False)
      temp_output_file.close()
      
      current_dir = os.getcwd()
      os.chdir(maltparser_dir)
      cmd = ['java', '-jar', os.path.join(maltparser_dir, maltparser_jar), \
             '-c', model_name, \
             '-i', temp_input_file.name, \
             '-o', temp_output_file.name, \
             '-m', 'parse' ]
      p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      if p.wait() != 0: 
          raise Exception(' Error on running Maltparser: ', p.stderr.read() )
      os.chdir(current_dir)
      
      results = []
      in_f = codecs.open(temp_output_file.name, mode='r', encoding='utf-8')
      for line in in_f:
          results.append( line.rstrip() )
      in_f.close()
  
      if not temp_input_file.closed:
          raise Exception('Temp input file unclosed!')
      if not temp_output_file.closed:
          raise Exception('Temp input file unclosed!')
      if not out_f.closed:
          raise Exception('Output file unclosed!')
      if not in_f.closed:
          raise Exception('Input file unclosed!')
      # TODO: For some reason, the method gives "ResourceWarning: unclosed file"
      # in Python 3.4, although, apparently, all file handles seem to be closed;
      # Nothing seems to be wrong in Python 2.7;
  
      os.remove(temp_input_file.name)
      os.remove(temp_output_file.name)
  
      return results