Natural language analysis method and system based on data stream
By performing tree structure processing and model sentence segmentation on the data stream, combined with phrase type and weight value mapping, the problem of high energy consumption and slow operation of natural language analysis algorithms in massive data stream processing is solved, and more efficient sentence meaning recognition is achieved. .
Patent Information
- Application Number
- CN202111461882.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-02
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-12-02
AI Technical Summary
Existing natural language analysis algorithms have problems of high energy consumption and slow operation when processing massive data streams, and they need to be improved by appropriately processing the data streams.
By appropriately processing the data stream, convert it into a tree-structured vector sequence, input the syntax model for sentence segmentation, obtain word components, and input the semantic analysis model one by one, combined with the preset mapping relationship between phrase types and weight values, to identify Come up with new sentence meanings.
It improves the efficiency and accuracy of natural language analysis, can identify the meaning of sentences in data streams, reduces energy consumption and increases processing speed.
Smart Images

Figure CN114254631B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network multimedia, and in particular to a natural language analysis method and system based on data stream orientation. Background Art
[0002] When facing massive data streams, existing natural language analysis algorithms will have problems such as high energy consumption and slow operation, and it is necessary to improve the existing natural language analysis algorithms. The data stream needs to be properly processed first, and how to improve it is also a problem that technicians in this field need to consider.
[0003] Therefore, there is an urgent need for a targeted method and system for natural language analysis based on data streams. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for natural language analysis based on data stream, by appropriately processing the data stream, converting it into a form more suitable for natural language, and assigning it to a structured vector sequence according to a tree structure, inputting it into a syntactic model for sentence segmentation to obtain a first word component, inputting the first word component one by one into a semantic analysis model to obtain a second word component, and composing a new sentence according to a pre-set mapping relationship between phrase type and weight value, so that the meaning of the new sentence can be identified.
[0005] In a first aspect, the present application provides a natural language analysis method based on data stream orientation, the method comprising:
[0006] Acquire a network data stream, extract the carried sentences and additional element information therefrom, wherein the additional element information refers to an identifier used to distinguish different sentences and different sources, map the sentences and additional element information into data of string type attributes respectively, and vectorize them to obtain a first vector sequence;
[0007] The first vector sequences are sequentially assigned to the tree structure in a head-to-tail order, with the vector sequences corresponding to the additional element information being located at the subleafs of the vector sequences corresponding to the statements from the same source, to obtain a tree-structured second vector sequence;
[0008] Inputting the second vector sequence into a syntactic model to perform preliminary sentence segmentation to obtain a first word component, wherein the syntactic model sets extraction windows of different widths according to each word type, and uses the extraction window as a sentence segmentation basis, and the words within the window width constitute the first word component;
[0009] Input the first word component into the semantic analysis model one by one. If the first word component can still be identified as a short sentence, it is determined that the initial segmentation of the first word component is unsuccessful, and the first word component needs to be input into the syntactic model again to be segmented again to obtain a second word component. If the first word component cannot be identified as a short sentence but is identified as a phrase, it is determined that the initial segmentation of the first word component is successful, and the first word component is directly identified as the second word component. The phrase consists of a plurality of words and has no syntactic structure.
[0010] Repeating inputting the second word components into the semantic analysis model one by one until each second word component is determined to be preliminarily segmented successfully;
[0011] According to the preset mapping relationship between phrase type and weight value, the second word components after all preliminary sentence segmentation are analyzed, the second word components with weight values greater than the threshold are clustered to form a new sentence, and the meaning of the new sentence is identified.
[0012] In combination with the first aspect, in a first possible implementation of the first aspect, setting extraction windows of different widths according to each word type includes updating the type of the word and establishing a corresponding relationship between the new word type and the extraction window width.
[0013] In combination with the first aspect, in a second possible implementation of the first aspect, the semantic analysis model performs semantic analysis according to sentence grammatical requirements.
[0014] In combination with the first aspect, in a third possible implementation of the first aspect, the kernels of the semantic analysis model and the syntactic model both use a neural network model.
[0015] In a second aspect, the present application provides a system based on data stream-oriented natural language analysis, the system comprising a processor and a memory:
[0016] The memory is used to store program code and transmit the program code to the processor;
[0017] The processor is used to execute any one of the four possible methods of the first aspect according to the instructions in the program code.
[0018] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute any one of the four possible methods in the first aspect.
[0019] The present invention provides a method and system for natural language analysis based on data stream, which converts the data stream into a form more suitable for natural language by appropriately processing the data stream, and assigns a structured vector sequence according to a tree structure, which is input into a syntactic model for sentence segmentation to obtain a first word component, and the first word component is input into a semantic analysis model one by one to obtain a second word component, and a new sentence is composed according to a mapping relationship between a pre-set phrase type and a weight value, so that the meaning of the new sentence can be identified. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 Flow chart of the method of the present invention. DETAILED DESCRIPTION
[0022] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.
[0023] Figure 1 The flowchart of the method for data stream-oriented natural language analysis provided in this application includes:
[0024] Acquire a network data stream, extract the carried sentences and additional element information therefrom, wherein the additional element information refers to an identifier used to distinguish different sentences and different sources, map the sentences and additional element information into data of string type attributes respectively, and vectorize them to obtain a first vector sequence;
[0025] The first vector sequences are sequentially assigned to the tree structure in a head-to-tail order, with the vector sequences corresponding to the additional element information being located at the subleafs of the vector sequences corresponding to the statements from the same source, to obtain a tree-structured second vector sequence;
[0026] Inputting the second vector sequence into a syntactic model to perform preliminary sentence segmentation to obtain a first word component, wherein the syntactic model sets extraction windows of different widths according to each word type, and uses the extraction window as a sentence segmentation basis, and the words within the window width constitute the first word component;
[0027] Input the first word component into the semantic analysis model one by one. If the first word component can still be identified as a short sentence, it is determined that the initial segmentation of the first word component is unsuccessful, and the first word component needs to be input into the syntactic model again to be segmented again to obtain a second word component. If the first word component cannot be identified as a short sentence but is identified as a phrase, it is determined that the initial segmentation of the first word component is successful, and the first word component is directly identified as the second word component. The phrase consists of a plurality of words and has no syntactic structure.
[0028] Repeating inputting the second word components into the semantic analysis model one by one until each second word component is determined to be preliminarily segmented successfully;
[0029] According to the preset mapping relationship between phrase type and weight value, the second word components after all preliminary sentence segmentation are analyzed, the second word components with weight values greater than the threshold are clustered to form a new sentence, and the meaning of the new sentence is identified.
[0030] In some preferred embodiments, setting extraction windows of different widths according to each word type includes updating the word type and establishing a corresponding relationship between the new word type and the extraction window width.
[0031] In some preferred embodiments, the semantic analysis model performs semantic analysis according to sentence grammatical requirements.
[0032] In some preferred embodiments, the kernels of the semantic analysis model and the syntactic model both use neural network models.
[0033] The present application provides a system based on data stream-oriented natural language analysis, the system comprising: the system comprising a processor and a memory:
[0034] The memory is used to store program code and transmit the program code to the processor;
[0035] The processor is used to execute the method described in any one of all embodiments of the first aspect according to the instructions in the program code.
[0036] The present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the method described in any one of the embodiments of the first aspect.
[0037] In a specific implementation, the present invention further provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment of the present invention. The storage medium may be a disk, an optical disk, a read-only storage memory (abbreviated as: ROM) or a random access memory (abbreviated as: RAM), etc.
[0038] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.
[0039] The same and similar parts between the various embodiments of this specification can be referred to each other. In particular, for the embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
[0040] The above-described embodiments of the present invention do not limit the protection scope of the present invention.
Claims
1. A natural language analysis method based on data flow, It is characterized in that The method comprises: Acquire a network data stream, extract the carried sentences and additional element information therefrom, wherein the additional element information refers to an identifier used to distinguish different sentences and different sources, map the sentences and additional element information into data of string type attributes respectively, and vectorize them to obtain a first vector sequence; The first vector sequences are sequentially assigned to the tree structure in a head-to-tail order, with the vector sequences corresponding to the additional element information being located at the subleafs of the vector sequences corresponding to the statements from the same source, to obtain a tree-structured second vector sequence; Inputting the second vector sequence into a syntactic model to perform preliminary sentence segmentation to obtain a first word component, wherein the syntactic model sets extraction windows of different widths according to each word type, and uses the extraction window as a sentence segmentation basis, and the words within the window width constitute the first word component; Input the first word component into the semantic analysis model one by one. If the first word component can still be identified as a short sentence, it is determined that the initial segmentation of the first word component is unsuccessful, and the first word component needs to be input into the syntactic model again to be segmented again to obtain a second word component. If the first word component cannot be identified as a short sentence but is identified as a phrase, it is determined that the initial segmentation of the first word component is successful, and the first word component is directly identified as the second word component. The phrase consists of a plurality of words and has no syntactic structure. Repeating inputting the second word components into the semantic analysis model one by one until each second word component is determined to be preliminarily segmented successfully; According to the preset mapping relationship between phrase type and weight value, the second word components after all preliminary sentence segmentation are analyzed, the second word components with weight values greater than the threshold are clustered to form a new sentence, and the meaning of the new sentence is identified.
2. The method according to claim 1, Features: The method of setting extraction windows of different widths according to each word type includes updating the word type and establishing a corresponding relationship between the new word type and the extraction window width.
3. The method according to any one of claims 1 to 2, Features: The semantic analysis model performs semantic analysis according to sentence grammatical requirements.
4. The method according to any one of claims 1 to 3, Features: The kernels of the semantic analysis model and the syntactic model both use neural network models.
5. A natural language analysis system based on data stream, It is characterized in that The system comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the method according to any one of claims 1 to 4 according to the instructions in the program code.
6. A computer-readable storage medium, It is characterized in that The computer-readable storage medium is used to store program codes, and the program codes are used to execute the method according to any one of claims 1 to 4.
