0
mr-user
56d

I know it a strange thing to ask but I need help with English grammar ( I am not a English native)

I am doing an assignment on context free grammar program.

What the program need to do it "Produce a grammar tree based on the rule"

For example a sentence "Jame sat.", It will need to produce a grammar tree like this.

S
_____|___
NP VP
| |
N V
| |
holmes sat

The only thing I need to do it give a grammar rule to the program like this

S -> NP VP
NP -> N | Det N
VP -> V | NP

What the above rule said is that the sentence is composed of Noun Phrase and Verb Phrase and Noun Phrase is either is a Noun or a determiner and Noun.

Now here is the meat of the question.

I am having trouble parsing a grammar tree for this sentence "She never said a word until we were at the door here"

I have provided my grammar rule below. I think I forget to add some grammar rule or some of my grammar rule are incorrect. I am not a native English speaker so I am having trouble on it.

The search engine have fail me (I have look up various grammar tree) so I am asking for help on devrant. Grammar nazi are warmly welcome :)

S -> NP VP | S Conj VP | S Conj S

NP -> N | Det NP | N PP | Adj N | Det Adj N | Det N

PP | Det NOM | Det N PP

VP -> V | V NP | V NP PP | V PP | V NP PP Adv

VP -> Adv V NP | VP PP | VP AVP | V PP PP | V
ADJP

PP -> P NP

AVP -> Adv | Adv Adj | Adv AVP

NOM -> Adj Adj N | Adj N | Adj NP

ADJP -> Adj | Adj PP

**I am not sure about these two clause below**
VP -> V | Adv
NP -> Adj Adj N

Comments
  • 0
    Here is a screenshot of where I am stuck at.

    As you can see from the screenshot, I cannot seem to figure out the rule for "we were at the door here"
  • 0
    what the hell is a noun/verb phrase and a determiner? I don't think I've ever even heard those terms in an english course.
  • 0
    @M1sf3t

    The determiner is a word like "a","an","the" which is useless on it own. Noun phrase can be a single noun or a combination of phrase such as "the house". Verb phrase word which is the same as the verb but in a phrase form (combination) like "arrived at".

    You can do well on everyday life without knowing about them but they are the foundation of linguistic.
  • 1
    @mr-user a, an, the specifically? I think those were called articles or something like that when I was in school. Subject for your noun phrase and I think just verb, I don't remember a phrase in there but then again it's been a while. The only "phrase" I remember was a prepositional phrase, that would be the PP?
  • 1
    @mr-user
    That's definitely not something a native speaker would agree with compositionally.

    The concept loosely defined here are articles, but the definition bleeds into adjectives, prepositions and adverbs. It also neglects mass nouns. It would also not properly encapsulate gerund infinitive, absolute or participial phrase.

    I'm going to suggest just going with the assignment's definition. They appear the be applying simplified, or romantic declensional composition rules to English. We won't be able to help much with that.
  • 0
    @mr-user
    For ref, this is an example of what actual English composition diagramming looks like:
    http://grammar.ccc.commnet.edu/gram...
  • 0
    @SortOfTested To be honest with you I don't really understand what you are saying. I only get that the diagram what I am used to is just a simplified version and not really used by English speaker.

    I learn that there are new kind of diagram which I am going to study how it work when I have time.

    For your information I am using "Nltk" framework and it is the diagram used in the framework.

    https://www.nltk.org/book/ch08.html

    Thank you for trying to help me. I will keep you updated if what the diagram is actually called and how it actually work (if you are interested)
  • 0
    @SortOfTested

    You can find the diagram in my screenshot by searching for "grammar tree" in google image search.
  • 0
    @mr-user where did you get that sentence from? The only way it makes any sense is if the speaker is standing directly in front of the door as he describes the event that took place.
  • 0
    @M1sf3t

    I know that the sentence is weird. Especially the word "here" at the end.

    We are given 10 example sentence to test with. My rule somehow work for the 9 example.

    Here are the example sentences given. Maybe some of them are trick sentence but I sure can't distinguish them.

    1) "Holmes sat."

    2) "Holmes lit a pipe."

    3) "We arrived the day before Thursday."

    4) "Holmes sat in the red armchair and he chuckled."

    5) "My companion smiled an enigmatical smile. "

    6) "Holmes chuckled to himself."

    7) "She never said a word until we were at the door here."

    8) "Holmes sat down and lit his pipe."

    9) "I had a country walk on Thursday and came home in a dreadful mess."

    10) "I had a little moist red paint in the palm of my hand."
  • 0
    So they pulled it from a sherlock holmes novel? That certainly clears things up a bit.
  • 0
    "Until" should be considered a conjunction in this case, not a preposition.
  • 0
    @M1sf3t And like holmes we are suppose find the clue.I am just glad that there is no Old English word such as "thou" in it.

    I just find my text book from years ago which explain the diagram. I am reminded about my angry that want to burn it because it make no sense.
  • 0
    How did I pass that subject anyway? Oh I remember, because I just draw out those diagram when the exam "just" started on exam paper and forget the moment I walk out off the classroom.
  • 0
    @mr-user I wouldn't be too heart broken about it. If this is the shit they use to teach y'all basic english then they're cramming a good 4, maybe even more, years worth of concepts into one course.

    To be able to break that sentence down out of context you have to have an understanding of pov, speaker and a whole lot of other things I have looong forgotten the names of 🙄
  • 0
    @M1sf3t

    It is one of the subject which is required to take so I am not heartbroken about it.

    I am doing the online AI course and in the NLP part, I am required to use that knowledge.

    I just scribble down the rule that I remember and hope for the best. It work well for other 9 sentence and only in the sentence number 7 I am stuck.

    I can't seem to remember how to compose "we [N] were [V] at [P] the [Det] door [N] here [Adv]." into a rule
  • 0
    @mr-user door is the object of the prepositional phrase started with "at".
  • 0
    you could rephrase the sentence,

    she never said a word until we were here at the door. That's probably how a lot of people would phrase it.
  • 0
    @M1sf3t

    That also how I would say it. I almost forget there is a description. I guess it just wanted me to create a parser based on a rule and don't care much about making sense.

    "

    It’s to be expected that your parser may generate some sentences that you believe are not syntactically or semantically well-formed. You need not worry, therefore, if your parser allows for parsing meaningless sentences like "His Thursday chuckled in a paint."

    "
  • 0
    @mr-user it's correct either way, it's just harder to break down out of context. I don't think you can have an adverb within you prepositional phrase and I think they can have only one object....( idk maybe you can have two with a conjunction 🤔) so when you get to a preposition, there's a list, require the parser to complete the phrase and move on to interpreting whether the next few are adverbs or prepositions.
  • 0
    @M1sf3t

    My strategy is I thought I will look at "we were at the door here" in isolation. If I can combine that group into a NP somehow it will work. As far as I know preposition pharse can only be make up by preposition and noun phrase. So if I can somehow tranform it into noun phrase it will work.
  • 0
    @mr-user a preposition is one of a specific list of words. Any time you come across one then your going to have the object that it refers to behind it. The object is the noun, not the preposition, I don't know what that would be called in the model your using. We considered prepositional phrases completely independent of what your referring to as a noun phrase.
  • 0
    @M1sf3t

    You are right in that there is something behind preposition.

    I call that preposition + x to be preposition phrase. I am trying to find that x. I am assuming thar x to be a noun phrase but it could be anything.

    Look at my screenshot at the start of my question. I think it will make it more clearly than my explaination 😅
  • 0
    @mr-user the screenshot is the only thing I've made any sense of from your original question. Your looking for the word door to complete you prepositional phrase. That's the noun. I can't remember if you can adjectives in between or not but you don't in this case, just the article/determiner.

    From there your prepositional phrase is complete and you need to determine if the next word is another preposition or an adverb for the verb that has already been given. That's why i said this is such a complicated example, not only is it two joined sentences but your verb phrase in the second is broken up by the prepositional phrase.
  • 0
    @M1sf3t

    I should probably mention to you that it is ok to give multiple solution.

    The thing is I am only given a sentence as an input. I can break it down in however I want. The image on my screenshot is based on the current rule I have written. (which work on 9 other sentences)
  • 0
    @mr-user i get that, i was telling you how to think about it in order to fix your rule. It's not going to work by just assuming the next word after the verb is it's adverb. Look up the list of prepositions and fit that into your algorithm. If your parser comes across one when its looking to complete a verb phrase then it needs to put that on pause and complete the prepositional phrase, then go back to completing the verb phrase.
  • 1
    @M1sf3t

    I get what you mean. I am going to sleep on it to see what idea I got when I am awake.
  • 0
    @M1sf3t

    I solve the problem by adding the rule before

    VP -> V PP Adv

    S -> S P S

    So basically I make the word "until" as a conjunction to join two sentence together.

    The sentence "we were at the door here" is considered to be a whole sentence while "were at the door here" consider to be verb phrase

    Sentence = Noun phrase + Verb phrase

    Verb phrase = Verb + Preposition phrase + Adverb

    I make

    we = noun phrase

    were = Verb

    at the door = Preposition phrase

    here = Adverb
  • 0
    @mr-user so your prepositional phrase is part of your verb phrase? Seems odd but if that's the way yall are doing it. At least you figured something out
  • 0
    @M1sf3t

    how would it be weird?

    I am interested in how other people think.
  • 0
    @mr-user weird as in I don't remember them being considered a part of the verb. But like I said it's been a while and I don't remember the specifics. Whether it is or isn't though, your rule will run into a problem if it requires a verb before it begins to look for the preposition. Another odd, considered somewhat advanced sentence structure, is when your prepositional phrase comes at the beginning of the sentence. In this case there won't be a verb til later.

    Something like "around the bend, she paddled her boat."

    "around the bend" is a prepositional phrase and it does provide context for the verb "paddled" but as you see the sentence is completely flipped around.

    It's not all that common, same as the other one from sherlock holmes, but you still come across people that will arrange their sentences this way, mostly for what would be considered "metre" in poetry, I can't remember what it's called in prose.
  • 0
    @M1sf3t

    I also notice some weird sentence structure which may fail. I encoded the rule in that verb phrase can be in this combination or other combination so I think it will rule it out.

    The grammar are also fuzzy to me. I flip back my text box from years ago which I luckily found describing the grammar tree structure.

    What I did is that I encode every rule from the textbox into the rule.

    I appreciate you thanking your time to help me think through the problem. You have given me some insight which I also encoded into the rule.
  • 0
    @mr-user no problem, I've always been curious as to how you guys always seem to misunderstand the same things when you learn english, it's become a little clearer now.

    They really shouldn't be using classic literature for example sentences unless you have a firm grasp of the basic grammar structure for actual spoken english. They might as well be teaching you with lines picked from a sonnet.
  • 0
    @M1sf3t

    To clarify I wasn't asking for a English class. I was taking a online course on AI the Natural Language Processing (NLP) project ask to parse the sentence according to their sentence tree.

    To be honest with you my country education is too overate (although they are changing the whole education system by the new elected government but it will take time) From what I heard the new system reduce class time and become more group-oriented instead of exam focus.

    Currently you don't learn anything from the education system. The curriculum are advances but teacher water down the essence.By advances I mean the curriculum which is taught in grade 10 and now taught in grade 8.Therefore the students don't learn anything about why and how we do it in certain way since they are too advance for the student. The sad thing is a degree from a national university don't have any worth but a lot of job still requires a some kind of degree.
  • 0
    @mr-user i get that, it just made me consider at what point we study this stuff. I know a family that moved here from bangladesh just before the kids made it to high school. The oldest told me one time that when they first got arrived he didn't speak as well, but for as long as I've known them, you couldn't tell him or the sister didn't grow up here.

    dad and mom are a different story. Mom's excuse is not interacting with ppl, but the dad teaches at the uni and for the most part speaks perfectly correct english, its just not always phrased in a common fashion and you can still somewhat tell it's not his native language, even now probably 20 years later. And thats pretty common no matter what the country of origin is.

    Some of it has to do with other languages not having to use as many words to convey the same meaning, but it would also seem that they're being exposed to complex sentence structures like this before they realize its not actually common to speak in this fashion
  • 0
    @M1sf3t

    My native word use more word to express the same idea compare to English.That why I think my sentence are longer compare to other native speaker.

    In my native language there is no concept of tense.I mean we don't use the word "go" , "went" , "gone" based on the concept of time, there is a just a single word "go". We use what I like to called time indicator word to acknowledge time.

    If we find a certain word (usually at the end of the sentence) we know it is talking about the past/future depending on the word. Another way to acknowledge time in my language is to used "date" just like in English. By looking at the date we know whether it is in current,past or future.

    The natural form of order is my native language is object + verb + subject instead of subject+verb+object (like English) so the translator do the translation in reverse order.
  • 0
    @mr-user interesting, seems like its usually the opposite, but then again I did most of my foreign language studies on the romantic ones. Any case it's never a one for one translation.

    In english it's usually subject, verb, object. But like I was saying earlier, occasionally someone will throw the object in at the beginning. As long as the punctuation is correct and the phrase isn't interrupted by another part of speech then the structure is perfectly valid, it's just that you only commonly find it structured like that in books where the author was creatively trying not to lull the reader into sleep.

    But general everyday speech is usually going to be as you said, subject verb object. Your also not usually going to find people breaking up your "verb phrase" with the object but like you see with the sherlock holmes excerpts, occasionally someone does.
  • 0
    @M1sf3t

    There is an expression I like "Common sense is not common" I think the lecturer give those sentence to make us think for all possible case including uncommon one.
  • 0
    @mr-user well yea, it's just if you cram in all there at once. kids in the us screw up these types of sentences and they've had a good few years if just the other 8 examples. thats one reason you don't find so much in everyday conversation, most at least know when they're fucking the sentence up so they stick to the way they do know how to express it.
  • 0
    @M1sf3t

    Yeah you are right people stick to whatever it is easier for them.Maybe it is also one of the way language evolve except from adding new idea to it.

    Decades from now people will look at the sentence we use now and said "It's uncommon to see those sentence used these way."
Add Comment