class_docstr: Wrapper for the
  :class:`~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser`
  model.
class_docstr_tok: ["Wrapper","for","the",":","class",":","`","~allennlp.models.encoder_decoders.wikitables_semantic_parser.WikiTablesSemanticParser","`","model","."]
docstr: The parameters are written out to files which the jar file reads and then executes the
  logical form.
docstr_tok: ["The","parameters","are","written","out","to","files","which","the","jar","file","reads","and","then","executes","the","logical","form","."]
code: def _execute_logical_form_on_table(logical_form, table):
      """
      The parameters are written out to files which the jar file reads and then executes the
      logical form.
      """
      logical_form_filename = os.path.join(
          SEMPRE_DIR, "logical_forms.txt"
      )
      with open(logical_form_filename, "w") as temp_file:
          temp_file.write(logical_form + "\n")
  
      table_dir = os.path.join(SEMPRE_DIR, "tsv/")
      os.makedirs(table_dir, exist_ok=True)
      # The .tsv file extension is important here since the table string parameter is in tsv format.
      # If this file was named with suffix .csv then Sempre would interpret it as comma separated
      # and return the wrong denotation.
      table_filename = "context.tsv"
      with open(
          os.path.join(table_dir, table_filename), "w", encoding="utf-8"
      ) as temp_file:
          temp_file.write(table)
  
      # The id, target, and utterance are ignored, we just need to get the
      # table filename into sempre's lisp format.
      test_record = (
          "(example (id nt-0) (utterance none) (context (graph tables.TableKnowledgeGraph %s))"
          '(targetValue (list (description "6"))))' % (table_filename)
      )
      test_data_filename = os.path.join(SEMPRE_DIR, "data.examples")
      with open(test_data_filename, "w") as temp_file:
          temp_file.write(test_record)
  
      # TODO(matt): The jar that we have isn't optimal for this use case - we're using a
      # script designed for computing accuracy, and just pulling out a piece of it. Writing
      # a new entry point to the jar that's tailored for this use would be cleaner.
      command = " ".join(
          [
              "java",
              "-jar",
              cached_path(DEFAULT_EXECUTOR_JAR),
              test_data_filename,
              logical_form_filename,
              table_dir,
          ]
      )
      run(command, shell=True)
  
      denotations_file = os.path.join(
          SEMPRE_DIR, "logical_forms_denotations.tsv"
      )
      with open(denotations_file) as temp_file:
          line = temp_file.readline().split("\t")
  
      # Clean up all the temp files generated from this function.
      # Take care to not remove the auxiliary sempre files
      os.remove(logical_form_filename)
      shutil.rmtree(table_dir)
      os.remove(denotations_file)
      os.remove(test_data_filename)
      return line[1] if len(line) > 1 else line[0]
  
file_path: magnitude/pymagnitude/third_party/allennlp/predictors/wikitables_parser.py
imports: from __future__ import with_statement
  from __future__ import absolute_import
  from builtins import str
  import os
  import pathlib
  import shutil
  from allennlp.common.file_utils import cached_path
  from allennlp.common.util import JsonDict, sanitize
  from allennlp.data import DatasetReader, Instance
  from allennlp.models import Model
  from allennlp.predictors.predictor import Predictor
  from io import open
label_desc: Use image node_id 5 for calling the WikiTablesParserPredictor obj's underlying member method code with example usage: obj._execute_logical_form_on_table(logical_form, table) and returns: unknown