0
mr-user
4y

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
    @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.
  • 0
    @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
    @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
    @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
    @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
    @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
    @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
    @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
    @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
    @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
    @M1sf3t

    how would it be weird?

    I am interested in how other people think.
  • 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
    @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
    @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
    @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
    @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