Method for specifying equivalence of language grammars and automatically translating sentences in one language to sentences in another language in a computer environment
First Claim
1. A method of automatic translation of sentences from a source language Ls selected from language L1 to Ln to a target language Lt selected from languages L1 to Ln comprising the steps of:
- (i) providing grammars G1 to Gn of all the languages L1 to Ln respectively and a text ‘
S’
in the source language Ls as inputs;
(ii) creating a unified grammar specification UG for the grammars G1 to Gn;
(iii) separating the input text ‘
S’
in the source language Ls into a list of tokens using a lexical analyser for the source language Ls;
(iv) setting a non-terminal symbol ‘
E’
to the start symbol of the unified grammar specification UG;
. (v) obtaining a set of grammar production rules Pe which define the rules to reduce a string of terminal symbols and/or non-terminal symbols to the target non-terminal symbol E from the unified grammar specification UG;
(vi) for each unified grammar production rule P in the set of grammar production rules Pe taking each symbol one by one from a list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs, determining whether it is a terminal symbol or a non-terminal symbol;
(vii) for each terminal symbol obtained from the previous step, which is equivalent to a corresponding symbol in the list of tokens T of the input text in the source language Ls, considering the next symbol in said list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs and for each non-terminal symbol obtained from the previous step which refers to another non-terminal symbol Es, of the unified grammar specification UG, repeating step (v) onwards with the new non-terminal symbol Es;
(viii) if all the symbols in the said list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs match with all the symbols in the list of tokens T of the input text in the source language Ls, obtaining a list of symbols t corresponding to the target language grammar Gt from the unified grammar production rule P and for those symbols which do not match, repeating step (vi) onwards for the next unified grammar production rule P defined for the non-terminal symbol ‘
E’
;
(ix) taking each symbol one by one, from the list of symbols t corresponding to the target grammar Gt and determining whether it is a terminal symbol or a non-terminal symbol;
(x) for each terminal symbol obtained from the previous step outputing the symbol, and considering the next symbol and for each non-terminal obtained from the previous step, obtaining another unified grammar production rule P corresponding to that non-terminal symbol and repeating the previous step with the new unified grammar production rule, till all the symbols in the list of symbols t corresponding to the target language grammar Gt are exhausted,
1 Assignment
0 Petitions
Accused Products
Abstract
A method for specifying equivalence of language grammars and automatically translating sentences in one language to sentences in another language in a computer environment. The method uses a unified grammar specification of grammars of different languages in a single unified representation of all the individual grammars where equivalent production rules of each of the grammars are merged into a single unified production rule. This method can be used to represent the equivalence of computer languages like high level language, assembly language and machine language and for translating sentences in any of these languages to another language.
-
Citations
2 Claims
-
1. A method of automatic translation of sentences from a source language Ls selected from language L1 to Ln to a target language Lt selected from languages L1 to Ln comprising the steps of:
-
(i) providing grammars G1 to Gn of all the languages L1 to Ln respectively and a text ‘
S’
in the source language Ls as inputs;
(ii) creating a unified grammar specification UG for the grammars G1 to Gn;
(iii) separating the input text ‘
S’
in the source language Ls into a list of tokens using a lexical analyser for the source language Ls;
(iv) setting a non-terminal symbol ‘
E’
to the start symbol of the unified grammar specification UG;
.(v) obtaining a set of grammar production rules Pe which define the rules to reduce a string of terminal symbols and/or non-terminal symbols to the target non-terminal symbol E from the unified grammar specification UG;
(vi) for each unified grammar production rule P in the set of grammar production rules Pe taking each symbol one by one from a list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs, determining whether it is a terminal symbol or a non-terminal symbol;
(vii) for each terminal symbol obtained from the previous step, which is equivalent to a corresponding symbol in the list of tokens T of the input text in the source language Ls, considering the next symbol in said list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs and for each non-terminal symbol obtained from the previous step which refers to another non-terminal symbol Es, of the unified grammar specification UG, repeating step (v) onwards with the new non-terminal symbol Es;
(viii) if all the symbols in the said list of terminal symbols and/or non-terminal symbols corresponding to the source language grammar Gs match with all the symbols in the list of tokens T of the input text in the source language Ls, obtaining a list of symbols t corresponding to the target language grammar Gt from the unified grammar production rule P and for those symbols which do not match, repeating step (vi) onwards for the next unified grammar production rule P defined for the non-terminal symbol ‘
E’
;
(ix) taking each symbol one by one, from the list of symbols t corresponding to the target grammar Gt and determining whether it is a terminal symbol or a non-terminal symbol;
(x) for each terminal symbol obtained from the previous step outputing the symbol, and considering the next symbol and for each non-terminal obtained from the previous step, obtaining another unified grammar production rule P corresponding to that non-terminal symbol and repeating the previous step with the new unified grammar production rule, till all the symbols in the list of symbols t corresponding to the target language grammar Gt are exhausted, - View Dependent Claims (2)
-
Specification