Freight lading bill information extraction and error-making method and device based on natural language processing

Extracting and screening freight bill of lading information through natural language processing technology solves the problems of low recognition accuracy and high manpower investment in the existing technology, achieves efficient information extraction and automatic error screening, and reduces costs.

CN118629048AInactive Publication Date: 2024-09-10HANGZHOU WEISI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410618131.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-09-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The accuracy of identifying freight bill of lading information in the existing technology is low, resulting in a large amount of manpower investment to modify the identification results and review judgments, which is inefficient and costly.

Method used

Using a method based on natural language processing, by obtaining and identifying the file format type of the freight bill of lading, selecting the corresponding text extraction method, using the bill of lading sample parsing model to extract field information, and using the information error detection model for rule verification, replacing manual automatic Zhen Wrong.

Benefits of technology

It improves the accuracy of information extraction, reduces the labor cost of error screening, and reduces labor investment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118629048A
    Figure CN118629048A
Patent Text Reader

Abstract

The invention relates to the technical field of freight lading bill processing, solves the problems that in the prior art, the information identification accuracy is low, and the human resource input in the error making process of the extracted information is large, and discloses a freight lading bill information extraction and error making method and device based on natural language processing. The method comprises the steps of obtaining and identifying a file format type of a to-be-processed freight lading bill, performing text extraction, performing text analysis by using a lading bill sample analysis model, and finally performing rule verification on extracted fields and corresponding field information by using an information error model to obtain a freight lading bill file. According to the method, the lading bill sample information text is understood, the fields and the corresponding field information are extracted, and the specified field information can be directly extracted without depending on coordinate information, so that the accuracy of information extraction can be greatly improved, and error making of the extracted information can be automatically completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of freight bill processing, and in particular to a method and device for extracting and detecting freight bill information based on natural language processing. Background Art

[0002] In the cross-border trade and transportation industry, the owner needs to entrust the goods to the freight forwarding company, and the freight forwarding company then entrusts the goods to the transportation company for shipment, such as entrusting the shipping company, air transport company, and land transport company. When the goods begin to be transported, the owner needs to submit the detailed information of the goods in writing to the freight forwarding system (this document is the bill of lading sample). After receiving the bill of lading sample, the freight forwarding system needs to extract the information in the bill of lading sample, and then notify the employees to review and determine whether the information meets the requirements of each transportation company. When all the information meets the requirements of the transportation company, the freight forwarding staff needs to fill in the information in the transportation company's website form. Each transportation company may have different requirements or rules for the information in the bill of lading sample at each destination port around the world. Therefore, when the information that does not meet the requirements or rules is identified and filled in, when the goods are transported to the destination, the owner cannot pick up the goods normally, which will cause a lot of economic losses.

[0003] Therefore, when the results of identification and extraction are not accurate enough, a lot of manpower is required to modify the identification results. At the same time, a lot of manpower is also required to review and judge whether the information meets the rules or requirements of the transportation company.

[0004] Of course, some existing technologies also rely on OCR recognition to identify and extract fields from freight bill samples. In this method, the core field recognition and extraction uses traditional OCR recognition. However, in actual freight business, the personal habits of the person who makes the bill result in the style of the freight bill being non-fixed. Therefore, the coordinate information of the fields in each freight bill sample in the bill is also non-fixed. In addition, the information data length corresponding to the fields that need to be identified and extracted in each bill sample is different, resulting in different coordinates of the fields in each bill sample. Even if the OCR model is tuned through a large amount of freight bill sample training data, the OCR model will still have a large number of errors when performing text positioning and area segmentation at work, and the recognition accuracy is low. Therefore, in addition to the low recognition accuracy, the OCR recognition method in the existing technology relies entirely on manpower input for comparison and error identification when identifying errors in the recognition results, which is inefficient and requires a large amount of manpower cost. Summary of the invention

[0005] The purpose of this application is to overcome the problems of low accuracy of information recognition in the prior art and large human resources invested in the process of error screening of the extracted information, and to provide a method and device for extracting and screening freight bill information based on natural language processing.

[0006] In the first aspect, a method for extracting and detecting freight bill of lading information based on natural language processing is provided, comprising:

[0007] Obtaining a freight bill of lading to be processed, and identifying a file format type of the freight bill of lading to be processed;

[0008] Select the corresponding text extraction method according to the file format type to extract the text of the freight bill of lading to be processed;

[0009] Parse the extracted text using the bill of lading sample parsing model to obtain the fields and corresponding field information in the freight bill of lading to be processed;

[0010] The information error detection model is used to perform rule verification on the acquired fields and the corresponding field information. Rule verification means that the information error detection model detects the fields and the corresponding field information through training the acquired text understanding and logical reasoning ability, and marks the identified erroneous fields and the corresponding field information to obtain the final information recognition result.

[0011] In some possible implementations, a corresponding text extraction method is selected according to the file format type to extract text from the freight bill of lading to be processed, including:

[0012] If the file format of the freight bill to be processed is PDF, extract the text through the PyMuPDF library, or

[0013] If the file format of the freight bill to be processed is word, extract the text through the pypandoc library, or

[0014] If the file format type of the freight bill to be processed is Excel, extract the text through the openpyxl library, or

[0015] If the file format type of the freight bill to be processed is an image, the text is extracted through a third-party OCR service.

[0016] In some possible implementations, after selecting a corresponding text extraction method according to the file format type to extract text from the freight bill of lading to be processed, the extracted text is converted into .md text and input into the bill of lading sample parsing model.

[0017] In some possible implementations, the construction of the bill of lading sample parsing model includes:

[0018] Get the .md text of the historical freight bill of lading sample;

[0019] Format the .md text;

[0020] Perform data annotation on the formatted .md text, and divide the annotated data into the first training set, the first validation set, and the first test set;

[0021] The first base model is fine-tuned using the first training set, and the fine-tuned first base model is verified and tested using the first verification set and the first test set to obtain a bill of lading sample parsing model, wherein the first base model is the ChatGLM3-6B-Base model.

[0022] In some possible implementations, the fields include at least one of the following fields: shipper, consignee, bill of lading number, port of departure, port of destination, means of transport, transportation terms, freight terms, bill of lading notes, cargo information, customs code, transport packaging mark and packaging type.

[0023] In some possible implementations, after the extracted text is parsed using the bill of lading sample parsing model, the acquired fields and corresponding field information are converted into JSON data format and input into the information error detection model.

[0024] In some possible implementations, the construction of the information error detection model includes:

[0025] Get the fields in JSON data format and the corresponding field information;

[0026] Annotating the fields and corresponding field information, and dividing the annotated data into a second training set, a second validation set, and a second test set;

[0027] The second base model is fine-tuned using the second training set, and the fine-tuned second base model is verified and tested using the second verification set and the second test set to obtain an information error detection model, wherein the second base model is the ChatGLM3-6B-Base model.

[0028] In a second aspect, a freight bill of lading information extraction and error detection device based on natural language processing is provided, comprising:

[0029] An acquisition module, used for acquiring a freight bill of lading to be processed and identifying a file format type of the freight bill of lading to be processed;

[0030] A text extraction module, used for selecting a corresponding text extraction method according to the file format type to extract text from the freight bill of lading to be processed;

[0031] An information extraction module is used to parse the extracted text using the bill of lading sample parsing model to obtain the fields and corresponding field information in the freight bill of lading to be processed;

[0032] The information error detection module is used to use the information error detection model to perform rule verification on the acquired fields and corresponding field information to obtain the final information recognition result.

[0033] In a third aspect, a computer-readable storage medium is provided, wherein the computer-readable medium stores a program code for execution by a device, wherein the program code includes steps for executing the method in any one of the implementations of the first aspect described above.

[0034] In a fourth aspect, an electronic device is provided, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements a method as in any one of the implementations in the first aspect above.

[0035] The present application has the following beneficial effects: the present application adopts large language model technology to extract bill of lading sample information, and the bill of lading sample parsing model can understand the bill of lading sample information text and extract fields and corresponding field information. It can directly extract the specified field information without relying on coordinate information, thereby greatly improving the accuracy of information extraction. In addition, an information error detection model with text understanding and logical reasoning capabilities is used to replace manual automatic error detection of the extracted information, thereby greatly reducing the labor cost in the error detection link. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 is a flow chart of a method for extracting and detecting freight bill information based on natural language processing according to Example 1 of the present application;

[0039] Figure 2 It is a flowchart of text extraction in the freight bill of lading information extraction and error detection method based on natural language processing in Example 1 of the present application;

[0040] Figure 3 It is a flowchart of text parsing in the freight bill of lading information extraction and error detection method based on natural language processing in Example 1 of the present application;

[0041] Figure 4 It is a structural block diagram of ChatGLM3-6B in the freight bill of lading information extraction and error detection method based on natural language processing in Example 1 of the present application;

[0042] Figure 5 It is a flowchart of constructing a bill of lading sample parsing model in the freight bill of lading information extraction and error detection method based on natural language processing in Example 1 of the present application;

[0043] Figure 6 It is a flowchart of constructing an information error detection model in the freight bill of lading information extraction and error detection method based on natural language processing in Example 1 of the present application;

[0044] Figure 7 It is a structural block diagram of a freight bill of lading information extraction and error detection device based on natural language processing according to Example 2 of the present application;

[0045] Figure 8 It is a schematic diagram of the internal structure of the electronic device of Example 4 of the present application.

[0046] Reference numerals:

[0047] 100, acquisition module; 200, text extraction module; 300, information extraction module; 400, information error detection module. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Example 1

[0050] A method for extracting and correcting freight bill information based on natural language processing involved in Example 1 of the present application includes: obtaining a freight bill to be processed and identifying the file format type of the freight bill to be processed; selecting a corresponding text extraction method to extract text from the freight bill to be processed according to the file format type; parsing the extracted text using a bill of lading sample parsing model to obtain fields and corresponding field information in the freight bill to be processed; and performing rule verification on the obtained fields and corresponding field information using an information correction model to obtain a final information recognition result. The method can directly extract specified field information without relying on coordinate information, thereby greatly improving the accuracy of information extraction. In addition, using an information correction model with text understanding and logical reasoning capabilities to replace manual automatic correction of the extracted information can greatly reduce the labor cost in the correction link.

[0051] Specifically, Figure 1 A flowchart of a method for extracting and identifying freight bill of lading information based on natural language processing in application embodiment 1 is shown, including:

[0052] S100, obtaining a freight bill of lading to be processed, and identifying a file format type of the freight bill of lading to be processed;

[0053] Specifically, in this embodiment, the pending freight bills of lading in word\excel\pdf\png\jpg\rtf\jpeg formats are supported, and the file signature, also known as the magic number, is used to determine the file format type of the pending freight bills of lading. The principle of the file signature is to obtain a specific byte sequence stored at the beginning of the file, which can be used to identify and verify the format and content type of the file. Because these signatures are usually defined by the developers of the file format, they are specified in the file format standard, and the purpose is to enable the software to easily identify and confirm the file format type of the file, even if the file extension is changed, the file format type of the file can still be determined.

[0054] Table 1 below shows an example of a freight bill of lading to be processed:

[0055] Table 1: Example of a freight bill to be processed

[0056]

[0057] S200, selecting a corresponding text extraction method according to the file format type to extract text from the freight bill of lading to be processed;

[0058] Specifically, Figure 2 As shown, for pdf, word, and excel files, this embodiment uses python programming to extract the content in the file and output it in .md format:

[0059] For example, the pdf file is implemented using the PyMuPDF library in Python combined with the markdownify library, that is, the PyMuPDF library is responsible for extracting the text in the pdf, and markdownify is responsible for converting the extracted text into .md format text.

[0060] For example, word files are extracted using the pypandoc library in python to extract the text in the Word document and convert it into Markdown format. The Markdown format is essentially the .md format, and they both refer to plain text files written in Markdown syntax.

[0061] For example, if the excel file is used, the openpyxl library is used to traverse the data in the excel file and convert it into Markdown format.

[0062] For example, for image type files, this embodiment uses the OCR service capability of the cloud vendor to upload the image to the third-party OCR service through the interface, and then the interface returns the recognized .md text;

[0063] For example, a partial example of the recognized .md text:

[0064] SCANDINAVIAN STEEL AB\

[0065] CHROME METAL\

[0066] LOT NO\uc0\u65306 239114092 / 094 / 118 / 087 / 106 / 107\

[0067] / 133 / 134\

[0068] NET WEIGHT 250KG\

[0069] P23-20390-115\

[0070] \uc0\u21697\u21517\u65306\

[0071] CHROME METAL\

[0072] 80DRUMS ON 20PALLETS\

[0073] HS CODE 6\uc0\u20301\

[0074] 8112210000\

[0075] \uc0\u36816\u36153\u26465\u27454\u65306 FREIGHT PREPAID\

[0076] \uc0\u20986\u21333\u31867\u22411\.

[0077] S300, parsing the extracted text using a bill of lading sample parsing model to obtain fields in the freight bill of lading to be processed and corresponding field information;

[0078] Specifically, Figure 3As shown, in step S200, the information in the .md text has been extracted. The .md text extracted in step S200 is input into the bill of lading sample parsing model for parsing to obtain the fields in the freight bill of lading to be processed and the corresponding field information, wherein the fields include the shipper, consignee, bill of lading number, port of departure, port of destination, means of transport, transportation terms, freight terms, bill of lading remarks, cargo information (cargo information includes "goodsDesc": cargo description or name, "grossWeight": weight, "volume": volume, etc.), customs code, transport packaging mark and packaging type, etc.

[0079] In a further embodiment, in order to improve the performance and accuracy of the information error detection model, it is also necessary to convert the fields extracted by the bill of lading sample parsing model and the corresponding field information into JSON data format, for example:

[0080] {

[0081] "pol":"Shanghai",

[0082] "pod":"ROTTERDAM",

[0083] "targetLocation":null,

[0084] "'vessel":"EVER ALOT",

[0085] "voyage":"V.1273-006W"

[0086] "shipperAddress":"SICHUAN MINGHONG HENGZHENG TECHNOLOGY CO.LTDINDUSTRIAL PARK,HUAGAI TOWN,ANZHOU DISTRICT,MIANYANG CITY,SICHUAN PROVINCE,CHINA"

[0087] "consigneeAddress":"SCANDINAVIAN STEEL AB KUNGSATAN4B S-11143STOCKHOLM SWEDEN",

[0088] "notifyAddress":"EURO-RIJN GLOBAL LOGISTICS BV.PLAZA,NL4782SKMOERDIJKNL-4780AB MOERDIJK TEL:+31-168392255ATTN:ANOUK",

[0089] "bINo":"EGLV142303022976",

[0090] "marks":"SCANDINAVIAN STEEL AB CHROME METAL LOT NO:239114092 / 094 / 118 / 087 / 106 / 107 / 133 / 134NET WEIGHT250 KGP23-20390-115",

[0091] "quantity":"80",

[0092] "goodsDesc":"CHROME METAL",

[0093] "grossWeight":"20780KGS",

[0094] "volume":"20CBM"

[0095] "hscode":"8112210000",

[0096] "containerNo":"EITU0369749",

[0097] "sealNo":"EMCMFP2283",

[0098] "packageType":"DRUMS",

[0099] "transportTerm":null,

[0100] 'freightTerm":"FREIGHT PREPAID",

[0101] "releaseMode":"ORIGINAL",

[0102] "remark": "France does not accept PLT",

[0103] "originalNum":null

[0104] }.

[0105] In the above embodiment, the core module is the bill of lading sample parsing model. The bill of lading sample parsing model base in this embodiment uses the open source ChatGLM3-6B model. The ChatGLM3-6B model is privately deployed for training and fine-tuning, and finally a task model that can execute bill of lading sample parsing, identification and extraction is obtained.

[0106] It should be noted that the ChatGLM3-6B model is an open source model in the ChatGLM3 series. While retaining many excellent features of the previous two generations of models, such as smooth conversations and low deployment thresholds, the ChatGLM3-6B model introduces the following features: 1. A more powerful basic model; 2. More complete functional support; 3. A more comprehensive open source sequence.

[0107] The basic model of the ChatGLM3-6B model, ChatGLM3-6B-Base, uses more diverse training data, more sufficient training steps and more reasonable training strategies. Evaluations on data sets from different angles, such as semantics, mathematics, reasoning, code, and knowledge, show that ChatGLM3-6B-Base has the strongest performance among basic models below 10B. It ranks first in China in the test of 44 Chinese and English public data sets. The structure of the ChatGLM3-6B model is shown in Figure 4.

[0108] like Figure 5 As shown, the construction of the bill of lading sample parsing model includes: collecting historical bill of lading samples, formatting the sample content, and annotating the formatted text. The annotated data is put into the model training platform as a training data set to train and fine-tune the base model (ChatGML), and then verified and tested with the validation set and test set data to finally obtain a bill of lading sample parsing model that can be used in business scenarios.

[0109] Specifically, in this embodiment, the training set samples and test samples used in the bill of lading sample parsing model are derived from the bill of lading samples actually used by 93 freight forwarding companies. The construction process of the bill of lading sample parsing model is as follows:

[0110] 1) The 93 cooperating freight forwarding companies serve more than 100,000 end customers, so the bill of lading samples used in this embodiment cover a wide area, ensuring the diversity and authenticity of the samples.

[0111] 2) In this embodiment, a total of 516,153 freight bill samples were collected, of which the formats of the freight bill samples included: word, excel, pdf, png, jpg, tiff. 397,514 were randomly selected as training set samples, 58,722 were randomly selected as validation set samples, and the remaining 59,917 were used as test set samples. The large total number of samples ensures the accuracy of the bill of lading sample parsing model.

[0112] 3) After collecting the freight bill samples for training, the freight bill samples need to be processed into text according to the method in step S200, and then the formatted text is submitted to the data annotation platform for annotation. The example of the annotated data is as follows:

[0113]

[0114]

[0115]

[0116]

[0117] 4) The annotated data is used as a training data set and put into the model training platform to train and fine-tune the base model (ChatGML). After verification and testing with the annotated validation set and test set data, multiple feedback and optimization are performed to finally obtain a bill of lading sample parsing model that can be used in business scenarios.

[0118] S400. Use the information error detection model to perform rule verification on the acquired fields and the corresponding field information. Rule verification means that the information error detection model detects the fields and the corresponding field information through training the acquired text understanding and logical reasoning ability, and marks the identified erroneous fields and the corresponding field information to obtain the final information recognition result.

[0119] Specifically, after the extracted text is parsed using the bill of lading sample parsing model, the acquired fields and corresponding field information are converted into JSON data format and input into the information error detection model, which will determine whether the value corresponding to each field in the JSON data complies with the rules. The complete JSON structure result is output, and the entire process of freight bill of lading information extraction and error detection based on natural language processing is completed.

[0120] In the above embodiment, the core module is the information error detection model. The information error detection model base in this embodiment also uses the open source ChatGLM3-6B model. The ChatGLM3-6B model is privately deployed for training and fine-tuning, and finally a task model that can execute bill of lading sample parsing, recognition and extraction is obtained.

[0121] like Figure 6 As shown, the construction of the information error detection model includes: obtaining fields and corresponding field information in JSON data format; annotating the fields and corresponding field information, and dividing the annotated data into a second training set, a second validation set, and a second test set; using the second training set to fine-tune the ChatGLM3-6B model, and verifying and testing the fine-tuned ChatGLM3-6B model through the second validation set and the second test set to obtain the information error detection model.

[0122] It should be noted that in this embodiment, the data collection used for information error detection model training is to collect JSON data converted from the output data of the bill of lading sample parsing model, and then the collected JSON data is annotated, and the ChatGLM3-6B model is trained and fine-tuned in the same way as the bill of lading sample parsing model training to obtain the information error detection model.

[0123] For example, the annotated JSON data is as follows:

[0124]

[0125]

[0126]

[0127]

[0128] Taking ocean shipping as an example, the main factors affecting the cut-off rules come from different shipping companies and different destination ports. In the same port, different shipping companies may have different rules and requirements for each field in the bill of lading. The same shipping company may also have different rules and requirements for each field in the bill of lading in different ports. Therefore, the rules and requirements for each field in the bill of lading of all shipping companies in ports around the world are enumerated. Taking ONE as an example, this is the cut-off rule table of ONE in global ports. The data in the rule table in Table 2 below will be used as the basic knowledge of the error detection model:

[0129]

[0130]

[0131] The input data examples of the information error detection model are:

[0132]

[0133] The output of the error detection model based on the above input data information is:

[0134]

[0135]

[0136]

[0137]

[0138] In this embodiment, the large language model technology is used to extract the bill of lading sample information. The bill of lading sample parsing model can understand the bill of lading sample information text and extract the fields and corresponding field information. The specified field information can be directly extracted without relying on coordinate information, thereby greatly improving the accuracy of information extraction. In addition, an information error detection model with text understanding and logical reasoning capabilities is used to replace manual automatic error detection of the extracted information, thereby greatly reducing the labor cost in the error detection link.

[0139] Example 2

[0140] like Figure 7 As shown, a freight bill of lading information extraction and error detection device based on natural language processing involved in Example 2 of the present application includes:

[0141] The acquisition module 100 is used to acquire the freight bill of lading to be processed and identify the file format type of the freight bill of lading to be processed;

[0142] A text extraction module 200, for selecting a corresponding text extraction method according to the file format type to extract text from the freight bill to be processed;

[0143] The information extraction module 300 is used to parse the extracted text using the bill of lading sample parsing model to obtain the fields and corresponding field information in the freight bill of lading to be processed;

[0144] The information error detection module 400 is used to perform rule verification on the acquired fields and corresponding field information using the information error detection model to obtain the final information recognition result.

[0145] It should be noted that, for other specific implementations of the freight bill of lading information extraction and error detection device based on natural language processing in the embodiment of the present invention, reference can be made to the specific implementations of the freight bill of lading information extraction and error detection method based on natural language processing mentioned above, which will not be repeated here to avoid redundancy.

[0146] Example 3

[0147] A computer-readable storage medium according to Embodiment 3 of the present application, wherein the computer-readable storage medium stores a program code for execution by a device, wherein the program code includes steps for executing a method in any one of the implementations in Embodiment 1 of the present application;

[0148] Among them, the computer-readable storage medium can be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM); the computer-readable storage medium can store program code, and when the program stored in the computer-readable storage medium is executed by the processor, the processor is used to execute the steps of the method in any one of the implementation methods in Example 1 of the present application.

[0149] Example 4

[0150] like Figure 8 As shown, an electronic device involved in Embodiment 4 of the present application includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, and when the program or instruction is executed by the processor, a method in any one of the implementations in Embodiment 1 of the present application is implemented;

[0151] Among them, the processor can adopt a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits to execute relevant programs to implement the method in any one of the implementation methods in Example 1 of the present application.

[0152] The processor may also be an integrated circuit electronic device with signal processing capability. In the implementation process, each step of the method in any implementation of Embodiment 1 of the present application may be completed by an integrated logic circuit of hardware in the processor or by instructions in software form.

[0153] The above-mentioned processor may also be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the functions required to be performed by the unit included in the data processing device of the embodiment of the present application in combination with its hardware, or executes the method in any one of the implementation modes in the embodiment 1 of the present application.

[0154] The above are only preferred specific implementations of the present application; however, the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solution and its improved ideas of the present application within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for extracting and correcting freight bill information based on natural language processing, characterized in that: include: Obtaining a freight bill of lading to be processed, and identifying a file format type of the freight bill of lading to be processed; Select the corresponding text extraction method according to the file format type to extract the text of the freight bill of lading to be processed; Parse the extracted text using the bill of lading sample parsing model to obtain the fields and corresponding field information in the freight bill of lading to be processed; The information error detection model is used to perform rule verification on the acquired fields and corresponding field information to obtain the final information recognition result.

2. The method for extracting and correcting freight bill information based on natural language processing according to claim 1 is characterized in that: Select the appropriate text extraction method based on the file format type to extract text from the freight bill of lading to be processed, including: If the file format of the freight bill to be processed is PDF, extract the text through the PyMuPDF library, or If the file format of the freight bill to be processed is word, extract the text through the pypandoc library, or If the file format type of the freight bill to be processed is Excel, extract the text through the openpyxl library, or If the file format type of the freight bill to be processed is an image, the text is extracted through a third-party OCR service.

3. The method for extracting and correcting freight bill information based on natural language processing according to claim 1 is characterized in that: After selecting the corresponding text extraction method according to the file format type to extract the text of the freight bill of lading to be processed, the extracted text is converted into .md text and input into the bill of lading sample parsing model.

4. The method for extracting and correcting freight bill information based on natural language processing according to claim 3 is characterized in that: The construction of the bill of lading sample parsing model includes: Get the .md text of the historical freight bill of lading sample; Format the .md text; Perform data annotation on the formatted .md text, and divide the annotated data into the first training set, the first validation set, and the first test set; The first base model is fine-tuned using the first training set, and the fine-tuned first base model is verified and tested using the first verification set and the first test set to obtain a bill of lading sample parsing model, wherein the first base model is the ChatGLM3-6B model.

5. The method for extracting and correcting freight bill information based on natural language processing according to claim 1 is characterized in that: The fields include at least one of the following fields: consignor, consignee, bill of lading number, port of departure, port of destination, means of transport, transportation terms, freight terms, bill of lading remarks, cargo information, customs code, transport packaging mark and packaging type.

6. The method for extracting and correcting freight bill information based on natural language processing according to claim 1 is characterized in that: After parsing the extracted text using the bill of lading sample parsing model, the acquired fields and corresponding field information are converted into JSON data format and input into the information error detection model.

7. The method for extracting and correcting freight bill information based on natural language processing according to claim 6 is characterized in that: The construction of the information error detection model includes: Get the fields in JSON data format and the corresponding field information; Annotating the fields and corresponding field information, and dividing the annotated data into a second training set, a second validation set, and a second test set; The second base model is fine-tuned using the second training set, and the fine-tuned second base model is verified and tested using the second verification set and the second test set to obtain an information error detection model, wherein the second base model is the ChatGLM3-6B model.

8. A freight bill of lading information extraction and error detection device based on natural language processing, characterized in that: include: An acquisition module, used for acquiring a freight bill of lading to be processed and identifying a file format type of the freight bill of lading to be processed; A text extraction module, used for selecting a corresponding text extraction method according to the file format type to extract text from the freight bill of lading to be processed; An information extraction module is used to parse the extracted text using the bill of lading sample parsing model to obtain the fields and corresponding field information in the freight bill of lading to be processed; The information error detection module is used to use the information error detection model to perform rule verification on the acquired fields and corresponding field information to obtain the final information recognition result.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program code for execution by a device, wherein the program code includes steps for executing the method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: The electronic device includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction implements the method according to any one of claims 1 to 7 when executed by the processor.

Citation Information

Patent Citations

  • Document automatic translation method

    CN109783826A

  • Financial text formula extraction method and device based on neural semantic analysis

    CN113254581A

  • Data screening method, system, equipment and storage medium

    CN113780418A

  • Insurance policy information processing method and system, electronic equipment and storage medium

    CN115100670A