def subject_relative_clause(noun):
    """
    :param noun: noun to be modified (subject of RC)
    :return: relative clause (without modified noun)
    """
    # boy who ate the apple
    # N   rel V1  D1  N2
    rel = choice(get_matched_by(noun, "arg_1", get_all("category_2", "rel")))
    VP = verb_phrase_from_subj(noun)
    VP[0] = remove_extra_whitespace("%s %s" % (rel[0], VP[0]))
    #TODO: properties of VP might not be correct for RC
    return VP
            Dirr_pl = "some"


    # Build Paradigms
    # Step 1: Generate conjugation pattern:
    the_aux = np.random.choice([0,1])
    the_tense = np.random.choice([0,1])
    the_neg = np.random.choice([0,1], p=[0.8, 0.2])
    if the_tense == 0:
        tensestring = "true"
    else:
        tensestring = "false"

    copy_verb = coll_pred.copy()
    conjugate2(copy_verb,Nreg_sg,the_aux,the_tense,the_neg)
    sentence_1 = remove_extra_whitespace(Dreg_sg + " " + Nreg_sg[0] + " " + copy_verb[0])
    sentence_1_meta = "experiment=plurals_env=collective_predicates_reg=1_sg=1_coll=1" + "_present=" + tensestring
    sentence_1_grammaticality = 0

    copy_verb = ncoll_pred.copy()
    conjugate2(copy_verb,Nreg_sg,the_aux,the_tense,the_neg)
    sentence_2 = remove_extra_whitespace(Dreg_sg + " " + Nreg_sg[0] + " " + copy_verb[0])
    sentence_2_meta = "experiment=plurals_env=collective_predicates_reg=1_sg=1_coll=0" + "_present=" + tensestring
    sentence_2_grammaticality = 1

    copy_verb = coll_pred.copy()
    conjugate2(copy_verb, Nreg_pl, the_aux, the_tense, the_neg)
    sentence_3 = remove_extra_whitespace(Dreg_pl + " " + Nreg_pl[0] + " " + copy_verb[0])
    sentence_3_meta = "experiment=plurals_env=collective_predicates_reg=1_sg=0_coll=1" + "_present=" + tensestring
    sentence_3_grammaticality = 1
示例#3
0
    sentence_4 = "%s %s %s %s %s that %s %s %s %s %s %s %s ." % (D1[0], N1[0], Aux1_final, NPI_replacement, V1_final, D2[0],
                                                                 N2[0], Aux2_final, Adv_freq[0], V2_final, D3[0], N3[0])

    # build sentences with nonfrequent adverb
    sentence_5 = "%s %s %s %s ever %s that %s %s %s %s %s %s ." % (D1[0], N1[0], Aux1_final, Adv_nonfreq[0], V1_final,
                                                                   D2[0], N2[0], Aux2_final, V2_final, D3[0], N3[0])
    sentence_6 = "%s %s %s %s %s %s that %s %s %s %s %s %s ." % (D1[0], N1[0], Aux1_final, Adv_nonfreq[0], NPI_replacement,
                                                                 V1_final, D2[0], N2[0], Aux2_final, V2_final, D3[0], N3[0])
    sentence_7 = "%s %s %s ever %s that %s %s %s %s %s %s %s ." % (D1[0], N1[0], Aux1_final, V1_final, D2[0], N2[0],
                                                                   Aux2_final, Adv_nonfreq[0], V2_final, D3[0], N3[0])
    sentence_8 = "%s %s %s %s %s that %s %s %s %s %s %s %s ." % (D1[0], N1[0], Aux1_final, NPI_replacement, V1_final, D2[0],
                                                                 N2[0], Aux2_final, Adv_nonfreq[0], V2_final, D3[0], N3[0])

    # remove doubled up spaces (this is because the bare plural doesn't have a determiner,
    # but the code outputs a determiner with an empty string. might want to change this)
    sentence_1 = remove_extra_whitespace(sentence_1)
    sentence_2 = remove_extra_whitespace(sentence_2)
    sentence_3 = remove_extra_whitespace(sentence_3)
    sentence_4 = remove_extra_whitespace(sentence_4)
    sentence_5 = remove_extra_whitespace(sentence_5)
    sentence_6 = remove_extra_whitespace(sentence_6)
    sentence_7 = remove_extra_whitespace(sentence_7)
    sentence_8 = remove_extra_whitespace(sentence_8)

    # write sentences to output
    if sentence_1 not in sentences:
        # sentences 1-4 have frequent adverb
        output.write("%s\t%d\t\t%s\n" % ("experiment=NPI-env=adverbs-npi=ever-crucial_item=%s-licensor=0-scope=1-npi_present=1" % Adv_freq[0], 0, sentence_1))
        output.write("%s\t%d\t\t%s\n" % ("experiment=NPI-env=adverbs-npi=ever-crucial_item=%s-licensor=0-scope=1-npi_present=0" % Adv_freq[0], 1, sentence_2))
        output.write("%s\t%d\t\t%s\n" % ("experiment=NPI-env=adverbs-npi=ever-crucial_item=%s-licensor=0-scope=0-npi_present=1" % Adv_freq[0], 0, sentence_3))
        output.write("%s\t%d\t\t%s\n" % ("experiment=NPI-env=adverbs-npi=ever-crucial_item=%s-licensor=0-scope=0-npi_present=0" % Adv_freq[0], 1, sentence_4))
示例#4
0
        print(N1[0], V1[0])
        continue

    # build sentences with question environment
    sentence_1 = "%s the %s ever %s the %s?" % (Aux1_capital, N1[0], V1[0],
                                                N2[0])
    sentence_2 = "%s the %s %s %s the %s?" % (Aux1_capital, N1[0], decoy,
                                              V1[0], N2[0])

    # build sentences with non-question environment
    sentence_5 = "The %s %s ever %s the %s." % (N1[0], Aux1[0], V1[0], N2[0])
    sentence_6 = "The %s %s %s %s the %s." % (N1[0], Aux1[0], decoy, V1[0],
                                              N2[0])

    # remove doubled up spaces
    sentence_1 = remove_extra_whitespace(sentence_1)
    sentence_2 = remove_extra_whitespace(sentence_2)
    sentence_5 = remove_extra_whitespace(sentence_5)
    sentence_6 = remove_extra_whitespace(sentence_6)

    # write sentences to output
    if sentence_1 not in sentences:
        # sentences 1-4 have question environment
        output.write("%s\t%d\t\t%s\n" % (
            "experiment=NPI-env=simplequestions-npi=ever-crucial_item=?-licensor=1-scope=1-npi_present=1",
            1, sentence_1))
        output.write("%s\t%d\t\t%s\n" % (
            "experiment=NPI-env=simplequestions-npi=ever-crucial_item=?-licensor=1-scope=1-npi_present=0",
            1, sentence_2))
        # sentences 5-8 have non-question environment
        output.write("%s\t%d\t\t%s\n" % (