Reformat grammar.py
This commit is contained in:
parent
370415e29b
commit
416d00bf69
14
grammar.py
14
grammar.py
|
@ -15,8 +15,6 @@ from grammatical_types import (
|
||||||
VerbPhrase,
|
VerbPhrase,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 3A: LOVE POEM
|
|
||||||
|
|
||||||
def pluralize(noun):
|
def pluralize(noun):
|
||||||
"Noun -> PluralNoun"
|
"Noun -> PluralNoun"
|
||||||
assert type(noun) == Noun
|
assert type(noun) == Noun
|
||||||
|
@ -25,55 +23,43 @@ def pluralize(noun):
|
||||||
else:
|
else:
|
||||||
return PluralNoun(noun + 's')
|
return PluralNoun(noun + 's')
|
||||||
|
|
||||||
# 3B: COUPLET
|
|
||||||
|
|
||||||
def noun_phrase(adjective, noun):
|
def noun_phrase(adjective, noun):
|
||||||
"(Adjective, Noun) -> NounPhrase"
|
"(Adjective, Noun) -> NounPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def determine_noun_phrase(determiner, noun_phrase):
|
def determine_noun_phrase(determiner, noun_phrase):
|
||||||
"(Determiner, NounPhrase) -> Determined NounPhrase"
|
"(Determiner, NounPhrase) -> Determined NounPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def make_definite(noun_phrase):
|
def make_definite(noun_phrase):
|
||||||
"NounPhrase -> DeterminedNounPhrase"
|
"NounPhrase -> DeterminedNounPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def make_indefinite(noun_phrase):
|
def make_indefinite(noun_phrase):
|
||||||
"NounPhrase -> DeterminedNounPhrase"
|
"NounPhrase -> DeterminedNounPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
# 3C: LIMERICK
|
|
||||||
|
|
||||||
def verb_phrase(adverb, verb_phrase):
|
def verb_phrase(adverb, verb_phrase):
|
||||||
"(Adverb, VerbPhrase) -> VerbPhrase"
|
"(Adverb, VerbPhrase) -> VerbPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def past_tense_transitive(verb):
|
def past_tense_transitive(verb):
|
||||||
"TransitiveVerb -> PastTenseTransitiveVerb"
|
"TransitiveVerb -> PastTenseTransitiveVerb"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def past_tense_intransitive(verb):
|
def past_tense_intransitive(verb):
|
||||||
"TransitiveVerb -> PastTenseIntransitiveVerb"
|
"TransitiveVerb -> PastTenseIntransitiveVerb"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
def verb_phrase_transitive(verb, noun_phrase):
|
def verb_phrase_transitive(verb, noun_phrase):
|
||||||
"(TransitiveVerb, NounPhrase) -> VerbPhrase"
|
"(TransitiveVerb, NounPhrase) -> VerbPhrase"
|
||||||
#YOUR CODE GOES HERE
|
#YOUR CODE GOES HERE
|
||||||
|
|
||||||
raise NotImplementedError("This function isn't done!")
|
raise NotImplementedError("This function isn't done!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue