Port text data processing method, device, equipment and medium

By modifying word segmentation and embedding value on the large language model, combining the port number replacement table and replacement prompt word information, the target large language model is trained to generate, which solves the matching problem when port text data is converted into vectors, and achieves higher data item matching and processing accuracy.

CN120087366BActive Publication Date: 2025-08-22CHINA WATERBORNE TRANSPORT RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510559809.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-22
Estimated Expiration
2045-04-30

AI Technical Summary

Technical Problem

In the prior art, when the port text data is converted into vectors, the text embedding model cannot recognize the relationship between port data items such as container numbers and field bridge numbers, resulting in the low matching of the generated vectors with the port data items.

Method used

By modifying word segmentation and embedding value on the first and second language models, the third and fourth language models are generated, and the port number replacement table and replacement prompt word information are used to replace the original port training data by using the port number replacement table and replacement prompt word information, the target large language model is trained to obtain the target large language model, and finally the target large language model and text embedding model are used to process the initial port text data to generate the target vector.

Benefits of technology

The matching of the target vector and the port data items is improved, and the accuracy and effectiveness of port text data processing is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120087366B_ABST
    Figure CN120087366B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, equipment and medium for processing port text data. In this method, the first and second largest language models are subjected to word segmentation and embedding value modification processing according to the replacement character string corresponding to the port data item to obtain the third and fourth largest language models. Then, according to the third largest language model and the port number replacement table, the original port training data is subjected to data item replacement processing to obtain the target port training data, and then the fourth largest language model is trained to obtain the target large language model. Finally, according to the target large language model and the text embedding model, the initial port text data is processed to obtain the target vector. This solution processes the initial port text data using the trained target large language model for replacing the port data item and the text embedding model to obtain the target vector, thereby effectively improving the matching of the target vector with the port data item.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of port data processing, and in particular to a method, device, equipment and medium for processing port text data. Background Art

[0002] To better utilize port text data, port text data can be converted into vectors, which are then mapped to the port text data and stored in a knowledge base. Retrieval-Augmented Generation (RAG) technology, which utilizes the knowledge base, converts user-entered questions into question vectors, which are then matched against the vectors in the knowledge base. The port text data corresponding to the matched vectors and the question are then combined into prompt text, which is then fed into a large language model for processing to generate the appropriate answer.

[0003] In the existing technology, the method for converting port text data into vectors is usually to directly input the port text data into a text embedding model. The text embedding model segments the port text data to obtain word segments, and then calculates the vector corresponding to the port text data based on the embedding value corresponding to the word segment.

[0004] However, since the port text data includes port data items such as container number, yard crane number, and quay crane number, the text embedding model cannot recognize the relationship between the number and the port data item, resulting in a low match between the generated vector and the port data item. Summary of the Invention

[0005] The port text data processing method, device, equipment and medium provided in the embodiments of the present application are used to solve the problem in the prior art of directly using a text embedding model to process port text data, resulting in low matching between the generated vector and the port data item.

[0006] In a first aspect, an embodiment of the present application provides a method for processing port text data, comprising:

[0007] Perform word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement character string corresponding to each port data item, to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model;

[0008] For each acquired original port training data, performing data item replacement processing on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data;

[0009] Training the fourth language model according to the training data of each target port to obtain a target language model;

[0010] The obtained initial port text data is processed according to the target large language model and the text embedding model to obtain a target vector.

[0011] In a possible implementation, performing word segmentation and embedding value modification processing on the first language model and the second language model according to the obtained replacement string corresponding to each port data item to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model includes:

[0012] The first language model and the second language model are respectively used as models to be modified, and the following processing is performed on the models to be modified:

[0013] Calculate a first embedding value for each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified;

[0014] For each replacement string, storing the replacement string in the word segmenter of the model to be modified, and storing the first embedding value of the replacement string in the model to be modified to obtain a modified model;

[0015] If the model to be modified is the first language model, use the modified model as the third language model;

[0016] If the model to be modified is the second largest language model, the modified model is used as the fourth largest language model.

[0017] In one possible implementation, calculating the first embedding value of each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified includes:

[0018] For each replacement string, the following processing is performed:

[0019] removing special symbols and separators from the replacement character string to obtain at least one target original tag;

[0020] If the number of target original tokens is equal to 1, the embedding value of the target original token in the word segmenter of the to-be-modified model is used as the first embedding value of the replacement string;

[0021] If the number of target original tokens is greater than 1, a first embedding value of the replacement string is calculated according to the embedding value of each target original token in the word segmenter of the model to be modified.

[0022] In a possible implementation, performing data item replacement processing on the original port training data based on the obtained port number replacement table, the replacement prompt word information corresponding to each port data item, and the third language model to obtain the target port training data includes:

[0023] Performing number replacement processing on the original port training data according to the port number replacement table to obtain first training data;

[0024] Performing port data item identification processing on the first training data to obtain data items to be replaced;

[0025] replacing the data item to be replaced in the first training data according to a preset correspondence between the data item type and the universal replacement string to obtain second training data;

[0026] The replacement prompt word information corresponding to each port data item and the second training data are input into the third language model to obtain the target port training data.

[0027] In one possible implementation, the method further includes:

[0028] According to the replacement string corresponding to each port data item, the initial text embedding model is processed by word segmentation and embedding value modification to obtain a text embedding modification model;

[0029] For each replacement string, the following processing is performed:

[0030] Calculating a target coefficient corresponding to each preset reference original token based on an embedding value of the replacement string in the second large language model and the target large language model, and an embedding value of each preset reference original token in the second large language model and the target large language model;

[0031] Calculate the second embedding value of the replacement string according to the embedding value of each preset reference original token in the initial text embedding model, the target coefficient corresponding to each preset reference original token, the embedding value of all first tokens in the word segmenter of the initial text embedding model, the embedding value of all second tokens in the word segmenter of the second language model, and the embedding value of the replacement string in the text embedding modification model;

[0032] The embedding value of the replacement string in the word segmenter in the text embedding modification model is replaced with the second embedding value of the replacement string to obtain a target text embedding model.

[0033] In one possible implementation, calculating the target coefficient corresponding to each preset reference original token based on the embedding value of the replacement string in the second large language model and the target large language model, and the embedding value of each preset reference original token in the second large language model and the target large language model, includes:

[0034] taking the difference between the embedding values ​​of the replacement character string in the second large language model and the target large language model as the embedding value difference;

[0035] For each preset reference original token, taking the average of the embedding values ​​of the preset reference original token in the second large language model and the target large language model as the embedding average corresponding to the preset reference original token;

[0036] The target coefficient corresponding to each preset reference original mark is calculated according to the embedding value difference and the embedding average value corresponding to each preset reference original mark.

[0037] In one possible implementation, calculating the second embedding value of the replacement string based on the embedding value of each preset reference original token in the initial text embedding model, the target coefficient corresponding to each preset reference original token, the embedding values ​​of all first tokens in the word segmenter of the initial text embedding model, the embedding values ​​of all second tokens in the word segmenter of the second language model, and the embedding value of the replacement string in the text embedding modification model includes:

[0038] Calculating an embedding value compensation value of the replacement character string according to the embedding value of each preset reference original token in the initial text embedding model, a target coefficient corresponding to each preset reference original token, the embedding value difference, the embedding value of each first token, and the embedding value of each second token;

[0039] The sum of the embedding value compensation value of the replacement character string and the embedding value of the replacement character string in the text embedding modification model is used as the second embedding value of the replacement character string.

[0040] In a second aspect, an embodiment of the present application provides a port text data processing device, comprising:

[0041] Processing module for:

[0042] Performing word segmentation modification processing on the first language model and the second language model according to the obtained replacement character string corresponding to each port data item to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model;

[0043] For each acquired original port training data, performing data item replacement processing on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data;

[0044] A model training module, configured to train the fourth language model according to the training data of each target port to obtain a target language model;

[0045] The vector conversion module is used to process the acquired initial port text data according to the target large language model and text embedding model to obtain a target vector.

[0046] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0047] Processor, memory, communication interface;

[0048] The memory is used to store executable instructions of the processor;

[0049] Wherein, the processor is configured to execute the port text data processing method described in any one of the first aspects by executing the executable instructions.

[0050] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the port text data processing method described in any one of the first aspects is implemented.

[0051] The port text data processing method, device, equipment and medium provided in the embodiment of the present application, after performing word segmentation and embedding value modification processing on the first and second language models according to the replacement character string corresponding to each port data item, the third and fourth language models are obtained, and then the original port training data is subjected to data item replacement processing according to the third language model, the obtained port number replacement table, and the replacement prompt word information corresponding to each port data item to obtain the target port training data. Then, the fourth language model is trained according to the target port training data to obtain the target large language model. Finally, the initial port text data obtained is processed according to the target large language model and the text embedding model to obtain the target vector. This solution processes the initial port text data using the target large language model obtained by training for replacing the port data item and the text embedding model to obtain the target vector, thereby effectively improving the matching of the target vector with the port data item. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0053] Figure 1 Schematic diagram of the RAG technology provided in this application;

[0054] Figure 2 A flowchart of the first embodiment of the port text data processing method provided in this application;

[0055] Figure 3 A flow chart of the second embodiment of the port text data processing method provided in this application;

[0056] Figure 4a A schematic diagram of the embedding value modification process of the text embedding model provided in this application;

[0057] Figure 4b Schematic diagram of the generation process of the target text embedding model provided in this application;

[0058] Figure 5 This is a schematic diagram of the structure of an embodiment of a port text data processing device provided by this application;

[0059] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this application.

[0060] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0061] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0062] The terms "first," "second," "third," "fourth," and so forth (if any) in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.

[0063] First, let’s explain the terms involved in this application:

[0064] Large Language Model (LLM): refers to a natural language processing model trained using large-scale text data based on deep learning technology.

[0065] Text Embedding Model: A machine learning model that converts text into vectors.

[0066] To better utilize port text data, port text data can be converted into vectors, which are then mapped to the port text data and stored in a knowledge base. Retrieval-Augmented Generation (RAG) technology, which utilizes the knowledge base, converts user-entered questions into question vectors, which are then matched against the vectors in the knowledge base. The port text data corresponding to the matched vectors and the question are then combined into prompt text, which is then fed into a large language model for processing to generate the appropriate answer.

[0067] For example, Figure 1 The flow chart of the RAG technology provided in this application is as follows: Figure 1 As shown in the figure, after the user enters a question, the question is converted into a question vector through the text embedding model, and then the question vector is matched with the vector in the knowledge base. The port text data corresponding to the matched vector and the prompt text composed of the question are then input into the large language model for processing to obtain the corresponding answer.

[0068] In existing technology, port text data is typically converted into vectors by directly inputting the data into a text embedding model. The model then segments the data into tokens and calculates the corresponding vectors based on the embedding values ​​corresponding to the tokens. Because port text data includes port data items such as container numbers, yard crane numbers, and quay crane numbers, the text embedding model cannot recognize the relationship between the numbers and the port data items, and may also segment the port data items. This results in a poor match between the generated vectors and the port data items.

[0069] In response to the problems existing in the prior art, the inventors discovered during their research on the port text data processing method that in order to improve the matching between the generated vector and the port data item, the port data item in the port text data can be replaced with a character string that can reflect the port data item, and then the replaced port text data can be processed using a text embedding model to obtain a target vector. In order to improve the accuracy of the replacement, the first and second language models can be processed by word segmentation and embedding value modification using the replacement character string corresponding to the port data item to obtain the third and fourth language models. Then, according to the third language model and the port number replacement table, the original port training data is subjected to data item replacement processing. After obtaining the target port training data, the fourth language model is trained to obtain a target large language model, which is used to replace the port data item. Based on the above-mentioned inventive concept, the port text data processing scheme in this application is designed.

[0070] The execution subject of the port text data processing method in this application can be a server, or a computer, terminal equipment, ship, etc. This application does not limit it. The following description will be made using a server as an example.

[0071] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances must be provided for users to choose to authorize or refuse.

[0072] The following is an example of the application scenario of the port text data processing method provided in this application.

[0073] For example, in this application scenario, in order for users to better use the RAG technology, the port text data generated by the port needs to be generated into vectors and then stored in the knowledge base.

[0074] In order to improve the matching between the generated vector and the port data item, the server needs to obtain the replacement string corresponding to each port data item, the first language model, the second language model, the original port training data, the port number replacement table, and the replacement prompt word information corresponding to each port data item.

[0075] The server then performs word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement string corresponding to each port data item to obtain the third language model corresponding to the first language model and the fourth language model corresponding to the second language model.

[0076] For each original port training data, data item replacement processing is performed on the original port training data according to the port number replacement table, the replacement prompt word information corresponding to each port data item, and the third language model to obtain the target port training data;

[0077] The fourth language model is trained according to the training data of each target port to obtain the target language model.

[0078] The obtained initial port text data is processed according to the target large language model and the text embedding model to obtain a target vector. Specifically, the initial port text data is input into the target large language model to obtain text data for the replacement port data item. The text data for the replacement port data item is then input into the text embedding model to obtain a target vector.

[0079] The server then establishes a correspondence between the target vector and the text data of the replaced port data item and stores it in the knowledge base.

[0080] It should be noted that the above is only an example of an application scenario provided by an embodiment of the present application. The embodiment of the present application does not limit the actual form of the various devices included in the scenario. In the specific application of the solution, it can be set according to actual needs.

[0081] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0082] Figure 2 This is a flow chart of the first embodiment of the port text data processing method provided by this application. This embodiment of the application describes how the server obtains a target large language model for replacing port data items, and processes the obtained initial port text data according to the target large language model and the text embedding model to obtain a target vector. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 2As shown, the port text data processing method specifically includes the following steps:

[0083] S201: Perform word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement character string corresponding to each port data item obtained, to obtain the third language model corresponding to the first language model and the fourth language model corresponding to the second language model.

[0084] In this step, in order to replace the data items in the port text data, the server obtains the replacement string, the first language model and the second language model corresponding to each port data item, and then performs word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement string corresponding to each port data item, to obtain the third language model corresponding to the first language model and the fourth language model corresponding to the second language model.

[0085] The embedding value of each replacement string can be calculated based on the embedding value of the original token in the word segmenter of the first language model, and then each replacement string is stored in the word segmenter of the first language model, and the embedding value of the replacement string is stored in the first language model to obtain the third language model.

[0086] The embedding value of each replacement string can be calculated based on the embedding value of the original token in the word segmenter of the second largest language model, and then each replacement string is stored in the word segmenter of the second largest language model, and the embedding value of the replacement string is stored in the second largest language model to obtain the fourth largest language model.

[0087] It should be noted that the port data item can be a container number, a yard crane number, a quay crane number, a yard number, a ship bay number, etc. The embodiment of this application does not limit the port data item and can be determined according to actual conditions.

[0088] It should be noted that the mark in the word segmenter is also called token.

[0089] It should be noted that the size of the large language model can be characterized by a size measurement indicator of the large language model, and the size measurement indicator can be at least one of the number of parameters, the number of layers, the dimension of the hidden layer, the computing resource consumption rate, etc. The first large language model is larger than the second large language model.

[0090] S202: For each acquired original port training data, data item replacement processing is performed on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data.

[0091] In this step, after the server obtains the third language model and the fourth language model, in order to obtain a more accurate large language model for replacing the port data items, it is necessary to perform data item replacement processing on each original port training data obtained according to the obtained port number replacement table, the replacement prompt word information corresponding to each port data item, and the third language model to obtain the target port training data.

[0092] Specifically, according to the port number replacement table, the original port training data is subjected to number replacement processing to obtain the first training data.

[0093] The port number replacement table stores the port data item number and its corresponding replacement string. For each number in the port number replacement table, the number in the original port training data is replaced with the replacement string corresponding to the number to obtain the first training data.

[0094] Then, the first training data is processed for port data item identification to obtain data items to be replaced.

[0095] Since port data item numbers are generated according to a specific format, for example, a container number has 11 digits, with the first four digits being letters and the last seven being numbers. A vessel's container number has 6 digits, all of which are numbers, with the preceding and following characters not being numbers. Therefore, the data item to be replaced in the first training data can be identified based on this specific format.

[0096] According to the correspondence between the preset data item type and the universal replacement character string, the data item to be replaced in the first training data is replaced to obtain the second training data.

[0097] For each data item to be replaced, since the specific formats of different types of port data items are different, the data item type of the data item to be replaced can be determined based on the specific format, and then the universal replacement string corresponding to the data item type of the data item to be replaced can be determined based on the preset correspondence between the data item type and the universal replacement string, and then the data item to be replaced in the first training data is replaced with the universal replacement string to obtain the second training data.

[0098] For example, the universal replacement string corresponding to the container number is <|Container|>, and the universal replacement string corresponding to the quay crane number is <|Crane|>.

[0099] The replacement prompt word information corresponding to each port data item and the second training data are input into the third language model to obtain the target port training data.

[0100] In one implementation, the replacement prompt word information corresponding to the port data item and the second training data can be sequentially input into the third large language model for processing to obtain the target port training data.

[0101] The replacement prompt word information includes a prompt word and a modification rule. Exemplarily, the prompt word corresponding to the container number is:

[0102] Please analyze the subsequent text content between <document information>< / document information>, and according to the meaning and modification rule of the container number in each statement, rewrite <|Container|> therein as: <|Container|> or <|Container_in_port|> or <|Container_on_ship|> or <|Container_to_port|> or <|Container_departed_port|>.

[0103] The modification rule corresponding to the container number is:

[0104] <modification rule>

[0105] When inferring from semantics that the container is in the port area, rewrite it as <|Container_in_port|>.

[0106] When inferring from semantics that the container is on the ship, rewrite it as <|Container_on_ship|>.

[0107] When inferring from semantics that the container is being transported to the port area, rewrite it as <|Container_to_port|>.

[0108] When inferring from semantics that the container has left the port area, rewrite it as <|Container_departed_port|>.

[0109] For other <|Container|> whose status cannot be known, keep them unchanged.

[0110] < / modification rule>

[0111] The second training data is:

[0112] <document information>

[0113] At 08:30 on October 25, 2023, the ship "MAERSK COLUMBUS" is berthing at Berth No. 3, and <|Container|> (40-foot high cabinet) is about to be unloaded to the quay front and planned to be transferred to Yard Area A6.

[0114] At 14:20, during a random inspection on a trailer heading to the port, the customs found that the seal of <|Container|> was abnormal.

[0115] At 03:15 the next day, the intelligent monitoring platform detected that the temperature of <|Container|> had abnormally risen to +5°C (set at -18°C). The emergency team activated the backup power supply and transferred the goods. After inspection, it was found that the compressor of the refrigeration unit had failed.

[0116] At 15:00, the driverless truck carrying <|Container|> accurately docked with the intelligent rail-mounted crane and was expected to reach the overseas warehouse in 36 hours.

[0117] < / Document Information>

[0118] The training data for the target port is as follows:

[0119] At 08:30 on October 25, 2023, the ship "MAERSK COLUMBUS" was berthing at Berth 3, and <|Container_on_ship|> (40-foot high cabinet) was about to be unloaded to the quay front and planned to be transferred to Area A6 of the yard.

[0120] At 14:20, during a random inspection on a trailer heading to the port, the customs found that the seal of <|Container_to_port|> was abnormal.

[0121] At 03:15 the next day, the intelligent monitoring platform detected that the temperature of <|Container|> had abnormally risen to +5°C (set at -18°C). The emergency team activated the backup power supply and transferred the goods. After inspection, it was found that the compressor of the refrigeration unit had failed.

[0122] At 15:00, the driverless truck carrying <|Container_in_port|> accurately docked with the intelligent rail-mounted crane and was expected to reach the overseas warehouse in 36 hours.

[0123] Exemplarily, the prompt words corresponding to the quay crane number are:

[0124] Please analyze the subsequent text content between <Document Information>< / Document Information>, and according to the meaning of the quay crane number and the modification rules in each statement, rewrite <|Crane|> as: <|Crane|> or <|Crane_in_operation|> or <|Crane_idle|> or <|Crane_under_maintenance|> or <|Crane_out_of_service|>.

[0125] Exemplarily, the modification rules corresponding to the quay crane number are:

[0126] <Modification Rules>

[0127] When it is inferred from semantics that the quay crane is in operation, rewrite it as <|Crane_in_operation|>.

[0128] When it is inferred from semantics that the quay crane is in standby state, rewrite it as <|Crane_idle|>.

[0129] When it is inferred from semantics that the quay crane is in maintenance state, rewrite it as <|Crane_under_maintenance|>.

[0130] When it is inferred from semantics that the quay crane is out of service due to failure or other reasons, rewrite it as <|Crane_out_of_service|>.

[0131] For other <|Crane|> whose status cannot be known, keep the original state without modification. <00002​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​At 03:15 the next day, the dispatching system indicated that <|Crane_idle|> had entered standby mode, awaiting the next operation instruction.

[0144] At 15:00, the maintenance team carried out planned maintenance on <|Crane_under_maintenance|>, including testing the cable tension and checking the drive system. Operations are expected to resume in 6 hours.

[0145] It should be noted that the embodiment of the present application does not limit the port data items, the replacement prompt word information corresponding to the port data items, etc., which can be determined according to actual conditions.

[0146] S203: Train the fourth language model according to the training data of each target port to obtain a target language model.

[0147] In this step, after the server obtains the target port training data, it obtains the question corresponding to each target port training data, combines the target port training data and the question into a training structure, and then uses the training structure to train the fourth language model to obtain the target language model.

[0148] For example, the training structure is:

[0149] {

[0150] "instruction": "question",

[0151] "input": "",

[0152] "output": "Target port training data"

[0153] }

[0154] It should be noted that the server can obtain the questions corresponding to the target port training data by: a staff member sends the questions corresponding to the target port training data to the server, and the server obtains the questions. Alternatively, the server processes the target port training data using a large language model to obtain the questions. Alternatively, the server randomly selects a question from a question library as the question corresponding to the target port training data. This embodiment of the application does not limit the method by which the server obtains the questions corresponding to the target port training data; the method can be determined based on actual circumstances.

[0155] S204: Process the acquired initial port text data according to the target large language model and the text embedding model to obtain a target vector.

[0156] In this step, after obtaining the target large language model, the server processes the obtained initial port text data according to the target large language model and the text embedding model to obtain the target vector.

[0157] Since the target large language model is used to replace the port data item, the initial port text data is input into the target large language model to obtain the text data of the replacement port data item. The text data of the replacement port data item is then input into the text embedding model to obtain the target vector.

[0158] The server then establishes a correspondence between the target vector and the text data of the replaced port data item and stores it in the knowledge base.

[0159] The port text data processing method provided in this embodiment performs word segmentation and embedding value modification processing on the first and second language models according to the replacement character strings corresponding to each port data item to obtain the third and fourth language models. Then, according to the third language model, the obtained port number replacement table, and the replacement prompt word information corresponding to each port data item, the original port training data is subjected to data item replacement processing to obtain the target port training data. Then, the fourth language model is trained according to the target port training data to obtain the target large language model. Finally, according to the target large language model and the text embedding model, the obtained initial port text data is processed to obtain the target vector. Compared with the prior art that directly uses the text embedding model to process the initial port text data, this solution uses the trained target large language model for replacing the port data item and the text embedding model to process the initial port text data to obtain the target vector, effectively improving the matching of the target vector with the port data item.

[0160] Figure 3 This is a flow chart of Example 2 of the port text data processing method provided in this application. Based on the above embodiment, this embodiment of the application illustrates the situation in which the server performs word segmentation and embedding value modification processing on the first and second largest language models to obtain the third and fourth largest language models.

[0161] like Figure 3 As shown, the first language model and the second language model are respectively used as models to be modified, and the following steps are performed on the models to be modified:

[0162] S301: Calculate a first embedding value of each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified.

[0163] In this step, in order to modify the large language model, it is necessary to calculate the first embedding value of each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified.

[0164] Specifically, the following processing is performed for each replacement string:

[0165] The replacement string is segmented by removing special symbols and separators to obtain at least one target original tag. Since the replacement string includes the original tag and special symbols, it may also include separators. Therefore, after removing special symbols from the replacement string, it is determined whether the replacement string after removing the special symbols includes separators. If the replacement string after removing the special symbols does not include separators, the replacement string after removing the special symbols is the target original tag. If the replacement string after removing the special symbols includes separators, the replacement string after removing the special symbols is segmented according to the separators, and the string obtained by segmentation is the target original tag.

[0166] Exemplarily, the replacement string is <|Container|>, where the special symbols are <, |, >, and the separator is _. After removing the special symbols, Container is obtained, which does not include the separator. Container is the target original tag.

[0167] Exemplarily, the replacement string is <|Container_in_port|>, where special symbols are <, |, >, and the separator is _. After removing the special symbols, Container_in_port is obtained, which includes the separator. Container_in_port is split according to the separator to obtain Container, in, and port, where Container, in, and port are the target original tags.

[0168] It should be noted that special symbols can be <, |, >, *, %, #, etc., and separators can be _, semicolon, colon, etc. The embodiments of this application do not limit special symbols and separators, and can be determined according to actual conditions.

[0169] If the number of target original tokens is 1, the embedding value of the target original token in the token segmenter of the model to be modified is used as the first embedding value of the replacement string. The identifier of the target original token can be found in the token segmenter, and then the embedding value corresponding to the identifier of the target original token can be found in the model to be modified.

[0170] If the number of target original tokens is greater than 1, the first embedding value of the replacement string is calculated based on the embedding value of each target original token in the word segmenter of the model to be modified.

[0171] For each target original tag, the identifier of the target original tag can be found from the word segmenter, and then the embedding value corresponding to the identifier of the target original tag can be found from the model to be modified, that is, the embedding value of the target original tag. Then the main tag and sub-tag in the target original tag are determined. There is only one main tag in the target original tag. Then the formula is used , calculate the first embedded value of the replacement string. represents the first embedded value of the replacement string, Represents the embedded value of the main tag, represents the preset weight, N represents the number of sub-tags, i represents the i-th sub-tag, represents the embedding value of the i-th sub-tag, express The model, express Model.

[0172] It should be noted that the preset weight can be 0.3, 0.5, 0.7, etc. The embodiment of the present application is not limited by the preset weight and can be determined according to actual conditions.

[0173] It should be noted that the way the server determines the main tag and sub-tag in the target original tag can be: a main tag table is stored in the server, and if any one of the tags in the target original tag that belongs to the main tag table is used as the main tag, the tags in the target original tag other than the main tag are used as sub-tags. It can also be: the target original tags are sorted according to their positions in the replacement string after removing special symbols, and the first target original tag is used as the main tag, and the tags in the target original tag other than the main tag are used as sub-tags. It can also be: any one tag in the target original tag is used as the main tag, and the tags in the target original tag other than the main tag are used as sub-tags. The embodiment of the present application does not limit the way to determine the main tag and sub-tag in the target original tag, and it can be determined according to actual conditions.

[0174] S302: For each replacement string, store the replacement string in the word segmenter of the model to be modified, and store the first embedded value of the replacement string in the model to be modified to obtain a modified model.

[0175] In this step, after the server obtains the first embedded value of each replacement string, for each replacement string, the replacement string is stored in the word segmenter of the model to be modified, and the first embedded value of the replacement string is stored in the model to be modified to obtain the modified model.

[0176] It should be noted that the server can also resize the modified model.

[0177] S303: Determine whether the model to be modified is the first largest language model; if the model to be modified is the first largest language model, execute step S304; if the model to be modified is the second largest language model, execute step S305.

[0178] S304: Use the modified model as the third language model.

[0179] S305: Use the modified model as the fourth language model.

[0180] In the above steps, after the server obtains the modified model, in order to determine whether the modified model is the third largest language model or the fourth largest language model, it is necessary to determine whether the model to be modified is the first largest language model; if the model to be modified is the first largest language model, the modified model is used as the third largest language model; if the model to be modified is the second largest language model, the modified model is used as the fourth largest language model.

[0181] The port text data processing method provided in this embodiment performs word segmentation and embedding value modification processing on the first and second language models through the replacement character strings corresponding to the port data items, so that the obtained third and fourth language models can process the text data of the replaced port data items.

[0182] On the basis of the above embodiments, the following describes the situation where the server modifies the text embedding model in the RAG technology through the third embodiment of the port text data processing method provided by this application.

[0183] First, the initial text embedding model is processed with word segmenter and embedding value modification according to the replacement string corresponding to each port data item to obtain the text embedding modification model.

[0184] It should be noted that the method in Example 2 can be used to obtain a text embedding modification model. The initial text embedding model is used as the model to be modified. Based on the embedding value of the original token in the word segmenter of the model to be modified, the first embedding value of each replacement string is calculated. For each replacement string, the replacement string is stored in the word segmenter of the model to be modified, and the first embedding value of the replacement string is stored in the model to be modified to obtain a modified model. The modified model is the text embedding modification model.

[0185] For example, Figure 4a This is a flow chart of the embedded value modification process of the text embedding model provided in this application. Figure 4a As shown in the figure, after the server obtains the text embedding modification model, in order to further improve the accuracy of the text embedding model, the following steps are performed for each replacement string:

[0186] S401: Calculate a target coefficient corresponding to each preset reference original token based on the embedding value of the replacement string in the second largest language model and the target large language model, and the embedding value of each preset reference original token in the second largest language model and the target large language model.

[0187] In this step, after obtaining the text embedding modification model, the server calculates the target coefficient corresponding to each preset benchmark original token based on the embedding value of the replacement string in the second largest language model and the target large language model, as well as the embedding value of each preset benchmark original token in the second largest language model and the target large language model.

[0188] Specifically, the difference between the embedding values ​​of the replacement character string in the second largest language model and the target large language model is used as the embedding value difference.

[0189] For each preset benchmark original tag, the average of the embedding values ​​of the preset benchmark original tag in the second largest language model and the target large language model is used as the embedding average value corresponding to the preset benchmark original tag.

[0190] It should be noted that the preset benchmark original tags do not include the replacement character strings corresponding to each port data item, and the number of preset benchmark original tags is greater than or equal to the dimension of the embedding value of the tag of the initial text embedding model.

[0191] The target coefficient corresponding to each preset reference original mark is calculated according to the embedding value difference and the embedding average value corresponding to each preset reference original mark.

[0192] According to the formula , calculate the target coefficient corresponding to each preset benchmark original mark. Among them, represents the embedding value difference, M represents the number of preset reference original tags, i represents the i-th preset reference original tag, represents the average embedding value corresponding to the i-th preset benchmark original mark, Represents the target coefficient corresponding to the i-th preset reference original mark. Characterized by , P represents The row vectors formed by express So , the target coefficient corresponding to each preset benchmark original mark can be obtained.

[0193] S402: Calculate the second embedding value of the replacement string based on the embedding value of each preset benchmark original token in the initial text embedding model, the target coefficient corresponding to each preset benchmark original token, the embedding value of all first tokens in the word segmenter of the initial text embedding model, the embedding value of all second tokens in the word segmenter of the second largest language model, and the embedding value of the replacement string in the text embedding modification model.

[0194] In this step, after obtaining the target coefficient corresponding to each preset benchmark original tag, the server calculates the second embedding value of the replacement string based on the embedding value of each preset benchmark original tag in the initial text embedding model, the target coefficient corresponding to each preset benchmark original tag, the embedding value of all first tags in the word segmenter of the initial text embedding model, the embedding value of all second tags in the word segmenter of the second largest language model, and the embedding value of the replacement string in the text embedding modification model.

[0195] Specifically, the embedding value compensation value of the replacement string is calculated based on the embedding value of each preset benchmark original tag in the initial text embedding model, the target coefficient corresponding to each preset benchmark original tag, the embedding value difference, the embedding value of each first tag, and the embedding value of each second tag.

[0196] According to the formula , calculate the embedded value compensation value of the replacement string. Among them, represents the embedded value compensation value of the replacement string, M represents the number of preset reference original tags, i represents the i-th preset reference original tag, represents the target coefficient corresponding to the i-th preset benchmark original mark, represents the embedding value of the i-th preset benchmark original token in the initial text embedding model, represents the modulus of the difference in embedded values, express The model, represents the average modulus of the embedding values ​​of all first tokens in the tokenizer of the initial text embedding model, Represents the average of the modulos of the embedding values ​​of all second tokens in the tokenizer of the second largest language model.

[0197] It should be noted that the first token is each token in the word segmenter of the initial text embedding model, or may be each token in the word segmenter of the initial text embedding model. The second token is each token in the word segmenter of the second largest language model.

[0198] Then, the sum of the embedding value compensation value of the replacement string and the embedding value of the replacement string in the text embedding modification model is used as the second embedding value of the replacement string.

[0199] S403: Replace the embedding value of the replacement string in the word segmenter in the text embedding modification model with the second embedding value of the replacement string to obtain the target text embedding model.

[0200] In this step, after obtaining the second embedding value of the replacement string, the server replaces the embedding value of the replacement string in the word segmenter in the text embedding modification model with the second embedding value of the replacement string to obtain the target text embedding model.

[0201] It should be noted that when using the target text embedding model in RAG technology, the user's input question can be processed through the target large language model to obtain the question that replaces the port data item. This question is then input into the target text embedding model to obtain a question vector. The question vector is then matched with the vectors in the knowledge base. The port text data corresponding to the matched vector and the question are combined into a prompt text and input into the first large language model for processing to obtain the corresponding answer.

[0202] It should be noted that after obtaining the target text embedding model, the server can also input the initial port text data into the target large language model to obtain the text data of the replacement port data item. The text data of the replacement port data item is then input into the target text embedding model to obtain the target vector.

[0203] It should be noted that multiple tuning training data sets can be generated, each of which includes the embedding values ​​of the training tags in the target large language model and the text embedding modification model. The true value corresponding to each tuning training data set is the embedding value set by the staff. The neural network model is trained based on the tuning training data to obtain a tuned model. The embedding values ​​of the replacement string in the second large language model and the text embedding modification model are then input into the tuned model to obtain the second embedding value of the replacement string.

[0204] For example, Figure 4b The following is a schematic diagram of the generation process of the target text embedding model provided in this application, such as Figure 4bAs shown, the first language model is processed with a word segmenter and embedding value modification to obtain a third language model. The second language model is processed with a word segmenter and embedding value modification to obtain four language models. The initial text embedding model is processed with a word segmenter and embedding value modification to obtain a modified text embedding model. After obtaining the second training data based on the original port training data, the replacement prompt word information corresponding to each port data item and the second training data are input into the third language model to obtain the target port training data. The target port training data is then used to train the fourth language model to obtain the target language model. According to the embedding value of the replacement string in the second largest language model and the target large language model, the embedding value of each preset benchmark original tag in the second largest language model and the target large language model, the embedding value of each preset benchmark original tag in the initial text embedding model, the embedding value of all first tags in the word segmenter of the initial text embedding model, the embedding value of all second tags in the word segmenter of the second largest language model, and the embedding value of the replacement string in the text embedding modification model, after calculating the second embedding value of the replacement string, the embedding value of the replacement string in the word segmenter in the text embedding modification model is replaced with the second embedding value of the replacement string to obtain the target text embedding model.

[0205] The port text data processing method provided in this embodiment calculates the difference between the embedding values ​​of the replacement string in the second largest language model and the target large language model, calculates the embedding value of the replacement string based on the difference, and then obtains the second embedding value of the replacement string based on the compensation value. Since the target large language model is a model obtained by tuning the second largest language model, the replacement port data item is more accurate and the embedding value therein is also more accurate. The difference in the embedding values ​​can reflect the tuning of the model, so the second embedding value calculated based on the difference in the embedding values ​​is more accurate, thereby improving the accuracy of the text embedding model.

[0206] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0207] Figure 5 This is a schematic diagram of the structure of the embodiment of the port text data processing device provided by this application. Figure 5 As shown, the port text data processing device 50 includes:

[0208] The processing module 51 is configured to:

[0209] Performing word segmentation modification processing on the first language model and the second language model according to the obtained replacement character string corresponding to each port data item to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model;

[0210] For each acquired original port training data, performing data item replacement processing on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data;

[0211] A model training module 52 is used to train the fourth language model according to the training data of each target port to obtain a target language model;

[0212] The vector conversion module 53 is used to process the acquired initial port text data according to the target large language model and text embedding model to obtain a target vector.

[0213] Furthermore, the processing module 51 is specifically configured to:

[0214] The first language model and the second language model are respectively used as models to be modified, and the following processing is performed on the models to be modified:

[0215] Calculate a first embedding value for each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified;

[0216] For each replacement string, storing the replacement string in the word segmenter of the model to be modified, and storing the first embedding value of the replacement string in the model to be modified to obtain a modified model;

[0217] If the model to be modified is the first language model, use the modified model as the third language model;

[0218] If the model to be modified is the second largest language model, the modified model is used as the fourth largest language model.

[0219] Furthermore, the processing module 51 is further configured to:

[0220] For each replacement string, the following processing is performed:

[0221] removing special symbols and separators from the replacement character string to obtain at least one target original tag;

[0222] If the number of target original tokens is equal to 1, the embedding value of the target original token in the word segmenter of the to-be-modified model is used as the first embedding value of the replacement string;

[0223] If the number of target original tokens is greater than 1, a first embedding value of the replacement string is calculated according to the embedding value of each target original token in the word segmenter of the model to be modified.

[0224] Furthermore, the processing module 51 is further configured to:

[0225] Performing number replacement processing on the original port training data according to the port number replacement table to obtain first training data;

[0226] Performing port data item identification processing on the first training data to obtain data items to be replaced;

[0227] replacing the data item to be replaced in the first training data according to a preset correspondence between the data item type and the universal replacement string to obtain second training data;

[0228] The replacement prompt word information corresponding to each port data item and the second training data are input into the third language model to obtain the target port training data.

[0229] Furthermore, the processing module 51 is further configured to:

[0230] According to the replacement string corresponding to each port data item, the initial text embedding model is processed by word segmentation and embedding value modification to obtain a text embedding modification model;

[0231] For each replacement string, the following processing is performed:

[0232] Calculating a target coefficient corresponding to each preset reference original token based on an embedding value of the replacement string in the second large language model and the target large language model, and an embedding value of each preset reference original token in the second large language model and the target large language model;

[0233] Calculate the second embedding value of the replacement string according to the embedding value of each preset reference original token in the initial text embedding model, the target coefficient corresponding to each preset reference original token, the embedding value of all first tokens in the word segmenter of the initial text embedding model, the embedding value of all second tokens in the word segmenter of the second language model, and the embedding value of the replacement string in the text embedding modification model;

[0234] The embedding value of the replacement string in the word segmenter in the text embedding modification model is replaced with the second embedding value of the replacement string to obtain a target text embedding model.

[0235] Furthermore, the processing module 51 is further specifically configured to:

[0236] taking the difference between the embedding values ​​of the replacement character string in the second large language model and the target large language model as the embedding value difference;

[0237] For each preset reference original token, taking the average of the embedding values ​​of the preset reference original token in the second large language model and the target large language model as the embedding average corresponding to the preset reference original token;

[0238] The target coefficient corresponding to each preset reference original mark is calculated according to the embedding value difference and the embedding average value corresponding to each preset reference original mark.

[0239] Furthermore, the processing module 51 is further specifically configured to:

[0240] Calculating an embedding value compensation value of the replacement character string according to the embedding value of each preset reference original token in the initial text embedding model, a target coefficient corresponding to each preset reference original token, the embedding value difference, the embedding value of each first token, and the embedding value of each second token;

[0241] The sum of the embedding value compensation value of the replacement character string and the embedding value of the replacement character string in the text embedding modification model is used as the second embedding value of the replacement character string.

[0242] The port text data processing device provided in this embodiment is used to execute the technical solution in any of the aforementioned method embodiments. Its implementation principles and technical effects are similar and will not be described in detail here.

[0243] Figure 6 This is a schematic diagram of the structure of an electronic device provided by this application. Figure 6 As shown, the electronic device 60 includes:

[0244] Processor 61, memory 62, and communication interface 63;

[0245] The memory 62 is used to store executable instructions of the processor 61;

[0246] The processor 61 is configured to execute the technical solution in any of the aforementioned method embodiments by executing the executable instructions.

[0247] Optionally, the memory 62 can be independent or integrated with the processor 61.

[0248] Optionally, when the memory 62 is a device independent of the processor 61, the electronic device 60 may further include:

[0249] The bus 64 , the memory 62 and the communication interface 63 are connected to the processor 61 via the bus 64 and communicate with each other. The communication interface 63 is used to communicate with other devices.

[0250] Optionally, the communication interface 63 may be implemented using a transceiver. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.

[0251] Bus 64 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the figure uses only one thick line, but this does not imply that there is only one bus or only one type of bus.

[0252] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0253] The electronic device is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principles and technical effects are similar and will not be repeated here.

[0254] An embodiment of the present application further provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the technical solution provided by any of the aforementioned method embodiments.

[0255] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the technical solution provided by any of the aforementioned method embodiments.

[0256] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0257] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A port text data processing method, characterized in that: include: Perform word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement character string corresponding to each port data item, to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model; For each acquired original port training data, performing data item replacement processing on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data; Training the fourth language model according to the training data of each target port to obtain a target language model; Processing the acquired initial port text data according to the target large language model and text embedding model to obtain a target vector; The word segmenter and embedding value modification processing are performed on the first language model and the second language model according to the replacement string corresponding to each port data item obtained to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model, including: The first language model and the second language model are respectively used as models to be modified, and the following processing is performed on the models to be modified: Calculate a first embedding value for each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified; For each replacement string, storing the replacement string in the word segmenter of the model to be modified, and storing the first embedding value of the replacement string in the model to be modified to obtain a modified model; If the model to be modified is the first language model, use the modified model as the third language model; If the model to be modified is the second largest language model, the modified model is used as the fourth largest language model.

2. The method according to claim 1, characterized in that The step of calculating a first embedding value of each replacement string according to the embedding value of the original token in the word segmenter of the model to be modified comprises: For each replacement string, the following processing is performed: removing special symbols and separators from the replacement character string to obtain at least one target original tag; If the number of target original tokens is equal to 1, the embedding value of the target original token in the word segmenter of the to-be-modified model is used as the first embedding value of the replacement string; If the number of target original tokens is greater than 1, a first embedding value of the replacement string is calculated according to the embedding value of each target original token in the word segmenter of the model to be modified.

3. The method according to claim 1, characterized in that The method of performing data item replacement processing on the original port training data based on the obtained port number replacement table, the replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data includes: Performing number replacement processing on the original port training data according to the port number replacement table to obtain first training data; Performing port data item identification processing on the first training data to obtain data items to be replaced; replacing the data item to be replaced in the first training data according to a preset correspondence between the data item type and the universal replacement string to obtain second training data; The replacement prompt word information corresponding to each port data item and the second training data are input into the third language model to obtain the target port training data.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: According to the replacement string corresponding to each port data item, the initial text embedding model is processed by word segmentation and embedding value modification to obtain a text embedding modification model; For each replacement string, the following processing is performed: Calculating a target coefficient corresponding to each preset reference original token based on an embedding value of the replacement string in the second large language model and the target large language model, and an embedding value of each preset reference original token in the second large language model and the target large language model; Calculate the second embedding value of the replacement string according to the embedding value of each preset reference original token in the initial text embedding model, the target coefficient corresponding to each preset reference original token, the embedding value of all first tokens in the word segmenter of the initial text embedding model, the embedding value of all second tokens in the word segmenter of the second language model, and the embedding value of the replacement string in the text embedding modification model; The embedding value of the replacement string in the word segmenter in the text embedding modification model is replaced with the second embedding value of the replacement string to obtain a target text embedding model.

5. The method according to claim 4, characterized in that Calculating a target coefficient corresponding to each preset reference original token based on the embedding value of the replacement string in the second large language model and the target large language model, and the embedding value of each preset reference original token in the second large language model and the target large language model, includes: taking the difference between the embedding values ​​of the replacement character string in the second large language model and the target large language model as the embedding value difference; For each preset reference original token, taking the average of the embedding values ​​of the preset reference original token in the second large language model and the target large language model as the embedding average corresponding to the preset reference original token; The target coefficient corresponding to each preset reference original mark is calculated according to the embedding value difference and the embedding average value corresponding to each preset reference original mark.

6. The method according to claim 5, characterized in that The method calculates the second embedding value of the replacement string according to the embedding value of each preset reference original token in the initial text embedding model, the target coefficient corresponding to each preset reference original token, the embedding value of all first tokens in the word segmenter of the initial text embedding model, the embedding value of all second tokens in the word segmenter of the second language model, and the embedding value of the replacement string in the text embedding modification model, including: Calculating an embedding value compensation value of the replacement character string according to the embedding value of each preset reference original token in the initial text embedding model, a target coefficient corresponding to each preset reference original token, the embedding value difference, the embedding value of each first token, and the embedding value of each second token; The sum of the embedding value compensation value of the replacement character string and the embedding value of the replacement character string in the text embedding modification model is used as the second embedding value of the replacement character string.

7. A port text data processing device, characterized in that: include: Processing module for: Perform word segmentation and embedding value modification processing on the first language model and the second language model according to the replacement character string corresponding to each port data item, to obtain a third language model corresponding to the first language model and a fourth language model corresponding to the second language model; For each acquired original port training data, performing data item replacement processing on the original port training data according to the acquired port number replacement table, replacement prompt word information corresponding to each port data item, and the third language model to obtain target port training data; A model training module, configured to train the fourth language model according to the training data of each target port to obtain a target language model; A vector conversion module, configured to process the acquired initial port text data according to the target large language model and the text embedding model to obtain a target vector; The processing module is specifically configured to use the first large language model and the second large language model as models to be modified, and perform the following processing on the models to be modified: Calculate a first embedding value for each replacement string based on the embedding value of the original token in the word segmenter of the model to be modified; For each replacement string, storing the replacement string in the word segmenter of the model to be modified, and storing the first embedding value of the replacement string in the model to be modified to obtain a modified model; If the model to be modified is the first language model, use the modified model as the third language model; If the model to be modified is the second largest language model, the modified model is used as the fourth largest language model.

8. An electronic device, characterized in that: include: Processor, memory, communication interface; The memory is used to store executable instructions of the processor; Wherein, the processor is configured to execute the port text data processing method according to any one of claims 1 to 6 by executing the executable instructions.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the port text data processing method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Text processing method and device, electronic equipment and readable storage medium

    CN111008528A

  • Method and device for processing prompt words of language model, equipment and storage medium

    CN117217191A