CN116662583A - Text generation method, place retrieval method and related devices - Google Patents

Text generation method, place retrieval method and related devices Download PDF

Info

Publication number
CN116662583A
CN116662583A CN202310958611.6A CN202310958611A CN116662583A CN 116662583 A CN116662583 A CN 116662583A CN 202310958611 A CN202310958611 A CN 202310958611A CN 116662583 A CN116662583 A CN 116662583A
Authority
CN
China
Prior art keywords
text
retrieval
error
place
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310958611.6A
Other languages
Chinese (zh)
Other versions
CN116662583B (en
Inventor
季成晖
赵田阳
卢俊之
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310958611.6A priority Critical patent/CN116662583B/en
Publication of CN116662583A publication Critical patent/CN116662583A/en
Application granted granted Critical
Publication of CN116662583B publication Critical patent/CN116662583B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/38Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/387Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using geographical or spatial information, e.g. location
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a text generation method, a place retrieval method and a related device in the field of artificial intelligence, which can be applied to the field of maps. Acquiring a target place text in a text generation method; and generating an error text corresponding to the target place text according to the target place text by using the error text generation model. The error text generation model is trained on the basis of a map retrieval language model, and the map retrieval language model can learn the map semantic features of the map retrieval text. The error text output by the error text generation model also has map semantic features, and is more fit with a real map retrieval scene. The training correct text of the error text generation model is determined according to the standard place name stored in the geographic information system, and the training error text and the training correct text meet the preset difference condition, so that the situation that a real user is separated from a use scene is avoided. The application can improve the quality of the generated error text.

Description

Text generation method, place retrieval method and related devices
Technical Field
The application relates to the technical field of artificial intelligence, in particular to a text generation method, a place retrieval method and a related device.
Background
In a daily application, when a user searches for a place using a map application, it is necessary to input a search text for indicating the place to be searched for, and in some cases, the search text input by the user may have errors such as miscords, grammatical errors, and the like. If the background geographic information system (Geographic Information System, GIS) directly searches for a location based on the incorrect search text, it is often difficult to obtain an accurate search result, and the use experience of the user for the map application is affected.
In order to solve the above problems, a white list-based text correction technique has been developed that corrects an erroneous search text input by a user to a corresponding correct place name using a white list in which a correspondence between the correct place name and the erroneous text is recorded, and then performs a subsequent search operation accordingly.
However, the method for generating the error text corresponding to the correct place name in the related art generally cannot guarantee the quality of the generated error text, and the generated error text is difficult to be attached to the error search text actually input by the user, which further affects the effective utilization rate of the whitelist and affects the error correction effect on the error search text.
Disclosure of Invention
The embodiment of the application provides a text generation method, a place retrieval method and a related device, which can improve the quality of generated error texts, further improve the effective utilization rate of a white list and improve the error correction effect on the error texts.
The first aspect of the present application provides a text generation method, which includes:
acquiring a target place text; the target place text is a standard place name stored in a geographic information system;
generating an error text corresponding to the target place text according to the target place text by an error text generation model;
the error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored in the geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
The second aspect of the present application provides a location retrieval method, the method comprising:
acquiring a place retrieval text;
when the place retrieval text is detected to be matched with the target error text in the white list, correcting the place retrieval text by utilizing the target correct place text corresponding to the target error text recorded in the white list, and obtaining corrected place retrieval text; the white list records a plurality of groups of corresponding relations between correct place texts and error texts, and the error texts corresponding to the correct place texts are generated by the text generation method in the first aspect;
and performing location retrieval based on the corrected location retrieval text.
A third aspect of the present application provides a text generating apparatus, the apparatus comprising:
the first acquisition module is used for acquiring the text of the target place; the target place text is a standard place name stored in a geographic information system;
the generation module is used for generating a model through the error text, and generating the error text corresponding to the target place text according to the target place text;
the error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored in the geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
A fourth aspect of the present application provides a location retrieval device, the device comprising:
the second acquisition module is used for acquiring the place retrieval text;
the correction module is used for correcting the place retrieval text by utilizing the target correct place text corresponding to the target error text recorded by the white list when the place retrieval text is detected to be matched with the target error text in the white list, so as to obtain corrected place retrieval text; the white list records a plurality of groups of corresponding relations between correct place texts and error texts, and the error texts corresponding to the correct place texts are generated by the text generation method in the first aspect;
and the retrieval module is used for retrieving the location based on the corrected location retrieval text.
A fifth aspect of the application provides a computer apparatus comprising a processor and a memory:
the memory is used for storing a computer program;
the processor is configured to execute the steps of the text generation method according to the first aspect or the steps of the location retrieval method according to the second aspect according to the computer program.
A sixth aspect of the present application provides a computer-readable storage medium storing a computer program for executing the steps of the text generation method described in the first aspect or the steps of the location retrieval method described in the second aspect.
A seventh aspect of the application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of the text generation method described in the first aspect or performs the steps of the location retrieval method described in the second aspect.
From the above technical solutions, the embodiment of the present application has the following advantages:
in the embodiment of the application, the target place text, namely, the standard place name stored by the geographic information system is firstly obtained; and generating a model through the trained error text, and generating an error text corresponding to the target place text according to the obtained target place text. The error text generation model is trained on the basis of a map retrieval language model, the map retrieval language model is trained on the basis of the map retrieval text, and the map retrieval language model can learn map semantic features of the map retrieval text. On the basis, the error text output by the error text generation model also has map semantic features, and is more fit with a real map retrieval scene. Meanwhile, training samples of the error text generation model comprise training correct texts and training error texts with corresponding relations. The training correct text is determined according to the standard place name stored in the geographic information system, a preset difference condition is met between the training incorrect text and the training correct text, the preset difference condition is set to avoid overlarge difference between the training incorrect text and the training correct text, and the training incorrect text is separated from a real user use scene. The application can improve the quality of the generated error text.
In practical applications, the text of the target location (correct text) and the corresponding error text thereof can form text pairs to be put into a white list for correcting the error text possibly input by the user in the map retrieval scene into the corresponding correct text. The error text generated by the embodiment of the application not only has the expression characteristics in the real map retrieval scene, but also is more fit with the retrieval text input by the user in the real map retrieval scene, so that the quality of the error text is improved, the effective utilization rate of the white list can be improved, and the error correction effect on the error text is further improved.
Drawings
Fig. 1 is a scene structure diagram of a text generating method according to an embodiment of the present application;
FIG. 2 is a flowchart of a text generation method according to an embodiment of the present application;
fig. 3 is a schematic view of a scene of a map application used by a user according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a scene of OCR based on a white list according to an embodiment of the present application;
fig. 5 is a schematic diagram of a white list mining process according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a map retrieval language model according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a training process of a map retrieval language model according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a model structure of an error text generation model according to an embodiment of the present application;
FIG. 9 is a block diagram of error correction in the map retrieval field according to an embodiment of the present application;
FIG. 10a is a flowchart of a location retrieval method according to an embodiment of the present application;
fig. 10b is a schematic structural diagram of a text generating device according to an embodiment of the present application;
fig. 10c is a schematic structural diagram of a location retrieval device according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In order to make the present application better understood by those skilled in the art, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Several terms which may be involved in the following embodiments of the present application will be explained first.
Geographic information system (Geographic Information System, GIS): is a computer system for collecting, storing, managing, processing, retrieving, analyzing and expressing geospatial data, and is a system for analyzing and processing massive amounts of geographic data.
Standard place names, also called points of interest (point of interest, poi): is a landmark or scenic spot in a geographic information system, and is used for marking departments represented by the place, commercial institutions (gas stations, department stores, supermarkets, restaurants, hotels, convenience stores, hospitals and the like) of various industries, tourist attractions (parks, public toilets), ancient points of interest, transportation facilities (various stations, parking lots, overspeed cameras, speed limit marks) and the like.
BERT model (Bidirectional Encoder Representations from Transformers): a model obtained by a language model training method using massive texts is composed of a multi-layer and multi-head transducer structure. Is widely used for various natural language processing tasks such as text classification, text matching, machine reading understanding and the like.
Model parameters: is a quantity that uses common variables to establish relationships between functions and variables. In artificial neural networks, the model parameters are typically real matrices.
ALBERT model: is a lightweight variant of the BERT model. On the premise of keeping BERT performance, the parameter quantity is obviously reduced, and the training speed is faster.
In the related art, a confusion set dictionary is generally utilized to replace one or more text units of correct text in an existing white list, so as to construct an error text. The corresponding relation of the words which are easy to be misplaced such as homophones, near phones, shape and near phones is stored in the confusion set dictionary. Specifically, for any correct text entered, the above-mentioned method randomly selects a replacement location and a type of error prone word to be replaced, and replaces one or more text units in the correct text with corresponding error prone words, thereby obtaining an error text corresponding to the correct text.
For example, for the correct text "a bank", if the text unit "silver" is selected to be replaced, the error prone word type is first determined from the confusion set dictionary. Table 1 exemplarily shows the confusion set of "silver". In combination with the table 1, homonym substitution for "silver" may be chosen, resulting in erroneous text "line a boundary". Then < a bank, line a boundary > may be placed in the white list, and when the user inputs text "a boundary line" in the map application, the error text "a boundary line" may be corrected to the correct text "a bank" based on the white list, and the map application may display the map search result corresponding to the standard place name "a bank".
TABLE 1 confusion set for "silver
However, the method of generating text using a confusion set dictionary is too random to fit the wrong search text actually entered by the user. Taking the above "a bank" as an example, the text unit "silver" corresponds to a plurality of error prone words. The erroneous text corresponding to "a bank" generated based on the confusion set dictionary may be map retrieval text which the user hardly inputs in a real map retrieval scene. That is, there may be a large number of invalid error texts in the white list, which affects the effective utilization rate of the white list, and thus affects the error correction effect on the error retrieval text.
In view of the above problems, the present application provides a text generation method and related device, which aim to improve the quality of generated error text, thereby improving the effective utilization rate of a white list and improving the error correction effect on the error text. In the embodiment of the application, a target place text is acquired; the target place text is a standard place name stored in the geographic information system; generating an error text corresponding to the target place text according to the target place text by an error text generation model; the method comprises the steps that an error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored by a geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text. The error text generated by the method has the expression characteristics in the real map retrieval scene, is more fit with the retrieval text input by the user in the real map retrieval scene, can improve the effective utilization rate of the white list, and further improves the error correction effect on the error text.
The application provides a text generation method, and relates to the field of artificial intelligence. Artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use the knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions. The text generation method provided by the embodiment of the application mainly relates to a natural language processing technology and a machine learning large direction in an artificial intelligence software technology.
Natural language processing (Nature Language processing, NLP) is an important direction in the fields of computer science and artificial intelligence. It is studying various theories and methods that enable effective communication between a person and a computer in natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Thus, the research in this field will involve natural language, i.e. language that people use daily, so it has a close relationship with the research in linguistics. Natural language processing techniques typically include text processing, semantic understanding, machine translation, robotic questions and answers, knowledge graph techniques, and the like.
Machine Learning (ML) is a multi-domain interdisciplinary, involving multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is specially studied how a computer simulates or implements learning behavior of a human to acquire new knowledge or skills, and reorganizes existing knowledge structures to continuously improve own performance. Machine learning is the core of artificial intelligence, a fundamental approach to letting computers have intelligence, which is applied throughout various areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, confidence networks, reinforcement learning, transfer learning, induction learning, teaching learning, and the like.
Next, a specific description is given of an execution subject of the text generation method provided by the embodiment of the present application.
The execution subject of the text generation method provided by the embodiment of the application can be a terminal device or a server with data processing capability. As examples, the terminal device may specifically include, but is not limited to, a mobile phone, a desktop computer, a tablet computer, a notebook electric energy, a palm computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, an aircraft, and the like. The server may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers. In addition, the server may also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms. Referring specifically to fig. 1, fig. 1 illustrates an exemplary scene architecture diagram of a text generation method. The figure includes the above-described various forms of terminal devices and servers.
In addition, the text generation method provided by the embodiment of the application can also be cooperatively executed by the terminal equipment and the server. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein. In the embodiment of the present application, the implementation main body for executing the technical scheme of the present application is not limited.
In addition, the embodiment of the application can be applied to the map field. But also other traffic related fields, to which the application is not limited.
Next, a text generation method provided by the embodiment of the application is specifically introduced by using the terminal device as an execution main body.
Referring to fig. 2, the flowchart of a text generation method according to an embodiment of the present application is shown. The text generation method shown in fig. 2 includes the following steps:
s201: and acquiring the text of the target place.
When a user searches for a place using a map application, a situation may occur in which an input search text is erroneous. The map application can correct the wrong search text to the corresponding correct place name based on the own white list. And then, the map retrieval result corresponding to the correct place name is displayed to the user, so that the map retrieval requirement of the user is met. The white list typically includes a huge number of text pairs of < correct text, incorrect text >, the correct text in the text pair being the correct place name.
The text generation method provided by the embodiment of the application is used for generating the error text corresponding to the correct text so as to store the correct text and the error text composition text pair corresponding to the correct text into the white list. Thus, the target location text is the correct text, and can be the standard location name stored in the geographic information system. The contents stored in the geographic information system are all correct place names, so that the target place text can be ensured to be the correct place name, and the error correction effect of the white list on the error text is improved.
For example, the target location text may be a standard location name of commercial institutions of various industries such as "a bank", "B bank", "C supermarket" or "D hospital"; the target place text can also be the standard place names of traffic facilities such as a station, a parking lot b or an overspeed camera c; the target location may also be a standard location name for various historic sites. The application is not limited in this regard.
S202: and generating an error text corresponding to the target place text according to the target place text by using the error text generation model.
The training sample of the error text generation model comprises training correct texts and training error texts with corresponding relations, wherein the training correct texts are determined according to standard place names stored in a geographic information system, and preset difference conditions are met between the training error texts and the training correct texts. The preset difference condition can avoid the problem that the training error text is separated from a real map retrieval scene and the effective utilization rate of the white list is reduced due to the fact that the difference between the training error text and the training correct text is too large. Meanwhile, the error text generation model is also trained on the basis of a map retrieval language model, and the map retrieval language model is trained on the basis of the map retrieval text. The map search language model is used for determining corresponding map semantic features for the input map search text, that is, the error text generated by the error text generation model is also provided with the map semantic features, that is, context-dependent and more smooth.
After obtaining the error text corresponding to the target place text, the target place text and error text composition text pair < target place text, error text > may be stored in the white list. The subsequent map application can correct the text based on the white list, correct the error retrieval text (error text) input by the user into the corresponding correct place name (target place text), meet the map retrieval requirement of the user, and promote the use experience of the user on the map application.
As an example, if the user needs to search for the "target location text" in the map application, but the "error text" is input by mistake in the search box of the map application due to insufficient memory of the "target location text" or pinyin input error, the map application may correct the "error text" to the "target location text" based on the white list, that is, to the standard location name in the geographic information system. Therefore, the map application can display the correct search result to the user, and the map search requirement of the user is met.
Referring to table 2, table 2 exemplarily shows the types of erroneous text in the map retrieval scene. As shown in connection with Table 2, table 2 includes error sources, primary error types, secondary error types, and error examples corresponding to each secondary error type. As can be seen from the error example in table 2, different errors may occur in the map retrieval text input by the user in the real map retrieval scene. Taking the example of improper collocation of the second-level error types under the first-level error type knowledge errors, B is actually in B city, but the user may not be familiar with the attribution knowledge of B, and B is mistakenly attributed to a city, so that the situation of "a city B city" is input during searching.
Table 2 error types in map retrieval scenarios
In order to facilitate understanding, the application scenario of the text generation method provided by the embodiment of the present application is specifically described below in conjunction with an actual application scenario schematic diagram.
Referring to fig. 3, a schematic view of a scenario in which a user uses a map application is provided in an embodiment of the present application. As shown in connection with fig. 3, a map retrieval interface 310 including a map application and a retrieval result display interface 320. The user may enter "Ayinhang" in the search box of the map retrieval interface 310, which the map application corrects to "aBank" based on < aBank, ayinhang > in the white list, and displays the search schematic results of "aBank" and "aBank". After the user operation triggers the "search" control, the map application searches "a bank" in response to the user operation, and the map application enters the search result display interface 320 to display at least one search result of "a bank". The user may select a search result that triggers to meet the demand from among the plurality of search results displayed on the search result display interface 320 to obtain detailed map information.
In addition, the text generation method provided by the embodiment of the application can also be applied to scenes of optical character recognition (Optical Character Recognition, OCR). Referring to fig. 4, a schematic diagram of a scenario for performing OCR based on a whitelist according to an embodiment of the present application is shown. And 4, due to the fact that the distance of the shop signboards is far or the angle of the shot picture is not correct, the text in the shop signboards of the A hotels in the picture is mistakenly identified as the shop A, the shop A can be corrected based on the white list to obtain the hotel A, and the corrected text hotel A is displayed to a user.
The text generation method mentioned in the above embodiments is combined. The white list mining process may specifically refer to fig. 5, and fig. 5 is a schematic diagram of a white list mining process provided in an embodiment of the present application. As shown in connection with fig. 5, the whitelist mining process may specifically include a model training phase, a model testing phase, and a whitelist generation phase. The model training stage specifically comprises training of a map retrieval language model and training of an error text generation model.
Next, a specific description will be given of a training process of the map retrieval language model in the white list mining process.
It is understood that languages in different fields all have corresponding semantic knowledge. For example, in the field of map retrieval, a user enters the text "coffee", typically the geographic location of a "cafe" that needs to be retrieved; in other areas, however, a certain brand of coffee recommendation may be required, etc. In the field of natural language processing related to the embodiment of the application, a general pre-training model may be adopted for training when a task model is trained, so as to reduce the training difficulty of the task. The general pre-training model only has general semantic knowledge, but cannot learn the semantic knowledge in the map retrieval field in advance, that is, cannot reduce the training difficulty of the error text generation model.
To solve this problem, a pre-training model in the map search field, that is, a map search language model, may be trained in advance so as to have semantic knowledge in the map search field. In one possible embodiment of the present application, the map retrieval language model may be trained by the following steps 1-4:
step 1: and acquiring map retrieval text.
The map retrieval language model needs to have semantic knowledge in the map retrieval field, so that a map retrieval text in the map retrieval field is acquired first. Wherein, the map retrieval text can be a standard place name stored by a geographic information system; the map retrieval text may also be an input retrieval text included in an object retrieval log in the geographic information system; the map retrieval text may also be a standard place name stored by the geographic information system and an input retrieval text included in an object retrieval log in the geographic information system, i.e., the map retrieval text may include at least one of the two, which is not limited in this regard by the present application.
The object search log is a log in which search text input by the user is recorded. For example, an object retrieval log in a map application may include retrieval text that a user has entered within a search box of the map application; but also can include high frequency input search text which can be used by a user in the map search field, and the application is not limited to this. The standard location name refers to the correct location name stored in the map information system, including, but not limited to, road data, administrative names, bus subways, business landmarks, and the like. For example, the standard place name may be stored in a brand dictionary, an organization dictionary, a business district dictionary, and a scenic spot dictionary in the map information system, which is not limited by the present application.
Step 2: and carrying out shielding treatment on the map retrieval text by adopting a preset text shielding strategy to obtain a non-shielded text and a shielded text in the map retrieval text.
The text shielding strategy is used for shielding a part of specific texts in the map retrieval text, and the shielded map retrieval text comprises non-shielded texts and shielded texts. In the embodiment of the application, the preset text shielding strategy can comprise specific shielding positions of the map retrieval text, shielding marks used in shielding processing and the like.
For example, the occlusion mark used in the occlusion process may be "M", the specific occlusion position for the map retrieval text may be a random position, and the map retrieval text may be "a bank nearby". It should be emphasized that "a" refers to a bank name including at least one text unit, and when "a" is occluded, the number of occlusion marks added for "a" needs to be the number of text units of "a". In the following example, "A" includes only one text element, so only one occlusion mark needs to be added for "A" to occlude "A". If "a" is two text units, an occlusion flag is added for each text unit of "a".
After the shielding treatment is carried out on the 'nearby A bank' by adopting a preset text shielding strategy, the 'M near A bank M' of the shielded map retrieval text can be obtained, the shielded text is 'attached' and 'line', and the non-shielded text is 'near A bank'. The above specific occlusion positions of the map search text and occlusion marks used in the occlusion processing are only examples, and the present application is not limited thereto.
In one possible embodiment of the present application, the preset text occlusion policy may include at least one of a random occlusion policy, an entity level occlusion policy, and a phrase level occlusion policy. And at least one of the three preset text shielding strategies can be adopted to shield the map retrieval text, so that the non-shielded text and the shielded text in the map retrieval text are obtained.
The random shielding strategy is used for randomly selecting at least one text unit in the map retrieval text to shield. The text unit refers to any one character in the map retrieval text. Taking the map retrieval text "nearby a bank" as an example, the random occlusion policy refers to occlusion of at least one text unit randomly selected in "nearby a bank". For example, the random shielding strategy is adopted to perform shielding treatment on the 'nearby A bank', so that 'A bank attached with M', 'AM row attached with M', or 'M near MM bank' and the like can be obtained.
The entity level shielding strategy is used for selecting text units corresponding to the entities in the map retrieval text to shield. An entity refers to a word in text that has a particular meaning. For example, an entity may include a person name, place name, organization name, proper noun, and so forth. In the map retrieval field according to the present application, the entity may include a place name, an organization name, and the like, which is not limited in the present application. Taking the map retrieval text as an example, the "adjacent A bank" is the entity in the map retrieval text. Then the entity level shielding strategy is adopted to perform shielding treatment on the 'nearby A bank', so that the 'nearby MMM' can be obtained.
The phrase-level shielding strategy is used for selecting text units corresponding to at least one phrase in the map retrieval text to shield. Phrases, also known as phrases, are constituents of text. Taking the map retrieval text "nearby a bank" as an example, "nearby", "a" and "bank" are phrases. Then at least one phrase of "nearby a bank" can be masked by using the entity level masking policy, and "nearby AMM", "MM M bank" and so on can be obtained. Note that, the number of blocked phrases in the phrase-level blocking policy is not limited.
It is emphasized that, for the same map retrieval text, different preset text shielding strategies can be adopted to conduct shielding treatment respectively, so as to obtain a plurality of map retrieval texts after shielding treatment; and the same preset text shielding strategy can be adopted to carry out shielding treatment on the same map retrieval text for multiple times, so that a plurality of different map retrieval texts after shielding treatment are obtained. The application is not limited in this regard.
Therefore, at least one preset text shielding strategy is adopted to shield the map retrieval text, the map retrieval text comprising the non-shielded text and the shielded text is obtained, and is input into the map retrieval language model, so that the map retrieval language model can fully learn the semantic knowledge of the map retrieval text, and the output map retrieval text is context-dependent and smooth.
Step 3: and determining a predicted shielding text according to the non-shielding text in the map retrieval text through the map retrieval language model to be trained.
In the embodiment of the application, when the map retrieval language model is trained, the map retrieval text which is subjected to shielding processing is input into the map retrieval language model. The map retrieval language model predicts the blocked text in the map retrieval text to obtain a predicted blocked text. That is, the output of the map retrieval language model is the predicted occlusion text.
For example, the map retrieval language model to be trained may be a BERT model, an ALBERT model, etc., which the present application is not limited to. As an example, referring to fig. 6, the diagram is a schematic diagram of a model structure of a map retrieval language model according to an embodiment of the present application. As shown in connection with fig. 6, the map retrieval language model may be composed of two parts, an Encoder (Encoder) and a Decoder (Decoder). Both the encoder and decoder include a multi-layer transducer structure. Firstly, carrying out shielding treatment on a map retrieval text to obtain a non-shielded text and a shielded text in the map retrieval text; and inputting the map retrieval text after shielding treatment to an encoder for encoding to obtain encoding characteristics, and decoding the encoding characteristics by a decoder to obtain the predicted shielding text.
Step 4: constructing a first loss function according to the predicted shielding text and the shielded text in the map retrieval text; the map retrieval language model is trained based on the first loss function.
And constructing a first loss function of the map retrieval language model according to the predicted shielding text output by the map retrieval language model and the shielded text in the map retrieval text. And iteratively executing the training process until the preset training ending condition is met, so that the trained map retrieval language model can be obtained. For example, the preset training ending condition may be that the training frequency of the map retrieval language model reaches a preset frequency threshold; or the model performance of the map retrieval language model can reach the preset requirement, such as the difference between the predicted shielding text and the shielded text accords with the preset difference condition. The application is not limited in this regard.
As an example, referring to fig. 7, a schematic diagram of a training process of a map search language model according to an embodiment of the present application is shown. As shown in fig. 7, the "nearby a bank" of the input search text included in the object search log in the geographic information system is acquired first; shielding the 'nearby bank A' by adopting a preset text shielding strategy; taking a preset text shielding strategy as an example of a random shielding strategy. Shielding the 'nearby bank A' through a random shielding strategy to obtain 'M near MM rows'; and (3) inputting the ' M near MM lines ' into Map-ALBERT to be trained, so as to obtain the predicted shielding text ' attached ' A ' and ' silver '. And constructing a first loss function of Map-ALBERT according to the preset shading text attached with 'A' and 'silver' and the shading text attached with 'A' and 'silver'. And iteratively executing the training process until the preset training ending condition is met, so that the trained map retrieval language model can be obtained.
Therefore, the map retrieval language model converts the discrete map retrieval text into the distributed semantic representation feature with semantic knowledge of the map retrieval field, and the distributed semantic representation feature not only has dictionary features such as brands, institutions, business circles or scenic spots, but also has context semantic representation of the map retrieval field, so that the feature representation capability of the map retrieval language model is enhanced.
Next, a specific description will be given of a training process of the erroneous text generation model in the white list mining process.
In one possible embodiment of the present application, the error text generation model may be trained by the following steps 5-7:
step 5: according to the object retrieval log in the geographic information system, determining a training correct text and a training error text in a training sample;
in the embodiment of the application, the object retrieval log in the geographic information system refers to a log in which the retrieval text input by the user is recorded.
In the related art, the error text generation method mostly adopts a mode based on confusion set substitution. The confusion set mainly comprises homophones, near phones and near phones of different words. Taking the text of the target location as "road segment 1 charging" as an example, it is indicated that the user needs to search for a location in the map application where the vehicle charging can be performed in the road segment 1. The words of the text units "charge" and "electricity" in the "road section 1 charge" in the confusion set can be specifically shown in table 3, and table 3 is a confusion set of "charge" and "electricity" provided by the embodiment of the application. If the "charging" confusion set is adopted to replace the "charging of the road section 1", the "charging of the road section 1" error text "road section 1" or "charging of the road section 1" and the like can be obtained. However, the error text obtained by replacing the confusion set in the related art is very different from the error text possibly input by the user in the real map retrieval scene, and a result that the semantics of the error text is inconsistent with the semantics of the correct text may be generated. For example, the resulting error text "in guan village pet store" is a map search text that the user is unlikely to input in a real map search scene. In the related art, unreasonable text pairs such as < road section 1 favor store, road section 1 charge > are stored in the white list, and the quality of the wrong text is reduced, so that the effective utilization rate of the white list is reduced.
TABLE 3 confusion sets of "charge" and "electric
In order to solve the above-mentioned problem, it is necessary to strengthen the fit between the training sample of the erroneous text generation model and the real map retrieval scene where the user is located in the present application. Thus, in one possible embodiment of the present application, an object retrieval log in a geographic information system may include user input retrieval text and its corresponding standard locality name. The standard place name corresponding to the input search text is determined according to a place selection operation triggered based on the input search text. Wherein, the input search text refers to the place search text input by the user. The determining process of the standard place name corresponding to the input search text is as follows: triggering a search operation on the input search text by a user, and displaying at least one search result corresponding to the input search text; then, the user selects a target search result meeting the requirement and performs an operation of triggering the target search result; then, according to the location selection operation of the user on the target search result, the location name corresponding to the target search result can be determined as the standard location name corresponding to the input search text.
Accordingly, step 5 may specifically include the following steps 501-502:
Step 501: performing statistical processing based on an object retrieval log in a geographic information system, and determining a standard place name meeting a preset search condition as a reference standard place name; and determines an object retrieval log including the reference standard place name as a reference object retrieval log.
The preset search condition is a preset search condition. For example, the preset search condition may be the number of clicks of the standard location name, that is, the standard location name having the number of clicks greater than the preset number of clicks is the standard location name conforming to the preset search condition. The application does not limit the preset search condition. The reference object retrieval log is at least one object retrieval log stored in the geographic information system, i.e., the object retrieval log contains the reference object retrieval log.
Step 502: if the input search text included in the reference object search log contains an error text fragment, a training sample is constructed based on the input search text and the reference standard place name included in the reference object search log.
And the error text segment and the core text segment with the reference standard place name meet the preset segment difference condition. The error text segment is a text segment which is obtained by inputting the search text and is different from the standard place name, and the difference meets the preset segment difference condition. For example, the preset segment difference condition may be that the length of the error text segment is the same as the length of the core text segment of the reference standard place name, or the length difference value accords with the preset difference value. The preset segment difference condition may also mean that the pronunciation of the error text segment is the same as the pronunciation of the core text segment of the reference standard place name, or the pronunciation is similar. The preset segment difference condition may also be that the text similarity between the erroneous text segment and the core text segment of the reference standard place name meets the preset similarity condition. For example, the edit distance between the erroneous text segment and the core text segment referencing the standard place name is less than or equal to a preset distance threshold. Of course, other preset segment difference conditions are also possible, and do not affect the implementation of the embodiment of the present application.
Therefore, a training sample is constructed according to the input search text with the error text fragment in the object search log and the reference standard place name, the core text fragment with the error text fragment and the reference standard place name meets the preset fragment difference condition, the problem that the training correct text and the training error text in the training sample are too different and deviate from a real map search scene due to too large difference can be solved, the constructed training sample is more practical for users, and the high-quality error text is obtained.
It will be appreciated that standard site names for the same site in different regions may be different. For example, brand a has a brand name of 1 in region 1 and a brand name of 2 in region 2. When the user has a need to search for brand a in area 1, the standard location name corresponding to the brand name of brand a is name 1; when the user has a need to retrieve brand a in area 2, the standard location name to which the brand name of brand a corresponds is name 2. This means that, if the user needs to search for brand a in area 1 but inputs name 2 of brand a in search area 2 by mistake, the search result corresponding to brand a in area 1 may not be displayed. The map retrieval requirements of users cannot be met, and the map retrieval experience of the users is affected.
In order to solve the above problems, the embodiment of the present application fully considers the region information when constructing the training sample of the erroneous text generation model. In one possible embodiment of the present application, the step 502 may specifically include the following steps 5021 to 5022:
step 5021: and determining a training correct text in the training sample according to the reference standard place name and the regional information of the reference standard place name.
The area information may be town information, city information, etc., which is not limited in the present application.
Taking brand a in the above example as an example, reference standard location names, name 1 and name 2 corresponding to brand a may be determined first. And obtaining the area information of the name 1 as the area 1 and the area information of the name 2 as the area 2. If the training sample in the area 1 needs to be determined, the name 1 can be added into the training correct text; if a training sample in region 2 is to be determined, name 2 may be added to the training correct text.
Step 5022: and taking the input search text included in the reference object search log as training error text in the training sample.
And taking the input search text with the error text fragments in the reference object search log as training error text in the training sample.
Therefore, the region information corresponding to the reference standard place name is fully considered when the training sample is constructed, the corresponding errors of the training correct text and the training error text in the training sample are avoided, the training sample with more accurate corresponding relation between the training correct text and the training error text can be obtained, and the accuracy of the error text generation model is further improved.
In addition, it should be noted that, in the embodiment of the present application, the training samples may also be constructed according to the existing whitelist. The correct text of the Chinese pair < correct text, error text > in the white list is determined as training correct text, and the error text of the text pair < correct text, error text > is determined as training error text.
Step 6: generating a model through the error text to be trained, and determining a prediction error text according to the training correct text in the training sample; the erroneous text generation model is initialized based on model parameters of the map retrieval language model.
In the embodiment of the application, when the error text generation model is trained, the training correct text in the training sample is input into the error text generation model. The erroneous text generation model predicts the erroneous text to which the correct text is trained, i.e., the output of the erroneous text generation model is the predicted erroneous text.
It should be emphasized that, before training the error text generation model, the model parameters of the error text generation model need to be initialized by using the model parameters of the map search language model obtained in the above embodiment, and then the training sample is used to train the error text generation model.
Step 7: constructing a second loss function according to the prediction error text and the training error text in the training sample; based on the second penalty function, an erroneous text generation model is trained.
And constructing a second loss function of the error text generation model according to the predicted error text output by the error text generation model and the training correct text input into the error text generation model. And iteratively executing the training process until the preset training ending condition is met, so that the trained map retrieval language model can be obtained. For example, the preset training ending condition may be that the training frequency of the error text generation model reaches a preset frequency threshold; or the model performance of the error text generation model reaches the preset requirement, such as the difference between the prediction error text and the training error text is smaller. The application is not limited in this regard.
For example, the error text generation model to be trained may be a Sequence-to-Sequence model (Seq 2 Seq), which is not limited in this application. As an example, referring to fig. 8, the diagram is a schematic diagram of a model structure of an error text generation model according to an embodiment of the present application. As shown in connection with fig. 8, the error text generation model may be composed of an encoder and a decoder. Firstly, initializing model parameters of an error text generation model by using model parameters of a Map-search language model Map-ALBERT to obtain a Map-ALBERT Encoder and a Map-ALBERT Encoder; inputting the target place text to a Map-ALBERT Encoder for encoding to obtain encoding features, and decoding the encoding features by the Map-ALBERT Encoder to obtain an error text corresponding to the target place text.
Therefore, according to the object retrieval log in the geographic information system, the training correct text and the training error text in the training sample are determined, the obtained training sample is more fit with a real map retrieval scene, and the semantic accuracy of the training sample is improved. The error text generation model obtained through training can generate the error text which is not only fit with a real map retrieval scene, but also is context-dependent and smooth, namely the quality of the generated error text is improved. The generated error text and the corresponding target place text form a text pair to be stored in the white list, so that the effective utilization rate of the white list can be improved, and the error correction effect on the error text is improved.
It should be emphasized that the error text generation model obtained by training in the application can generate different error texts for the text of the same target site. That is, one target place text is input to the error text generation model to obtain a corresponding one error text, but the same target place text is input to the error text generation model a plurality of times to obtain different error texts corresponding to the target place text. Therefore, the embodiment of the application can generate a large number of error texts by utilizing limited target site texts, improves the text quantity of the error texts in the white list and the coverage rate of the error texts, can further improve the effective utilization rate of the white list and improves the error correction effect on the error texts.
It will be appreciated that the target site text may be a site text that includes redundant information. For example, the text of the target location is "nearby a bank", and the "nearby" in the text of the target location is redundant information. The target site text may be a site text that includes a large amount of redundant information, which is directly input into the erroneous text generation model at this time, which may reduce the accuracy of the generated erroneous text. Specifically, if both user 1 and user 2 need to search for "a bank", user 1 may input the search text "a bank nearby", user 2 may only input the search text "a bank", i.e., different users may input different search texts for the same location, but the core text pieces of the search texts are the same. Thus, in one possible embodiment of the present application, S202 may specifically include: firstly, mining a core text fragment in a target place text as a target core text; and then generating an error text corresponding to the target place text according to the target core text by an error text generation model.
Taking the target site text as an example of 'nearby A bank', the core text fragment of 'nearby A bank' can be mined to obtain a target core text 'A bank'; and then generating an error text corresponding to the target site text 'A bank' according to the target core text 'A bank' through an error text generation model.
Therefore, the core text segment of the target place text is mined to obtain the target core text, redundant information of the target place segment is removed, the quality of the error text generated aiming at the target core text is improved, the utilization rate is higher in the subsequent error correction, and the effective utilization rate of the white list can be further improved.
For further understanding of the application of the text generating method provided in the embodiment of the present application in the actual use scenario, a specific description will be made with reference to fig. 9. Fig. 9 is an overall frame diagram of error correction in the map retrieval field according to an embodiment of the present application. As shown in fig. 9, the map retrieval field error correction may include three parts, an online error correction module, an offline resource module, and a model training module. The online error correction module refers to the process after a user inputs an error retrieval text. The online error correction module queries the query according to the search text and the city information thereof input by the user, obtains a correct text corresponding to the error search text input by the user through three stages of query semantic understanding, candidate recall and candidate sorting, and displays a search result corresponding to the correct text so as to meet the map search requirement of the user. Where/what recognition in query semantic understanding refers to recognition of where or what the retrieved text entered by the user is.
As shown in FIG. 9, the offline resource module includes an index library, an error correction pair library, a dictionary library and a rule library. According to the embodiment of the application, the logs (object retrieval logs) in the library are mined through error correction, so that the map retrieval text of the map retrieval language model can be obtained, and a training sample of an error text generation model is constructed; the standard place names stored in the geographic information system, namely target place texts, can be obtained through error correction and poi alignment mining in the library; the map retrieval language model and the error text generation model can be obtained by the text generation method provided by the embodiment of the application through error correction on language model generation in the library. The correction is to dig sugs in the library to be suggested dig, and n-gram in the dictionary to be Chinese language model.
As shown in FIG. 9, the model training module includes a feature center, a multitasking learning model, a pre-training language model, and a generative model. The Map retrieval language model of the embodiment of the present application may be a Map-ALBERT model, a CMap-ALBERT model, an ALBERT model, a BERT model, a distullbert model (a lightweight variant model of the BERT model), or a pre-training language model ERNIE, which is not limited in this regard. The error text generation model may be a CMap-ALBERT Seq2Seq model obtained based on CMap-ALBERT model training, an ALBERT Seq2Seq model obtained based on ALBERT model training, or a Soft-maskidbert model obtained based on BERT model training, which is not limited in the present application.
In addition, the white list obtained by the embodiment of the application and the error correction experimental evaluation of the original white list in the related technology are evaluated. Compared with the original white list in the related technology, the white list obtained by the embodiment of the application has the error correction effect winning rate of 68 percent (the white list is successful in error correction and the original white list is failed in error correction), and the retrieval effect winning rate of 67 percent (the retrieval result after error correction of the white list comprises the place required by the user and the retrieval result after error correction of the original white list does not comprise the place required by the user); meanwhile, compared with the original white list in the related technology, the white list obtained by the embodiment of the application has the advantage that when the search results are generated for the user, the proportion of the search results with larger difference with the user demands in all the search results is reduced from 38.9% to 2.4%. In an OCR scene, compared with the original white list in the related technology, the white list obtained by the embodiment of the application has the advantage that the automatic hooking rate is improved by 10.28% on the premise that the hooking accuracy is unchanged. The hooking refers to a process of scanning the picture to identify and correct errors and displaying text in the picture. The hanging is divided into manual hanging and automatic hanging, and if the picture identification or text error correction is inaccurate, the manual hanging is needed, and the automatic hanging rate is improved by 10.28%, namely the accuracy of text error correction is improved.
In order to further understand the application scenario of the text generation method provided by the embodiment of the present application, next, the location retrieval method provided by the embodiment of the present application is specifically introduced by continuing to use the terminal device as an execution body.
Referring to fig. 10a, a flowchart of a location retrieval method according to an embodiment of the present application is shown. As shown in fig. 10a, the location retrieval method specifically includes:
s1001: the place retrieval text is obtained.
The location retrieval text is used for indicating the text corresponding to the location retrieval requirement of the user.
In the embodiment of the present application, there are a plurality of possible implementations of S1001 mentioned above, and the following description will be given separately. It should be noted that the implementations presented in the following description are only exemplary and not representative of all implementations of the embodiments of the present application.
The first alternative implementation of S1001 is: the terminal device acquires the text input by the user in the place retrieval input box as the place retrieval text. As an example, reference may be made specifically to the schematic view of a scenario in which the user uses a map application shown in fig. 3. If the user has a location retrieval requirement for retrieving the bank a, the text "Ayinhang" related to the bank a may be input in a search box displayed on the map retrieval interface 310 of the map application, and the terminal device may obtain the text "Ayinhang" and use the text "Ayinhang" as the location retrieval text.
The second alternative implementation of S1001 is: the terminal device acquires the place retrieval image, and then identifies the text included in the place retrieval image, and takes the text as the place retrieval text. As an example, if the user has a place retrieval requirement for retrieving the hotel a, the user may trigger a shooting control displayed on a map retrieval interface of the map application to shoot a sign of the hotel a, so that the terminal device obtains a place retrieval image, and then the terminal device identifies the place retrieval image, so as to obtain a text included in the place retrieval image, and the terminal device may use the identified text as a place retrieval text.
A third alternative implementation of S1001 is: the terminal equipment acquires the place retrieval voice, and then recognizes a text corresponding to the place retrieval voice, and takes the text as the place retrieval text. As an example, if the user also has a location retrieval requirement of retrieving bank a, the user may trigger a voice search control displayed on a map retrieval interface of the map application, and the terminal device may obtain a location retrieval voice sent by the user, and then identify the location retrieval voice to obtain a location retrieval voice text as the location retrieval text.
It should be noted that, for the above three alternative implementations, the terminal device may be implemented by selecting one or combining multiple implementations, which is not limited by the present application.
S1002: when the place retrieval text is detected to be matched with the target error text in the white list, correcting the place retrieval text by using the target correct place text corresponding to the target error text recorded in the white list, and obtaining corrected place retrieval text.
The white list records a plurality of groups of corresponding relations between the correct place texts and the error texts, and the error texts corresponding to the correct place texts are generated through the text generation method described in each embodiment.
As an example, among the plurality of sets of correspondence between the correct place text and the error text recorded in the white list, correspondence between the correct place text "a bank" and the error text "Ayinhang" is included. If the place retrieval text acquired by the terminal equipment is 'Ayinhang', the terminal equipment can detect that the place retrieval text is matched with the target error text 'Ayinhang' in the white list. The terminal device can correct the target correct place text "a bank" corresponding to the target error text "Ayinhang" recorded by the white list, and obtain the corrected place retrieval text "a bank".
S1003: and performing location retrieval based on the corrected location retrieval text.
Therefore, the error texts which can be effectively utilized in the white list comprising the corresponding relation between the plurality of groups of correct place texts and the error texts are increased, and the error correction effect on the error place retrieval texts can be improved. And searching based on the corrected place searching text, and obtaining a place searching result with higher accuracy, thereby meeting the place searching requirement of a user and improving the use experience of the user.
Based on the text generation method provided by the previous embodiment, the application also correspondingly provides a text generation device. The text generating device provided by the embodiment of the application is specifically described below.
Referring to fig. 10b, the structure of a text generating device according to an embodiment of the present application is shown. As shown in fig. 10b, the text generating apparatus specifically includes:
a first obtaining module 1010, configured to obtain a target location text; the target place text is a standard place name stored in the geographic information system;
a generating module 1020, configured to generate, according to the target location text, an error text corresponding to the target location text by using the error text generating model;
The method comprises the steps that an error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored by a geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
As one implementation, the map retrieval language model in the generation module 1020 may be specifically trained by:
the acquisition unit is used for acquiring the map retrieval text; the map retrieval text comprises at least one of standard place names stored by the geographic information system and input retrieval text contained in an object retrieval log in the geographic information system;
the shielding unit is used for shielding the map retrieval text by adopting a preset text shielding strategy to obtain a non-shielded text and a shielded text in the map retrieval text;
the first determining unit is used for determining a predicted shielding text according to the non-shielding text in the map retrieval text through the map retrieval language model to be trained;
The first training unit is used for constructing a first loss function according to the predicted shielding text and the shielded text in the map retrieval text; the map retrieval language model is trained based on the first loss function.
As an embodiment, the shielding unit may specifically be used for:
shielding the map retrieval text by adopting at least one of a random shielding strategy, an entity-level shielding strategy and a phrase-level shielding strategy;
the random shielding strategy is used for randomly selecting at least one text unit in the map retrieval text to shield; the entity-level shielding strategy is used for selecting text units corresponding to the entities in the map retrieval text to shield; the phrase-level shielding strategy is used for selecting text units corresponding to at least one phrase in the map retrieval text to shield.
As one implementation, the erroneous text generation model in generation module 1020 may be trained specifically by:
the second determining unit is used for determining a training correct text and a training error text in the training sample according to the object retrieval log in the geographic information system;
the third determining unit is used for generating a model through the error text to be trained and determining a prediction error text according to the training correct text in the training sample; the error text generation model is initialized based on model parameters of the map retrieval language model;
The second training unit is used for constructing a second loss function according to the prediction error text and the training error text in the training sample; based on the second penalty function, an erroneous text generation model is trained.
As an embodiment, the object retrieval log in the second determining unit may include an input retrieval text and a standard place name corresponding thereto, the standard place name corresponding to the input retrieval text being determined according to a place selection operation triggered based on the input retrieval text;
the second determining unit may specifically be configured to:
performing statistical processing based on an object retrieval log in a geographic information system, and determining a standard place name meeting a preset search condition as a reference standard place name; and determining an object retrieval log including the reference standard place name as a reference object retrieval log;
if the input search text included in the reference object search log contains an error text fragment, constructing a training sample based on the input search text and the reference standard place name included in the reference object search log; the error text segment and the core text segment with the reference standard place name meet the preset segment difference condition.
As an embodiment, the second determining unit may specifically be configured to:
determining a training correct text in a training sample according to the reference standard place name and the regional information of the reference standard place name;
and taking the input search text included in the reference object search log as training error text in the training sample.
As an embodiment, the generating module 1020 may specifically be configured to:
mining a core text segment in the target site text as a target core text;
and generating an error text corresponding to the target place text according to the target core text through an error text generation model.
Based on the location retrieval method provided by the foregoing embodiment, the present application further provides a location retrieval device accordingly. The location retrieval device provided by the embodiment of the application is specifically described below.
Referring to fig. 10c, the structure of a location retrieval device according to an embodiment of the present application is shown. As shown in fig. 10c, the location retrieval device specifically includes:
a second obtaining module 1030 configured to obtain location retrieval text;
the correction module 1040 is configured to correct the location retrieval text by using a target correct location text corresponding to the target error text recorded in the white list when it is detected that the location retrieval text matches with the target error text in the white list, so as to obtain a corrected location retrieval text; the white list records a plurality of groups of corresponding relations between the correct place texts and the error texts, and the error texts corresponding to the correct place texts are generated by the text generation method in each embodiment;
The retrieval module 1050 is used for performing location retrieval based on the corrected location retrieval text.
As an embodiment, the second obtaining module 1030 may specifically be used for at least one of the following:
acquiring a text input in a place retrieval input box as a place retrieval text;
acquiring a place retrieval image, and identifying texts included in the place retrieval image as place retrieval texts;
and acquiring the place retrieval voice, and identifying a text corresponding to the place retrieval voice as a place retrieval text.
The embodiment of the application also provides a computer device, which can be a terminal device or a server, and the terminal device and the server provided by the embodiment of the application are introduced from the aspect of hardware materialization.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 11, for convenience of explanation, only the portions related to the embodiments of the present application are shown, and specific technical details are not disclosed, please refer to the method portions of the embodiments of the present application. The terminal may be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (pda), a Point of Sales (POS), a vehicle-mounted computer, and the like, taking the terminal as an example of a computer:
Fig. 11 is a block diagram showing a part of the structure of a computer related to a terminal provided by an embodiment of the present application. Referring to fig. 11, a computer includes: radio Frequency (RF) circuitry 1210, memory 1220, input unit 1230 (including touch panel 1231 and other input devices 1232), display unit 1240 (including display panel 1241), sensors 1250, audio circuitry 1260 (which may connect speaker 1261 and microphone 1262), wireless fidelity (wireless fidelity, wiFi) module 1270, processor 1280, and power supply 1290. Those skilled in the art will appreciate that the computer architecture shown in fig. 11 is not limiting and that more or fewer components than shown may be included, or that certain components may be combined, or that different arrangements of components may be utilized.
Memory 1220 may be used to store software programs and modules, and processor 1280 may execute the various functional applications and data processing of the computer by executing the software programs and modules stored in memory 1220. The memory 1220 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and a storage data area; the storage data area may store data created according to the use of the computer (such as audio data, phonebooks, etc.), and the like. In addition, memory 1220 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
Processor 1280 is a control center of the computer and connects various parts of the entire computer using various interfaces and lines, performing various functions of the computer and processing data by running or executing software programs and/or modules stored in memory 1220, and invoking data stored in memory 1220. In the alternative, processor 1280 may include one or more processing units; preferably, the processor 1280 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, application programs, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 1280.
In an embodiment of the present application, the processor 1280 included in the terminal further has the following functions:
acquiring a target place text; the target place text is a standard place name stored in the geographic information system;
generating an error text corresponding to the target place text according to the target place text by an error text generation model;
the method comprises the steps that an error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored by a geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
The processor 1280 included in the terminal also has the following functions: :
acquiring a place retrieval text;
when the place retrieval text is detected to be matched with the target error text in the white list, correcting the place retrieval text by using the target correct place text corresponding to the target error text recorded in the white list, and obtaining corrected place retrieval text; the white list records a plurality of groups of corresponding relations between the correct place texts and the error texts, and the error texts corresponding to the correct place texts are generated by the text generation method in each embodiment;
and performing location retrieval based on the corrected location retrieval text.
Optionally, the processor 1280 is further configured to perform steps of any implementation of the method provided by the embodiment of the present application.
Referring to fig. 12, fig. 12 is a schematic structural diagram of a server 1300 according to an embodiment of the present application. The server 1300 may vary considerably in configuration or performance and may include one or more central processing units (central processing units, CPU) 1322 (e.g., one or more processors) and memory 1332, one or more storage media 1330 (e.g., one or more mass storage devices) storing applications 1342 or data 1344. Wherein the memory 1332 and storage medium 1330 may be transitory or persistent. The program stored on the storage medium 1330 may include one or more modules (not shown), each of which may include a series of instruction operations on a server. Further, the central processor 1322 may be configured to communicate with the storage medium 1330, and execute a series of instruction operations in the storage medium 1330 on the server 1300.
The Server 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input/output interfaces 1358, and/or one or more operating systems, such as Windows Server TM ,Mac OS X TM ,Unix TM ,Linux TM ,FreeBSD TM Etc.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 12.
Wherein CPU1322 is configured to perform the following steps:
acquiring a target place text; the target place text is a standard place name stored in the geographic information system;
generating an error text corresponding to the target place text according to the target place text by an error text generation model;
the method comprises the steps that an error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored by a geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
CPU1322 is also configured to perform the steps of:
acquiring a place retrieval text;
when the place retrieval text is detected to be matched with the target error text in the white list, correcting the place retrieval text by using the target correct place text corresponding to the target error text recorded in the white list, and obtaining corrected place retrieval text; the white list records a plurality of groups of corresponding relations between the correct place texts and the error texts, and the error texts corresponding to the correct place texts are generated by the text generation method in each embodiment;
and performing location retrieval based on the corrected location retrieval text.
Optionally, CPU1322 may also be configured to perform the steps of any one implementation of the methods provided by embodiments of the present application.
The embodiments of the present application also provide a computer-readable storage medium storing a computer program for executing any one of the methods described in the foregoing embodiments.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform any one of the methods described in the foregoing respective embodiments.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media in which a computer program can be stored.
It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (13)

1. A method of text generation, the method comprising:
acquiring a target place text; the target place text is a standard place name stored in a geographic information system;
generating an error text corresponding to the target place text according to the target place text by an error text generation model;
the error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored in the geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
2. The method of claim 1, wherein the map retrieval language model is trained by:
acquiring the map retrieval text; the map retrieval text comprises at least one of a standard place name stored by the geographic information system and an input retrieval text included in an object retrieval log in the geographic information system;
Carrying out shielding treatment on the map retrieval text by adopting a preset text shielding strategy to obtain a non-shielded text and a shielded text in the map retrieval text;
determining a predicted shielding text according to the non-shielding text in the map retrieval text through the map retrieval language model to be trained;
constructing a first loss function according to the predicted shielding text and the shielded text in the map retrieval text; the map retrieval language model is trained based on the first loss function.
3. The method according to claim 2, wherein the masking the map search text using a preset text masking policy comprises:
shielding the map retrieval text by adopting at least one of a random shielding strategy, an entity-level shielding strategy and a phrase-level shielding strategy;
the random shielding strategy is used for randomly selecting at least one text unit in the map retrieval text to shield; the entity level shielding strategy is used for selecting text units corresponding to the entities in the map retrieval text to shield; the phrase-level shielding strategy is used for selecting text units corresponding to at least one phrase in the map retrieval text to shield.
4. The method of claim 1, wherein the error text generation model is trained by:
determining the training correct text and the training error text in the training sample according to an object retrieval log in the geographic information system;
generating a model through the error text to be trained, and determining a prediction error text according to the training correct text in the training sample; the error text generation model is initialized based on model parameters of the map retrieval language model;
constructing a second loss function according to the prediction error text and the training error text in the training sample; training the erroneous text generation model based on the second loss function.
5. The method of claim 4, wherein the object retrieval log includes an input retrieval text and a standard location name corresponding thereto, the standard location name corresponding to the input retrieval text being determined according to a location selection operation triggered based on the input retrieval text;
the determining the training correct text and the training error text in the training sample according to the object retrieval log in the geographic information system comprises the following steps:
Performing statistical processing based on an object retrieval log in the geographic information system, and determining a standard place name meeting a preset search condition as a reference standard place name; and determining an object retrieval log including the reference standard place name as a reference object retrieval log;
if the input search text included in the reference object search log contains an error text fragment, constructing the training sample based on the input search text included in the reference object search log and the reference standard place name; and the error text segment and the core text segment of the reference standard place name meet the preset segment difference condition.
6. The method of claim 5, wherein the constructing the training sample based on the input search text and the reference standard place name included in the reference object search log comprises:
determining the training correct text in the training sample according to the reference standard place name and the regional information of the reference standard place name;
and taking input search text included in the reference object search log as the training error text in the training sample.
7. The method according to claim 1, wherein generating the error text corresponding to the target place text from the target place text by the error text generation model includes:
mining a core text segment in the target place text as a target core text;
and generating an error text corresponding to the target place text according to the target core text through an error text generation model.
8. A method of location retrieval, the method comprising:
acquiring a place retrieval text;
when the place retrieval text is detected to be matched with the target error text in the white list, correcting the place retrieval text by utilizing the target correct place text corresponding to the target error text recorded in the white list, and obtaining corrected place retrieval text; the white list records a plurality of groups of corresponding relations between correct place texts and error texts, and the error texts corresponding to the correct place texts are generated by the text generation method according to any one of claims 1 to 7;
and performing location retrieval based on the corrected location retrieval text.
9. The method of claim 8, wherein the acquisition site retrieves text comprising any of:
Acquiring a text input in a place retrieval input box as the place retrieval text;
acquiring a place retrieval image, and identifying a text included in the place retrieval image as the place retrieval text;
and acquiring a place retrieval voice, and identifying a text corresponding to the place retrieval voice as the place retrieval text.
10. A text generation apparatus, the apparatus comprising:
the first acquisition module is used for acquiring the text of the target place; the target place text is a standard place name stored in a geographic information system;
the generation module is used for generating a model through the error text, and generating the error text corresponding to the target place text according to the target place text;
the error text generation model is obtained by training on the basis of a map retrieval language model, a training sample of the error text generation model comprises training correct texts with corresponding relations and training error texts, the training correct texts are determined according to standard place names stored in the geographic information system, and preset difference conditions are met between the training error texts and the training correct texts; the map retrieval language model is used for determining corresponding map semantic features of the input text, and is trained based on the map retrieval text.
11. A location retrieval device, the device comprising:
the second acquisition module is used for acquiring the place retrieval text;
the correction module is used for correcting the place retrieval text by utilizing the target correct place text corresponding to the target error text recorded by the white list when the place retrieval text is detected to be matched with the target error text in the white list, so as to obtain corrected place retrieval text; the white list records a plurality of groups of corresponding relations between correct place texts and error texts, and the error texts corresponding to the correct place texts are generated by the text generation method according to any one of claims 1 to 7;
and the retrieval module is used for retrieving the location based on the corrected location retrieval text.
12. A computer device, the computer device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to execute the text generation method according to any one of claims 1 to 7 or the place retrieval method according to any one of claims 8 to 9 according to the computer program.
13. A computer-readable storage medium storing a computer program for executing the text generation method of any one of claims 1 to 7 or the place retrieval method of any one of claims 8 to 9.
CN202310958611.6A 2023-08-01 2023-08-01 Text generation method, place retrieval method and related devices Active CN116662583B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310958611.6A CN116662583B (en) 2023-08-01 2023-08-01 Text generation method, place retrieval method and related devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310958611.6A CN116662583B (en) 2023-08-01 2023-08-01 Text generation method, place retrieval method and related devices

Publications (2)

Publication Number Publication Date
CN116662583A true CN116662583A (en) 2023-08-29
CN116662583B CN116662583B (en) 2023-11-10

Family

ID=87715787

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310958611.6A Active CN116662583B (en) 2023-08-01 2023-08-01 Text generation method, place retrieval method and related devices

Country Status (1)

Country Link
CN (1) CN116662583B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530840A (en) * 2013-10-10 2014-01-22 中国中医科学院 Accurate and quick electronic medical record type-in system
CN112464650A (en) * 2020-11-12 2021-03-09 创新工场(北京)企业管理股份有限公司 Text error correction method and device
CN113807102A (en) * 2021-08-20 2021-12-17 北京百度网讯科技有限公司 Method, device, equipment and computer storage medium for establishing semantic representation model
CN115017425A (en) * 2022-07-19 2022-09-06 深圳依时货拉拉科技有限公司 Location search method, location search device, electronic device, and storage medium
CN115309994A (en) * 2022-09-05 2022-11-08 深圳依时货拉拉科技有限公司 Location search method, electronic device, and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530840A (en) * 2013-10-10 2014-01-22 中国中医科学院 Accurate and quick electronic medical record type-in system
CN112464650A (en) * 2020-11-12 2021-03-09 创新工场(北京)企业管理股份有限公司 Text error correction method and device
CN113807102A (en) * 2021-08-20 2021-12-17 北京百度网讯科技有限公司 Method, device, equipment and computer storage medium for establishing semantic representation model
CN115017425A (en) * 2022-07-19 2022-09-06 深圳依时货拉拉科技有限公司 Location search method, location search device, electronic device, and storage medium
CN115309994A (en) * 2022-09-05 2022-11-08 深圳依时货拉拉科技有限公司 Location search method, electronic device, and storage medium

Also Published As

Publication number Publication date
CN116662583B (en) 2023-11-10

Similar Documents

Publication Publication Date Title
CN110795543B (en) Unstructured data extraction method, device and storage medium based on deep learning
CN108701161B (en) Providing images for search queries
CN112329467B (en) Address recognition method and device, electronic equipment and storage medium
CN110019732B (en) Intelligent question answering method and related device
US8577882B2 (en) Method and system for searching multilingual documents
US20160110446A1 (en) Method for disambiguated features in unstructured text
CN106537370A (en) Method and system for robust tagging of named entities in the presence of source or translation errors
US10838951B2 (en) Query interpretation disambiguation
CN113505204B (en) Recall model training method, search recall device and computer equipment
CN116795973B (en) Text processing method and device based on artificial intelligence, electronic equipment and medium
CN115062134B (en) Knowledge question-answering model training and knowledge question-answering method, device and computer equipment
CN108304381B (en) Entity edge establishing method, device and equipment based on artificial intelligence and storage medium
CN113704507A (en) Data processing method, computer device and readable storage medium
CN115438674A (en) Entity data processing method, entity linking method, entity data processing device, entity linking device and computer equipment
CN111125550A (en) Interest point classification method, device, equipment and storage medium
Kayed et al. Postal address extraction from the web: A comprehensive survey
CN113821612A (en) Information searching method and device
CN116662583B (en) Text generation method, place retrieval method and related devices
CN115408532A (en) Open source information-oriented weapon equipment knowledge graph construction method, system, device and storage medium
Yang et al. Point‐of‐interest detection from Weibo data for map updating
CN110990724B (en) Sliding window sampling-based spatial semantic similarity calculation method
CN113807102A (en) Method, device, equipment and computer storage medium for establishing semantic representation model
CN114238667B (en) Address management method and device, electronic equipment and storage medium
CN111538813B (en) Classification detection method, device, equipment and storage medium
CN116524513B (en) Open vocabulary scene graph generation method, system, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant