Beispiel #1
0
def adnominalAdjunct(person=None, gender=None, number=None, function='S',
                     kind=None, S=None, position='pos'):
    L = []

    if kind == 'noun':
        if percent(20):
            if percent(50):
                # menino feio
                # bola feia
                adjective = wf.getNominal('adjective', gender, number, S)
                L.append(adjective)
            else:
                if percent(40):
                    # menino que correu
                    # bola que caiu
                    L = [wf.getRelativePronoun(gender, number, None),
                         verbPhrase(person, gender, number, S=S)]
                elif percent(50):
                    # menino que a mãe ama
                    # bola que o menino chutou
                    L = [wf.getRelativePronoun(gender, number, None),
                         clause(tran='vtd', OD=S)]
                else:
                    # menino de quem a mãe gosta
                    # bola da qual o menino gosta
                    that_clause = clause(tran='vti', OI=S)
                    preposition = wf.getPreposition(
                        that_clause.info['preposition'], gender,
                        number, None)
                    L = [
                        preposition,
                        wf.getRelativePronoun(
                            gender, number, S
                        ),
                        that_clause
                    ]

    elif kind == 'personal_pronoun' and function == 'S':
        if percent(20):
            # eu que corri
            L = [wf.getRelativePronoun(gender, number, None),
                 verbPhrase(person, gender, number, S=S)]

    if L:
        return Tree('adnominal adjunct', L, {})
    else:
        return None
Beispiel #2
0
def prepositionalPhrase(preposition=None, person=None, gender=None,
                        number=None, function='S', kind=None, S=None):

    if person is None:
        if S and verify_semantics(S, 'PESSOA'):
            person = aleatory('person')
        else:
            person = '3'
    if kind is None:
        if person != '3' or percent(15):
            kind = 'personal_pronoun'
        else:
            kind = 'noun'

    np = nounPhrase(person, gender, number, function, kind, S)
    next = np.info['next']
    L = [np]

    p = wf.getPreposition(preposition, gender, number, next)

    L = [Tree("preposition", [p])] + L

    return Tree('prepositional phrase', L, {'head': np.info['head']})