Briefly discuss about the Formal language and Grammars concept in the context to NLP.
Answers
Answer:
A formal grammar is essentially a set of production rules that describe all possible strings in a given formal language. Production rules are simple replacements. For example, the first rule in the picture,
{\displaystyle \langle {\text{Stmt}}\rangle \to \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;}{\displaystyle \langle {\text{Stmt}}\rangle \to \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;}
replaces {\displaystyle \langle {\text{Stmt}}\rangle }{\displaystyle \langle {\text{Stmt}}\rangle } with {\displaystyle \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;}{\displaystyle \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;}. There can be multiple replacement rules for a given nonterminal symbol. The language generated by a grammar is the set of all strings of terminal symbols that can be derived, by repeated rule applications, from some particular nonterminal symbol ("start symbol"). Nonterminal symbols are used during the derivation process, but may not appear in its final result string.
Explanation: