Method, apparatus, device and storage medium for outputting information
AssigneeBeijing Baidu Netcom Science Technology Co., Ltd.
InventorsMengzhao Li, Jun Zhang
Life of this patent
Estimating the term…
Abstract
A method, an apparatus, a device and a storage medium for outputting information are provided. The method includes: acquiring a to-be-translated sentence; determining a foreign language sentence matching the to-be-translated sentence from a preset set of sentence pairs, where the set of sentence pairs includes local language sentences and corresponding foreign language sentences; determining a target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence; and outputting the target foreign language sentence.
Claims17
A method for outputting information, the method comprising:
- acquiring a to-be-translated sentence;
- determining a foreign language sentence matching the to-be-translated sentence from a preset set of sentence pairs, wherein the set of sentence pairs comprises local language sentences and corresponding foreign language sentences, wherein the determining the foreign language sentence matching the to-be-translated sentence from the preset set of sentence pairs, comprises
- determining a first variable and a first local language word in the to-be-translated sentence comprising the first variable,
- determining second variables and second local language words in the local language sentences of the set of sentence pairs,
- determining a local language sentence matching the to-be-translated sentence from the set of sentence pairs according to the first variable, the first local language word, the second variables and the second local language words, and
- using a foreign language sentence corresponding to the determined local language sentence as the foreign language sentence matching the to-be-translated sentence;
- determining a target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, wherein the determining the target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, includes replacing a second variable in the matched foreign language sentence with the first variable to obtain the target foreign language sentence comprising the first variable;
- and
- outputting the target foreign language sentence.
An electronic device for outputting information, the electronic device comprising:
- at least one processor;
- and
- a memory communicating with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions, when executed by the at least one processor, cause the at least one processor to perform operations comprising:
- acquiring a to-be-translated sentence;
- determining a foreign language sentence matching the to-be-translated sentence from a preset set of sentence pairs, wherein the set of sentence pairs comprises local language sentences and corresponding foreign language sentences, wherein the determining the foreign language sentence matching the to-be-translated sentence from the preset set of sentence pairs, comprises
- determining a first variable and a first local language word in the to-be-translated sentence comprising the first variable,
- determining second variables and second local language words in the local language sentences of the set of sentence pairs,
- determining a local language sentence matching the to-be-translated sentence from the set of sentence pairs according to the first variable, the first local language word, the second variables and the second local language words, and
- using a foreign language sentence corresponding to the determined local language sentence as the foreign language sentence matching the to-be-translated sentence;
- determining a target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, wherein the determining the target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, includes replacing a second variable in the matched foreign language sentence with the first variable to obtain the target foreign language sentence comprising the first variable;
- and
- outputting the target foreign language sentence.
A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform operations comprising:
- acquiring a to-be-translated sentence;
- determining a foreign language sentence matching the to-be-translated sentence from a preset set of sentence pairs, wherein the set of sentence pairs comprises local language sentences and corresponding foreign language sentences, wherein the determining the foreign language sentence matching the to-be-translated sentence from the preset set of sentence pairs, comprises
- determining a first variable and a first local language word in the to-be-translated sentence comprising the first variable,
- determining second variables and second local language words in the local language sentences of the set of sentence pairs,
- determining a local language sentence matching the to-be-translated sentence from the set of sentence pairs according to the first variable, the first local language word, the second variables and the second local language words, and
- using a foreign language sentence corresponding to the determined local language sentence as the foreign language sentence matching the to-be-translated sentence;
- determining a target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, wherein the determining the target foreign language sentence of the to-be-translated sentence according to the to-be-translated sentence and the determined foreign language sentence, includes replacing a second variable in the matched foreign language sentence with the first variable to obtain the target foreign language sentence comprising the first variable;
- and
- outputting the target foreign language sentence.
The method according to 1, wherein the first variable is a parameter in a computer programming program.
Dependencies are inferred from the claim text.