120 likes | 287 Views
CSNB143 – Discrete Structure. Topic 11 – Language. Topic 11 – Language. Learning Outcomes Student should identify the basic components in language Students should be able to produce phrase structure grammar. Topic 11 – Language. Understanding Language
E N D
CSNB143 – Discrete Structure Topic 11 – Language
Topic 11 – Language Learning Outcomes • Student should identify the basic components in language • Students should be able to produce phrase structure grammar
Topic 11 – Language Understanding Language • If set W = {all characters from a, b, c, …….., z, A, B, C, ……., Z}, then set W* = {all words that can be formed from W} = {aabb, bus, lamp, pqrs, ….}, either it has any meaning or not. • Let say set S = {all possible words} = W*, then Then set S* = {all possible sentences that can be formed from S} = {I like to play, the dog is running, aabb shine pqrst, ….}, either it has any meaning or not. • Then we can say that language consists of three basic things, that are: • S; a set of all possible words, • S*; a set of properly constructed sentences, (this is what we called as syntax, that differentiate between a properly constructed sentence and not a properly constructed sentence.) • The meaning of the sentences (referred to as semantic)
Topic 11 – Language Understanding Language • Example 1 : Consider the two sentences below: Going to the store John George to sing. This sentence is a valid sentence in S*, but it doesn’t constructed properly. The order of noun and verb is not valid. Noiseless blue sounds sit cross-legged under the mountaintop. This sentence is correct in structure, but it doesn’t have any meaning.
Topic 11 – Language Understanding Language • The need to identify syntax has expanding the formal language, to a new set of rules, we determine that: • Sentence must be built from noun phrase and verb phrase. • Noun phrase must be built from an article and adjective, followed by noun. • Noun phrase must be built from an article and noun. • Verb phrase must be built from verb and adverb. • Verb phrase must be built from verb. • Article is either a or the • Adjective is either large or hungry • Noun is either rabbit or doctor • Verb is either eats or hops • Adverb is either quickly or wildly
Topic 11 – Language Understanding Language • Can make sentence using the order of valid replacement • Other sentences are: • a hungry doctor eats wildly • a large doctor hops wildly • the hungry rabbit eats quickly, .....and so on.
Topic 11 – Language Phrase Structure Grammar • Syntax being used to produce valid sentences with meaning • Referred to as G, that consists of four elements: • V; a finite set of elements, consists of S together with some other symbols • S; a subset of V that consists of terminal symbols, S is a set of all allowed words in a language. • v0; where v0 V – S, it is the element v0 of V is the starting point for substitution • a finite relation on V*. The relation on V* specifies allowable replacements, e.g if w w’, we may replace w with w’ whenever string w occurs, either alone or as combination with other string. We call the production relation. • Phase Structure Grammar is written as G = (V, S, v0, ) • Traditionally, the statement w w’ called a production of G. • w and w’ are termed the left and right sides of the production.
Topic 11 – Language Phrase Structure Grammar • Example: G = (V, S, v0, ) Let S = {John, Jill, drives, jogs, carelessly, rapidly, frequently}; N = {sentence, noun, verbphrase, verb, adverb} and V = S N. Let v0 = sentence (starting point of substitution) and relation on V* (all possible sentence that can be formed from the words) are defined as: • Noun John • Noun Jill • Verbphrase verb + adverb • Verb drives • Verb jogs • Adverb carelessly • Adverb rapidly • Adverb frequently
Topic 11 – Language Phrase Structure Grammar • Answer: Then we can have few sentences that syntactically correct, for example:
Topic 11 – Language Phrase Structure Grammar - the language of G, L(G) • In phrase structure grammars G, correct syntax simply refers to the process by which a sentence is formed. • A set of all properly constructed sentences that can be produced using a grammar G is called the language of G, denoted by L (G)
Topic 11 – Language The language of G, L(G) • Example: Let V = {v0, w, a, b, c}; S = {a, b, c} and is relations on V* given by : (1) v0 aw (2) w bbw (3) w c Derive a proper L(G) (can use substitution approach and derivation tree approach)
Topic 11 – Language The language of G, L(G) Answer: Let V = {v0, w, a, b, c}; S = {a, b, c} and is relations on V* given by : (1) v0 aw (2) w bbw (3) w c Derive a proper L(G). • To derive the language of L(G), necessary to perform successive substitution, until all symbols are eliminated other than the terminal symbols (in this case a,b,c). Since v0 is the substitution starting point, we will usually start with production (1), v0 aw. • Result after trying both substitution and tree derivation approach, the L(G) obtained will be a(bb)nc