import pprint

from docopt import docopt

from iepy.core import BootstrappedIEPipeline
from iepy import db
from iepy.human_validation import TerminalInterviewer
from iepy.utils import load_facts_from_csv, save_labeled_evidence_to_csv

if __name__ == '__main__':
    opts = docopt(__doc__, version=0.1)
    connection = db.connect(opts['<dbname>'])
    seed_facts = load_facts_from_csv(opts['<seeds_file>'])
    p = BootstrappedIEPipeline(connection, seed_facts)

    STOP = 'STOP'

    p.start()  # blocking
    keep_looping = True
    while keep_looping:
        qs = list(p.questions_available())
        if not qs:
            keep_looping = False
        term = TerminalInterviewer(qs, p.add_answer, [(STOP, 'Stop execution ASAP')])
        result = term()
        if result == STOP:
            keep_looping = False
        p.force_process()
    facts = p.known_facts()  # profit
    save_labeled_evidence_to_csv(facts.items(), "facts.csv")

import pprint

from docopt import docopt

from iepy.core import BootstrappedIEPipeline
from iepy import db
from iepy.human_validation import TerminalInterviewer
from iepy.utils import load_facts_from_csv, save_labeled_evidence_to_csv

if __name__ == '__main__':
    opts = docopt(__doc__, version=0.1)
    connection = db.connect(opts['<dbname>'])
    seed_facts = load_facts_from_csv(opts['<seeds_file>'])
    output_file = load_facts_from_csv(opts['<output_file>'])
    p = BootstrappedIEPipeline(connection, seed_facts)

    STOP = 'STOP'

    p.start()  # blocking
    keep_looping = True
    while keep_looping:
        qs = list(p.questions_available())
        if not qs:
            keep_looping = False
        term = TerminalInterviewer(qs, p.add_answer, [(STOP, 'Stop execution ASAP')])
        result = term()
        if result == STOP:
            keep_looping = False
        p.force_process()
    facts = p.known_facts()  # profit
    save_labeled_evidence_to_csv(facts.items(), output_file)

Add <output_file> parameter to the IEPY runner script.
Add <output_file> parameter to the IEPY runner script.

  import pprint
  
  from docopt import docopt
  
  from iepy.core import BootstrappedIEPipeline
  from iepy import db
  from iepy.human_validation import TerminalInterviewer
  from iepy.utils import load_facts_from_csv, save_labeled_evidence_to_csv
  
  if __name__ == '__main__':
      opts = docopt(__doc__, version=0.1)
      connection = db.connect(opts['<dbname>'])
      seed_facts = load_facts_from_csv(opts['<seeds_file>'])
+     output_file = load_facts_from_csv(opts['<output_file>'])
      p = BootstrappedIEPipeline(connection, seed_facts)
  
      STOP = 'STOP'
  
      p.start()  # blocking
      keep_looping = True
      while keep_looping:
          qs = list(p.questions_available())
          if not qs:
              keep_looping = False
          term = TerminalInterviewer(qs, p.add_answer, [(STOP, 'Stop execution ASAP')])
          result = term()
          if result == STOP:
              keep_looping = False
          p.force_process()
      facts = p.known_facts()  # profit
-     save_labeled_evidence_to_csv(facts.items(), "facts.csv")
+     save_labeled_evidence_to_csv(facts.items(), output_file)
  
Add <output_file> parameter to the IEPY runner script.
## Code Before:
import pprint

from docopt import docopt

from iepy.core import BootstrappedIEPipeline
from iepy import db
from iepy.human_validation import TerminalInterviewer
from iepy.utils import load_facts_from_csv, save_labeled_evidence_to_csv

if __name__ == '__main__':
    opts = docopt(__doc__, version=0.1)
    connection = db.connect(opts['<dbname>'])
    seed_facts = load_facts_from_csv(opts['<seeds_file>'])
    p = BootstrappedIEPipeline(connection, seed_facts)

    STOP = 'STOP'

    p.start()  # blocking
    keep_looping = True
    while keep_looping:
        qs = list(p.questions_available())
        if not qs:
            keep_looping = False
        term = TerminalInterviewer(qs, p.add_answer, [(STOP, 'Stop execution ASAP')])
        result = term()
        if result == STOP:
            keep_looping = False
        p.force_process()
    facts = p.known_facts()  # profit
    save_labeled_evidence_to_csv(facts.items(), "facts.csv")

## Instruction:
Add <output_file> parameter to the IEPY runner script.
## Code After:
import pprint

from docopt import docopt

from iepy.core import BootstrappedIEPipeline
from iepy import db
from iepy.human_validation import TerminalInterviewer
from iepy.utils import load_facts_from_csv, save_labeled_evidence_to_csv

if __name__ == '__main__':
    opts = docopt(__doc__, version=0.1)
    connection = db.connect(opts['<dbname>'])
    seed_facts = load_facts_from_csv(opts['<seeds_file>'])
    output_file = load_facts_from_csv(opts['<output_file>'])
    p = BootstrappedIEPipeline(connection, seed_facts)

    STOP = 'STOP'

    p.start()  # blocking
    keep_looping = True
    while keep_looping:
        qs = list(p.questions_available())
        if not qs:
            keep_looping = False
        term = TerminalInterviewer(qs, p.add_answer, [(STOP, 'Stop execution ASAP')])
        result = term()
        if result == STOP:
            keep_looping = False
        p.force_process()
    facts = p.known_facts()  # profit
    save_labeled_evidence_to_csv(facts.items(), output_file)
