def main():

    global tight_phrases_only
    global tot_src_terms
    global X1_only
    if len(sys.argv) < 4 and len(sys.argv) > 6:
        print 'Usage: python %s <file_index> <dataDir> <outDir> [Total_terms on Fr side (def 7)] [True/False] [True/False]' % (sys.argv[0])
        print 'Exiting!!\n'
        sys.exit()

    file_indx = sys.argv[1]
    dDir = sys.argv[2]
    oDir = sys.argv[3]

    if len(sys.argv) > 4:
        tot_src_terms = int(sys.argv[4])
        if len(sys.argv) == 6 and sys.argv[5] != 'True' and sys.argv[5] != 'False':
            print "Last argument should be a boolean True/False indicating one/two non-terminal case"
            sys.exit(1)
        if len(sys.argv) == 6 and sys.argv[5] == 'True':    # True specifies that only one non-terminal is extracted; set False for two non-terminal case
            X1_only = True
        if len(sys.argv) == 7 and sys.argv[6] == 'False':   # False relaxes the tight phrase pairs constraint and enables the model to extract rules from loose phrases as well
            tight_phrases_only = False

    print "Using the French side total terms to be :", tot_src_terms
    print "Enforcing tight phrase-pairs constraint :", tight_phrases_only
    if not dDir.endswith("/"): dDir += "/"
    if not oDir.endswith("/"): oDir += "/"

    spanFile = dDir + file_indx + '.outspan'
    outFile  = oDir + file_indx + '.out'
    tgtFile  = oDir + 'tgt.' + file_indx + '.out'
    readPhraseSpan(spanFile, outFile, tgtFile)
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Grammar-Xtrctr/SCFGXtractor_ph1.py/main/original