Classification processing program and method

The classification processing program addresses the challenges of text classification by combining multiple sentences and using a large-scale language model to generate classification explanations, resulting in improved accuracy and efficiency.

JP7650476B2Active Publication Date: 2025-03-25川上成年
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2024147035
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2023-10-11
Filing Date
2024-08-29
Publication Date
2025-03-25
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

Existing classification processing methods, such as those described in Patent Document 1, face challenges in efficiently generating and classifying text due to the complexity of text mining processing.

Method used

A classification processing program that combines multiple classification target sentences into one input sentence and utilizes a large-scale language model to generate classification explanation sentences, thereby facilitating the classification process.

Benefits of technology

The proposed solution enables efficient generation and classification of texts by leveraging large-scale language models, improving accuracy and processing efficiency compared to conventional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007650476000001
    Figure 0007650476000001
  • Figure 0007650476000002
    Figure 0007650476000002
  • Figure 0007650476000003
    Figure 0007650476000003
Patent Text Reader

Abstract

To provide a classification program.SOLUTION: A program allows a computer to execute processing of: combining a plurality of classification target sentences into a single sentence; and generating a classification explanatory sentence from a single sentence using a large-scale language model.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a classification processing program and method. [Background technology]

[0002] Patent Document 1 discloses a patent map generation program. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Patent No. 6586614 Summary of the Invention [Problem to be solved by the invention]

[0004] In Patent Document 1, text mining processing is used for classification processing. However, the processing of creating classifications and classifying texts is highly difficult.

[0005] The present invention has been made to solve such a conventional problem, and do The purpose of this document is to: [Means for solving the problem]

[0007] The present invention relates to A classification processing program that causes a computer to execute a process of combining a plurality of classification target sentences, each describing the contents of a classification target, into one input sentence, and a process of inputting the input sentence and instruction information for generating a classification explanation sentence including only a classification name or a classification name and a classification explanation from the input sentence into a large-scale language model, and obtaining the classification explanation sentence as an output from the large-scale language model. It is. Effect of the Invention

[0008] According to the classification processing program and method of the present invention, it is possible to generate categories and classify texts. [Brief description of the drawings]

[0009] [Figure 1] Schematic diagram of a system for executing a classification processing program. [Diagram 2] Block diagram of an apparatus for executing a classification processing program [Diagram 3] Classification process flowchart [Figure 4] Sub-flowchart of classification generation process [Diagram 5] Classification description text data [Figure 6] Text data to be classified [Figure 7] Similarity Matrix [Figure 8] Classification results [Figure 9] Quantum Probability [Figure 10] Classification by quantum probability DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0010] Hereinafter, the classification processing program and method of the embodiment will be described in detail with reference to the drawings.

[0011] FIG. 1 is a schematic diagram of a system that executes a classification processing program. An information processing device (terminal 1) for executing the classification processing program is connected to a natural language processing server 2 via a network. In the embodiment, text generation processing and embedding processing by natural language processing are executed by a large-scale language model and an embedding model provided in the natural language processing server 2, but they may be executed by the information processing device 1. For example, text generation processing can be executed by the information terminal 1 by using a local LLM. Examples of local LLMs include GPT-Neo, GPT-J, BERT, RoBERTa, and BlenderBot. Examples of embedding models that can be executed by the information terminal 1 include Doc2Vec, Word2Vec, GloVe, FastText, and BERT.

[0012] Local LLMs (Local Large Scale Language Models) are large-scale natural language processing models that individuals or companies can run on their own computers or servers, allowing them to access high-performance natural language processing capabilities without an internet connection.

[0013] Embedding processing is a technique for converting data into a fixed-length vector format. This technique plays an important role in the fields of natural language processing (NLP) and machine learning. The basic flow of embedding processing is as follows:

[0014] First, in the data preparation stage, data such as text is collected, and then in the vectorization stage, the data is converted into fixed-length vectors using algorithms such as Doc2Vec, Word2Vec, and GloVe. This conversion process is called embedding.

[0015] The benefits of embedding are manifold. First, it improves computational efficiency by converting high-dimensional data into low-dimensional vectors. Second, the embedding vectors preserve the semantic relationships of the data. For example, words with similar meanings are represented as close vectors.

[0016] The natural language processing server 2 is a computer that executes text generation processing (summary generation processing and classification generation processing in the embodiment). The natural language processing server 2 in the embodiment is a natural language processing server that provides a cloud-based service incorporating large-scale language models such as ChatGPT (above, conversational services), GPT-4o, GPT-4 Turbo, GPT-4, GPT-3.5 Turbo, GPT-3.5, and GPT-3 (above, API services) from OpenAI. Note that the natural language processing server 2 is not limited to this, and may be any natural language processing server that executes natural language processing incorporating a large-scale language model that provides similar functions (for example, Gemini, Claude3, and Claude3.5).

[0017] The natural language processing server 2 is a computer that executes vectorization of input text. The natural language processing server 2 of the embodiment is a natural language processing server that provides a cloud-based service incorporating, for example, Embedding models such as text-embedding-3-small, text-embedding-3-large, and text-embedding-ada-002 (all of which are API services) from OpenAI. Note that the natural language processing server 2 is not limited to this, and may be a natural language processing server that provides a natural language processing service incorporating an Embedding model that provides a similar function.

[0018] The natural language processing server 2 of the embodiment has a CPU, memory, input / output devices, and an external interface, and performs natural language processing using a large-scale language model (summary generation processing and classification generation processing in the embodiment) and natural language processing incorporating an Embedding model (embedding processing in the embodiment) in response to input from an external device, and outputs the result.

[0019] FIG. 2 is a block diagram of an information processing device (terminal 1) for executing the classification processing program of the embodiment.

[0020] A CPU (Central Processing Unit) 101, a ROM (Read Only Memory) 102, a RAM (Random Access Memory) 103, a HDD (Hard Disk Drive) 105, an external I / F (Interface) 106, and an input unit 107 are connected via a system bus 108. The CPU 101, the ROM 102, and the RAM 103 constitute a control unit 104.

[0021] The ROM 102 prestores programs and thresholds executed by the CPU 101. The RAM 103 has various memory areas, such as an area for loading the programs executed by the CPU 101 and a work area that serves as a work area for data processing by the programs.

[0022] The HDD 105 stores natural language sentence data (such as patent data and questionnaire data) input from the input unit 107. The external I / F 106 is an interface for communicating with an external device such as an external server.

[0023] The external I / F 106 may be any interface that performs data communication with an external device, and may be, for example, a device (such as a USB memory) that connects locally to the external device, or may be a network interface for communication via a wired or wireless network.

[0024] The control unit 104 exchanges data with an external device (such as a natural language processing server) via the external I / F 106 to obtain the Python library required to execute the program, send string data, and receive classification results.

[0025] The external I / F 106 is connected to a display device (not shown) such as a liquid crystal display, etc. The input unit 107 is an input device such as a keyboard, a mouse, a scanner (reading device), etc.

[0026] (Embodiment 1) Next, the processing procedure of the classification processing program and method of the embodiment will be described. In the embodiment, an example of classifying sentences of solutions in beer technology will be shown. The program and method of the embodiment are a series of code blocks, which will be described later, and should basically be written consecutively. However, for ease of explanation, the program and method will be divided into steps and explained.

[0027] 3 is a flowchart of the classification processing program and method according to the embodiment. In STEP 1, a classification explanation sentence is generated, in STEP 2, the classification explanation sentence is vectorized, in STEP 3, the classification target sentence is vectorized, in STEP 4, the similarity between the classification explanation sentence and the classification target sentence is calculated, and in STEP 5, a classification is assigned to the classification target sentence based on the similarity.

[0028] In the embodiment, patent data (solutions in the abstract) is used as the text to be classified, but the text is not limited to this, and text in the specification or claims may be used, and text other than patent data such as questionnaires or user reviews may be processed. Furthermore, classification is not limited to solutions, and may be based on the purpose of analysis.

[0029] (STEP 1: Classification description text generation) Next, the classification explanation sentence generation step of STEP 1 will be described.

[0030] Figure 4 shows a subflow of the process of the classification explanation sentence generation step in STEP 1. In STEP 1.1, multiple solution means summaries (summary sentences) are generated from multiple abstracts (multiple sentences) of patents related to a specific product, and in STEP 1.2, a solution means explanation sentence (classification explanation sentence) is generated from the multiple solution means summaries.

[0031] (STEP 1.1: Summary of solution measures) First, the control unit 104 extracts sentences of solutions from the abstracts of multiple patent data. The program is as follows. The following program is a Python program stored in the control unit of the terminal 1. However, other programming tools and programming languages ​​(VBA, GAS, etc.) may also be used. The following program is merely an example, and the processing order and the libraries, functions, and variable names used may be changed.

[0032] (Code Block 1.1) import pandas as pd # Loading data # Using Google Drive from google.colab import drive drive.mount(' / content / drive') # Load data (from Google Drive) df = pd.read_excel(' / content / drive / MyDrive / beer_patent.xlsx') # Separating the problem from the solution #Extract the string between [Solution] and [Selection] and add it as a new column (solution) df['solution'] = df['Summary'].str.extract('[Solution](.+?)(?:[Choice]|$)', expand=False)

[0033] This program will be explained as follows. First, the control unit 104 imports a module called pandas. Pandas is a tool for performing data analysis in Python. Next, a function called drive is imported from a module called google.colab. Drive is a function for accessing Google Drive. Note that Google is a registered trademark.

[0034] The control unit 104 executes the drive function to mount Google Drive to the path ' / content / drive'. Mounting means that files and folders in Google Drive can be operated on Google Colab.

[0035] The control unit 104 uses the pd.read_excel function to read the Excel file beer_patent.xlsx located in the path ' / content / drive / MyDrive / beer_patent.xlsx' (note that the file format is not limited to Excel, and CSV format is also possible if other functions are used). This Excel file stores patent data that includes multiple abstract data (multiple sentences). The patent data has been converted into a data frame, and a portion of the summary column (summary column) in which the abstract sentences are stored is shown below.

[0036] (summary column data) 0 [Summary][Problem] Achieving a beer-like flavor and rich taste while reducing the purine concentration... 1 [Abstract][Problem] Achieving a beer-like flavor and rich taste while reducing the purine concentration... 2 [Abstract][Problem] To provide a beer-flavored beverage with reduced residual flavors. 3 [Summary][Problem] A beer that contains 50% or more malt by mass, but has no off-flavors derived from barley... 4 [Summary][Problem] Malt usage ratio is 50% or more and sugar content is 0.5g / 100... .. ... ... ... 91 [Abstract][Problem] To provide a beer-flavored beverage with an excellent balance of richness and sharpness. 92 [Abstract][Problem] A method for producing a non-fermented beer-flavored beverage, comprising: 93 [Abstract][Problem] The present invention provides a means for reducing the astringency of beer-flavored beverages,... 94 [Abstract][Problem] To provide a non-alcoholic beer-flavored beverage with a firm flavor... 95 [Abstract][Problem] To provide a beer-like sparkling beverage in which carbon dioxide loss is suppressed.

[0037] The contents of the patent abstracts are stored in the summary column of the data frame. Note that in the above example, due to space limitations, only the first five and a portion of the last five are shown, but in the embodiment, a data frame of 96 items (96 rows) is used. Of course, more or less than this number is possible. Also, in the above example, due to space limitations, the full text of the abstract is not displayed in the summary column, but in reality the full text of the abstract is stored in one cell in Excel. Note that Excel is a registered trademark. Note that columns other than the summary column will be added to the data frame by the processing in the following steps.

[0038] The control unit 104 assigns the read file to a variable called df. df is a table-format data structure called a data frame. By specifying df['summary'], only the column called summary is extracted from df. The summary column stores the text content of the patent abstract written in natural language.

[0039] The control unit 104 uses the str.extract function to extract the text from the summary column from "Solution" to "Selection diagram". This text represents the solution of the patent (this is called solution text information). The extracted text is added to a new column called solution. A new column "Solution" is created in df by setting df['solution'] = .... A part of the problem column and solution column converted into a data frame is shown below. Note that, due to space restrictions, only the first 5 cases and a part of the last 5 cases are shown below, but in the embodiment, a data frame of 96 cases (96 rows) is used. Also, in the above, due to space restrictions, the entire text is not displayed in the solution column, but in reality, the entire text of the text of the solution is stored in one cell in Excel.

[0040] (solution column data) 0 A beer-flavored fermented alcoholic beverage with a reduced purine concentration, in which the original extract concentration in the beverage is... 1 A beer-flavored fermented alcoholic beverage with a reduced purine concentration, in which the molecular weight of the beverage is 20 to 100... 2 The ratio of malt in the raw materials is 45% by mass or more, and the concentration of isoamyl acetate in the beer-flavored beverage is 2 mg / l... 3 The ratio of malt in the raw materials is 50% by mass or more, sugar is included as an ingredient, and the sugar content of the beer-flavored beverage is... 4 The ratio of malt in the raw materials is 50% by mass or more, and the alcohol content of the beer-flavored beverage is 3.7v / v%... .. ... 91 Beer-flavored beverages contain grain-derived ingredients, have an apparent final fermentation degree of 89% or more, and have an amino acid concentration of... 92 A method for producing a non-fermented beer-taste beverage, in which a sugar solution with a pH of 4.0 or higher is poured into a copper-containing vessel in the heating section... 93 The present invention relates to an agent for improving the astringency of beer-flavored beverages, which contains lipoxygenase-1-deficient barley as an active ingredient, and 94 Weight ratio of polyphenols to the total amount of extract (weight % of polyphenols / weight % of total amount of extract) 95 A beer-like sparkling beverage, polyglycerol fatty acid ester and linalool, characterized by the above.

[0041] It should be noted that the process of extracting the "solution" sentence from the abstract is not essential. In other words, the entire abstract may be sent as is to the natural language processing server as text information and the solution classification extraction process may be performed. However, by extracting and processing the "solution" sentence separately, the accuracy of classification generation by the natural language processing server 2 and the processing speed can be improved.

[0042] (Code Block 1.2) # Installing packages !pip install openai import openai

[0043] This command is to install the OpenAI Python library. The ! indicates that the command should be interpreted as a shell command. pip is a Python package manager, and install is the command used to install libraries.

[0044] The control unit 104 imports a Python library called openai. The openai library is for executing various natural language processing tasks using the OpenAI API. Note that, in order to use the openai library, it is actually necessary to input an API key, but this is omitted from the description of the program because it would be difficult to make it public.

[0045] (Solution Summary) Next, the control unit 104 transmits the solution means sentence information and the solution means summary instruction information to the natural language processing server 2, and receives the solution means summary information from the natural language processing server 2. The program is as follows.

[0046] (Code Block 1.3) # Solution Summary def generate_s_summary(text): response = openai.ChatCompletion.create( model="gpt-4", messages=[ {"role": "system", "content": "Please answer in 50 words or less about the unique technical features of the beer technology described in the solution text of the beer technology below."}, {"role": "user", "content": text}], temperature=0, max_tokens=100, frequency_penalty=0, presence_penalty=0, ) s_summary = response["choices"][0]["message"]["content"] return s_summary

[0047] The program uses OpenAI's large-scale language model GPT-4 to provide the ability to summarize a given sentence.

[0048] The generate_s_summary(text) function receives one text (text) as an argument, and the control unit 104 calls the Chat Completion API of OpenAI to summarize the text. The API sends a message consisting of two roles, the system and the user, and the system sends instruction information (prompt) saying "Please answer in 50 words or less about the unique technical features of the beer technology described in the solution text of the beer technology below." Note that the content of the prompt is merely an example, and may be changed according to the purpose (same below). This instruction information is called solution summary instruction information. Note that the number of characters to be summarized is not limited to 50 words, and may be more or less than this.

[0049] The natural language processing server 2 summarizes the given text (solution means text information) based on the solution means summary instruction information and returns it as solution means summary information. The response from the natural language processing server 2 includes the summarized text (solution means summary text: summary text). The solution means summary information is stored in the s_summary variable and returned as the output of the function.

[0050] (Code Block 1.4) # Add the result of the solution summary process to a new column (s_summary) df['s_summary'] = df['solution'].apply(lambda x: generate_s_summary(x))

[0051] This part of the program is for adding the results (solution summary sentences) of the summary of each row stored in the 'solution' column of the Pandas data frame df using the generate_s_summary function to a new column 's_summary' of df. A part of the s_summary column converted into a data frame is shown below. Note that, due to space restrictions, only the first 5 cases and a part of the last 5 cases are shown below, but in the embodiment, a data frame of 96 cases (96 rows) is used. Of course, more or less cases are possible. Also, in the above, due to space restrictions, the full text is not displayed in the s_summary column, but in reality, the full text of the solution summary is stored in one cell each in Excel.

[0052] (s_summary column data) 0 Beer technology offers reduced purine levels,... 1 Beer technology offers reduced purine levels,... 2 Beer technology solutions include a high malt ratio,... 3 Beer technologies with malt ratios of 50% or more include... 4 Beer technology with malt ratio of 50% or more, alcohol... .. ... 91 Beer-flavored beverages containing ingredients derived from grains,... 92 - A process involves boiling a sugar solution,... Ch. 93 This invention provides a beer-flavored beverage,... 94 Non-alcoholic beer-like beverages containing polyphenols... 95 Beer technology containing polyglycerol fatty acid esters,...

[0053] In the embodiment, a step of generating a summary of the solution is provided due to the upper limit of the number of tokens for processing by the natural language processing server, but if the upper limit of the number of tokens is large, the step of summarizing the solution may be omitted. In other words, the entire text of the solution or the entire text of the abstract may be sent to the natural language processing server 2, and the subsequent classification generation process may be performed. However, from the viewpoint of processing speed, the usage cost of the LLM, and the execution speed, it is preferable to perform the summary process.

[0054] (STEP 1.2: Classification explanation text generation step) The control unit transmits a plurality of pieces of solution means summary information and solution means classification generation instruction information to the natural language processing server 2, and receives solution means classification explanation sentence information (classification explanation sentence) from the natural language processing server 2. The program is as follows.

[0055] (Code Blocks 1.5) # A culture of solution summary writing # Extract the data from the 's_summary' column of the DataFrame and store it in a variable called s_summaries. s_summaries = df['s_summary'].values # Combine all issue summaries into one string s_summaries_text = ', '.join(s_summaries)

[0056] This part of the program gets all values ​​of the 's_summary' column from the Pandas data frame df and stores them in a variable called s_summaries. Specifically, df['s_summary'].values ​​gets all values ​​of the 's_summary' column of the df data frame.

[0057] Next, each element of the 's_summaries' variable (summary text for each solution) is combined with a comma and a space (',') and converted into a single solution summary text (s_summaries_text) (single summary text). This operation combines the solution summary texts into a single summary text, which can then be used in subsequent processing. In other words, this is a process that combines the 50-word summary texts above into a single text. (Note that this combined text will be quite long, so we will not repeat it here.)

[0058] (Code Blocks 1.6) # Solution classification explanation text generation def generate_s_class(text): response = openai.ChatCompletion.create( model="gpt-4", messages=[ {"role": "system", "content": "Classify the numerous unique technical characteristics of your beer product into five categories based on ingredients, materials, or compounds, give each classification a name based on the ingredient, material, or compound, and provide a name and a brief description (50 words or less) for each classification."}, {"role": "user", "content": text}], temperature=0, max_tokens=4000, frequency_penalty=0, presence_penalty=0, ) s_class = response["choices"][0]["message"]["content"] return s_class

[0059] The program uses OpenAI's language model "GPT-4" to provide the ability to generate classification explanation sentences from given sentences.

[0060] The generate_s_class(text) function receives one text (text) as an argument, and the control unit 104 calls the Chat Completion API of OpenAI to generate a classification group from the text (solution summary string). The API sends a message consisting of two roles, that of the system and the user, and sends instruction information (prompt) from the system side saying, "Classify the numerous unique technical features of the beer products shown in the following text into five categories based on ingredients, materials, or compounds, give each classification a name based on the ingredients, materials, or compounds, and provide a name and a brief description (within 50 words) of each classification." This instruction information is called solution classification explanation sentence generation instruction information. Note that the number of classifications of solution means is not limited to five, and may be more or less.

[0061] Furthermore, the contents of the prompt are not limited to this, and may be more detailed instructions. Furthermore, by setting the instruction (prompt) to "only the name of the category", the content of the generated category explanation sentence will be only the category name. In this way, by changing the prompt according to the purpose, the content of the category explanation sentence can be only the category name, or the category name and an explanation of the category content.

[0062] The natural language processing server 2 generates a classification explanation sentence from the given text (solution means summary sentence) based on the solution means explanation sentence generation instruction information, and returns it as solution means explanation sentence generation result information. The response from the natural language processing server 2 includes the text of the solution means classification explanation sentence (classification explanation sentence). The solution means explanation sentence information is stored in the s_class variable and returned as the output of the function.

[0063] (Code Blocks 1.7) # Generate a solution description s_class = generate_s_class(s_summaries_text)

[0064] This program calls the generate_s_class function with the generated s_summaries_text (all solution summaries combined into one string) as an argument.

[0065] The generate_s_class function is responsible for generating a taxonomy for the text (in this case the solution summary) using OpenAI's GPT-4 model.

[0066] When this code is executed, the solution summary (s_summaries_text) is classified into five categories, and the result (classification name and classification explanation: classification explanation text) is stored in the s_class variable. In other words, the following five solution classification explanation texts (1. Amino acids, 2. Esters, 3. Aldehydes, 4. Acids, 5. Alcohols and their explanations) are stored in the s_class variable.

[0067] (Generated solution classification description text) 1. Amino acid based Amino acid components play an important role in improving the flavor, aroma, and nutritional value of beer, including pyroglutamic acid, tryptophan, amino acid nitrogen, and proline. 2. Esters Esters are the components that give beer its fruity and floral aroma. Representative examples include ethyl acetate, ethyl caproate, and terpinyl acetate. 3. Aldehydes Aldehydes are compounds that give beer its characteristic aromatic flavor and include acetaldehyde, 3-methylbutanal, and furfural. 4.Acids Acids are components that adjust the sourness and balance of beer. They include citric acid, succinic acid, and propionic acid. 5. Alcohol Alcohols are important components that affect the flavor and aroma of beer. Alcohols include ethanol, 1-propanol, etc.

[0068] Next, convert this solution explanation text into a data frame and output it as an Excel file (file name: solution_class.xlsx). The code is as follows:

[0069] (Code Blocks 1.8) # Split text into lines lines = s_class.split("\n") # Extract classification and description categories = [] descriptions = [] current_description = "" for line in lines: if line.startswith("1.") or line.startswith("2.") or line.startswith("3.") or line.startswith("4.") or line.startswith("5."): if current_description: descriptions.append(current_description.strip()) parts = line.split(".", 1) categories.append(parts[1].strip()) current_description = "" else: current_description += " " + line.strip() # Add final explanation if current_description: descriptions.append(current_description.strip()) # Convert to DataFrame df_solution_class = pd.DataFrame({"solution_class_name": categories, "solution_class_contents": descriptions}) # Output to Excel file df_solution_class.to_excel("solution_class.xlsx", index=False)

[0070] (Explanation of Code Block 1.8) This code is for splitting the text (the solution description text) into categories (classifications) and their descriptions, and saving them in an Excel file. First, the text `s_class` is split by line breaks, and each line is stored in the list `lines`. The classification name (e.g. "Amino acids") is stored in the `categories` list, and the description is stored in the `descriptions` list. Each line is checked, and if it is a classification name line, the classification name is extracted, and other lines are added as classification descriptions. Then, the categories and descriptions` are converted into a data frame, and the data frame is saved as an Excel file "solution_class.xlsx".

[0071] Figure 5 shows the data stored in solution_class.xlsx generated by executing code block 1.8. This is the classification explanation text data.

[0072] In the embodiment, the classification explanatory text is generated from the patent text, but it is also possible to generate the classification explanatory text without providing the patent text. The method for doing so will be described below.

[0073] ChatGPT was used to carry out the classification. ChatGPT is a system in which, when a prompt is entered into a window, a natural language processing server performs natural language processing incorporating a large-scale language model to generate an answer and displays it in the window. In the following explanation, the content entered into the window is referred to as (prompt), and the output from the natural language processing server to the window is referred to as (output of natural language processing server). Note that other similar systems besides ChatGPT, such as gemini or Bing AI chat, may also be used.

[0074] First, the terminal 1 transmits solution means classification generation instruction information (hereinafter, also referred to as a prompt) to the natural language processing AI server 2. In addition, in the embodiment, five classifications are generated as classifications, but the number of elements is not limited to this, and may be less or more than this.

[0075] (Create solution classification) (prompt) Classify the numerous unique technical characteristics of your beer product into five categories based on ingredients, materials, or compounds, give each classification a name based on the ingredient, material, or compound, and provide a name and a brief description (no more than 50 words) of each classification.

[0076] (Output of natural language processing server) We classify the technical characteristics of beer products into the following five categories based on ingredients, materials or compounds, and provide a name and a brief description for each: 1. Amino acid beer - Description: Beer containing amino acids. Enhances umami and richness, and deepens the flavor. 2. Ester beer - Description: A beer that contains esters. It has a fruity and gorgeous aroma, and a rich and fresh taste. 3. Aldehydes in Beer - Description: Beer containing aldehydes, which provide the unique aroma and shape the complex flavor profile of the beer. 4. Sour beer - Description: A beer that contains acids. It has a refreshing and well-balanced taste with a distinctive sour taste. 5. Alcoholic drinks: Beer - Description: Beer containing alcohol. The alcohol content is the main component, making it easy to drink and providing a rich taste. Each category highlights a specific ingredient or compound, delivering a beer product with its own unique flavor and character.

[0077] This output can then be output and saved as "solution_class.xlsx" using the process described above (Code Block 1.8).

[0078] Also, solution_class.xlsx can be output using ChatGPT. A prompt example is shown below. (prompt) Please create a table with the name and a brief description of each classification and output it to an Excel file named solution_class.xlsx.

[0079] In this way, the generation AI server 2 can generate classification descriptions without relying on patent documents. Of course, creating classification descriptions from patent documents will result in classifications that are more in line with real technology.

[0080] (STEP 2: Vectorization of classification description text) Next, the control unit 104 of the terminal 1 transmits the multiple classification explanation sentences to the natural language processing server 2, and the natural language processing server 2 vectorizes the classification explanation sentences. The program is as follows.

[0081] The following program is a Python program stored in the control unit 104 of the information processing device (terminal 1). However, other programming tools and programming languages ​​may be used. The following program is merely an example, and the processing order and the libraries, functions, and variable names used may be changed.

[0082] The control unit 104 imports a module called pandas. Pandas is a tool for performing data analysis in Python. Next, a function called drive is imported from a module called google.colab. Drive is a function for accessing Google Drive.

[0083] The control unit 104 executes the drive function to mount Google Drive to the path ' / content / drive'. Mounting means that files and folders in Google Drive can be operated on Colab.

[0084] (Code Block 2.1) # Library imports import pandas as pd import numpy as np from sklearn.metrics.pairwise import cosine_similarity # Using Google Drive from google.colab import drive drive.mount(' / content / drive')

[0085] (Explanation of Code Block 2.1) - `import pandas as pd`: Imports the Pandas library for data manipulation and analysis. Pandas is a library for efficiently working with data using data frames. - `import numpy as np`: Imports the NumPy library for numerical calculations and matrix manipulation. NumPy is a library for efficiently manipulating multidimensional arrays. - `from sklearn.metrics.pairwise import cosine_similarity`: import the function used to calculate cosine similarity, which is used to calculate the similarity between two vectors. - `from google.colab import drive`: Import the module for operating Google Drive on Google Colab. - `drive.mount(' / content / drive')`: Mounts Google Drive into the Colab environment, allowing you to access files in Google Drive.

[0086] Next, the control unit 104 installs the OpenAI Python library, which makes it possible to execute natural language processing tasks using the OpenAI API.

[0087] (Code Block 2.2) # Installing packages !pip install openai from openai import OpenAI # Enter API_KEY client = OpenAI(api_key)

[0088] (Explanation of Code Block 2.2) - `! pip install openai`: Installs the OpenAI Python client library. - `from openai import OpenAI`: Imports the OpenAI class from the OpenAI library. - `client = OpenAI(api_key)`: Initialize an OpenAI client with an API key, so you're ready to use the OpenAI API.

[0089] Next, the control unit 104 uses the pd.read_excel function to read the Excel files solution_class.xlsx and solution.xlsx in the path ' / content / drive / MyDrive / '.

[0090] Figure 5 shows the classification explanation sentence data stored in solution_class.xlsx. As shown in the figure, the classification explanation sentence data has a solution_class_name column indicating the classification name, and a solution_class_contents column in which the classification explanation sentence is stored. This classification explanation sentence is the subject of vectorization. Of course, it may contain other columns.

[0091] Figure 6 shows the text data to be classified, stored in solution.xlsx. As shown in the figure, the text to be classified is stored in the solution column. Note that the number of texts to be classified is 10, but it is of course possible to have more or less than this number. Note that this text data to be classified is extracted from the description of the solution means in the abstract of the patent data.

[0092] (Code Block 2.3) # Load data (from Google Drive) df1 = pd.read_excel(' / content / drive / MyDrive / solution_class.xlsx') df2 = pd.read_excel(' / content / drive / MyDrive / solution.xlsx')

[0093] (Explanation of Code Block 2.3) - `pd.read_excel`: Read an Excel file using Pandas. - `df1 = pd.read_excel(' / content / drive / MyDrive / solution_class.xlsx')`: Read the `solution_class.xlsx` file in Google Drive and store it in the data frame `df1`. This file contains data on classification descriptions. - `df2 = pd.read_excel(' / content / drive / MyDrive / solution.xlsx')`: Read the `solution.xlsx` file in Google Drive and store it in the data frame `df2`. This file contains data on multiple documents to be classified.

[0094] Next, the natural language processing server 2 vectorizes the classification description text. The process is as follows.

[0095] (Code Block 2.4) # Embedding processing function def get_embedding(text, model="text-embedding-3-small"): text = text.replace("\n", " ") return client.embeddings.create(input = [text], model=model).data[0].embedding # Add the embedding result to a new column (solution_class_vec) df1['solution_class_vec'] = df1['solution_class_contents'].apply(lambda x: get_embedding(x, model='text-embedding-3-small'))

[0096] (Explanation of Code Block 2.4) - `def get_embedding(text, model="text-embedding-3-small"):`: Defines a function that converts text to an embedding vector with the specified model (text-embedding-3-small). - `text.replace("\n", " ")`: Replaces newlines in the text with spaces. This formats the text into a single line. - `client.embeddings.create(input = [text], model=model).data[0].embedding`: Convert text to embedding vectors using OpenAI's API (text-embedding-3-small). - `df1['solution_class_vec'] = df1['solution_class_contents'].apply(lambda x: get_embedding(x, model='text-embedding-3-small'))`: Apply the `get_embedding` function to each row of the `solution_class_contents` column of `df1` and add the result to a new column `solution_class_vec`. This converts each classification description text into a vector representation.

[0097] Through this process, each classification description sentence is converted into a 1536-dimensional vector (we will omit the vectors due to their length). We call this vector the classification description sentence vector.

[0098] (STEP 3: Vectorization of the text to be classified) Next, the natural language processing server 2 vectorizes the sentences to be classified. The process is as follows.

[0099] (Code Block 3.1) # Add the embedding result to a new column (solution_vec) df2['solution_vec'] = df2['solution'].apply(lambda x: get_embedding(x, model='text-embedding-3-small'))

[0100] (Explanation of Code Block 3.1) - `df2['solution_vec'] = df2['solution'].apply(lambda x: get_embedding(x, model='text-embedding-3-small'))`: Apply the `get_embedding` function to each row of the `solution` column of `df2` and add the result to a new column `solution_vec`. This converts each sentence to a vector representation.

[0101] Through this process, each sentence to be classified is converted into a 1536-dimensional vector (vectors are not shown because they are long sentences). This vector is used as the sentence vector to be classified.

[0102] (STEP 4: Similarity calculation step) The control unit 104 calculates the cosine similarity between each category explanation sentence vector and each category target sentence vector. Note that the similarity may be calculated using not only the cosine similarity but also other methods such as Euclidean distance, Manhattan distance, Minkowski distance, Chebyshev distance, Jaccard coefficient, Pearson correlation coefficient, etc.

[0103] (Code Block 4.1) # Function to calculate cosine similarity def calculate_cosine_similarity_matrix(vecs1, vecs2): vecs1 = np.array(vecs1.tolist()) vecs2 = np.array(vecs2.tolist()) return cosine_similarity(vecs1, vecs2) # Calculate the cosine similarity matrix similarity_matrix = calculate_cosine_similarity_matrix(df2['solution_vec'], df1['solution_class_vec']) # Convert the result to a dataframe similarity_df = pd.DataFrame(similarity_matrix, index=df2.index, columns=df1.index)

[0104] (Explanation of Code Block 4.1) - `def calculate_cosine_similarity_matrix(vecs1, vecs2):`: Define a function to calculate the cosine similarity matrix between two lists of vectors. - `vecs1 = np.array(vecs1.tolist())`: convert `vecs1` to a NumPy array. `tolist()` is a method that converts a column of a DataFrame to a list. - `vecs2 = np.array(vecs2.tolist())`: convert `vecs2` to a NumPy array. - `return cosine_similarity(vecs1, vecs2)`: Calculates the cosine similarity between two vector lists and returns the result. - `similarity_matrix = calculate_cosine_similarity_matrix(df2['solution_vec'], df1['solution_class_vec'])`: Calculate the cosine similarity between `solution_vec` in `df2` and `solution_class_vec` in `df1`, and store the result in `similarity_matrix`. - `similarity_df = pd.DataFrame(similarity_matrix, index=df2.index, columns=df1.index)`: Convert the similarity matrix into a data frame and store it in `similarity_df`. This allows the similarity between each classification description sentence and the classification target sentence to be expressed in matrix form.

[0105] Figure 7 shows the generated similarity matrix (similarity_matrix). As shown in the figure, the individual similarities of each classification explanation sentence to each solution (sentence to be classified) are calculated. Note that, to simplify the figure, the sentences in the solution column have been replaced with numbers indicating the order, such as 1, 2, 3. Similarly, the item names in the classification column have been replaced with the classification explanation sentences (solution_class_contents) by the classification names (solution_class_name).

[0106] (STEP 5: Classification step) The control unit 104 classifies the target sentences into a classification explanation sentence having a maximum similarity among the vectors of the target sentences and the cosine similarities of the vectors of the target sentences. The process is as follows.

[0107] (Code Block 5.1) ##Classification assignment # Add solution_class_name with maximum similarity to df2 df2['max_similarity_class_index'] = similarity_df.idxmax(axis=1) df2['max_similarity_value'] = similarity_df.max(axis=1) # Add solution_class_name using max_similarity_class_index df2 = df2.merge(df1[['solution_class_name']], left_on='max_similarity_class_index', right_index=True, how='left') # Adjust column names df2.rename(columns={'solution_class_name': 'max_similarity_class'}, inplace=True)

[0108] (Explanation of Code Block 5.1) - `df2['max_similarity_class_index'] = similarity_df.idxmax(axis=1)`: For each classification description, get the index of the class with the highest similarity and add it to the `max_similarity_class_index` column. `idxmax(axis=1)` returns the index of the maximum value for each row. - `df2['max_similarity_value'] = similarity_df.max(axis=1)`: For each target sentence, add the highest similarity value to the `max_similarity_value` column. `max(axis=1)` returns the maximum value in each row. - `df2 = df2.merge(df1[['solution_class_name']], left_on='max_similarity_class_index', right_index=True, how='left')`: Merge the corresponding `solution_class_name` from `df1` using `max_similarity_class_index` into `df2`. This adds to each classification target sentence the name of the classification description sentence that is most similar to it. - `df2.rename(columns={'solution_class_name': 'max_similarity_class'}, inplace=True)`: Rename the column `solution_class_name` to `max_similarity_class`, so that in the resulting dataframe, it represents the name of the most similar classification description sentence.

[0109] Figure 8 shows the classification results. As shown in the figure, a classification (max_similarity_class) is assigned to each classification target sentence (solution 1 to 10). For example, the classification target sentence solution 1 is assigned the classification of amino acid system. Note that to simplify the figure, the solution column has been replaced with numbers indicating the order 1, 2, 3.

[0110] In the embodiment, the classification with the highest similarity is given, but multiple classifications such as the top two or three similarities may be given. For example, if the top three similarities are 50%, 45%, and 40%, all of these classifications can be given. By giving the top two or three similarity classifications, classification from multiple perspectives becomes possible, which is useful for more detailed analysis and multifaceted data analysis.

[0111] Alternatively, a predetermined similarity value may be set as a threshold value, and a classification equal to or greater than the threshold value may be assigned. For example, the threshold value may be set to 40%, and only classifications with a similarity value equal to or greater than the threshold value may be assigned. By setting a predetermined similarity value as a threshold value and assigning a classification with a similarity value equal to or greater than the threshold value, it is possible to increase the accuracy of classification and eliminate uncertain classifications.

[0112] As described above, in the classification processing program and method of the embodiment, the classification explanation sentence is vectorized and the similarity with the classification target sentence is calculated, so that the classification target sentence can be classified with high validity.

[0113] The classification processing program and method of the present invention provide the following advantages.

[0114] (High accuracy classification) By vectorizing the classification explanation text and calculating the similarity with the classification target text, it is possible to classify the classification target text with higher accuracy than conventional methods. This makes it possible to efficiently and accurately classify large amounts of data such as patent data, papers, and surveys. Compared to conventional methods, the method of the present invention achieves high classification accuracy because it performs classification while maintaining the semantic relationships of classification strings composed of natural language.

[0115] (Flexible scope of application) As described in the embodiment, the method can be applied to various types of text data, such as papers, questionnaires, and user reviews, in addition to patent data. The method of the present invention can be applied to a wide range of data sources and embedding models, and can be applied in a wide range of applications. This makes it effective in different fields and applications.

[0116] (Efficient processing) Embedding converts high-dimensional data into low-dimensional vectors, improving computational efficiency and allowing for rapid processing of large data sets. Embedding converts high-dimensional data into low-dimensional vectors, improving computational efficiency and allowing for rapid processing of large data sets.

[0117] (Versatility) The classification categories can be flexibly set according to various purposes, such as issues, needs, quality, effects, applications, and benefits, in addition to solutions, allowing for a wide range of analyses. Flexible classification category settings allow for a variety of analytical purposes. This allows the system to be used for corporate marketing analysis and research and development support.

[0118] As described above, the classification processing program and method of the present invention have high classification accuracy, a flexible range of application, efficient processing, and high versatility, and provide new value in the field of natural language processing.

[0119] (Embodiment 2) (STEP 6: Quantum probability calculation step) In the first embodiment, classification was performed based on the magnitude of similarity. However, since the solution is configured by combining various elements, it may be difficult to perform strict classification. In the second embodiment, classification is performed in a quantum probabilistic manner by calculating the probability that each classification applies to the text to be classified. Note that a description of the parts of the program common to the first embodiment will be omitted.

[0120] The control unit 104 calculates the quantum probability from the cosine similarity between the vector of each classification explanation sentence and the vector of each classification target sentence. The process is as follows.

[0121] (Code Block 6.1) ###Calculating quantum probability # Define a function to extract the values ​​from each row and simulate a quantum measurement def simulate_quantum_measurement(row): amplitudes = np.array(row) state = amplitudes / np.linalg.norm(amplitudes) quantum_probabilities = np.abs(state)**2 return quantum_probabilities # Get numeric columns of a data frame numerical_data = similarity_df # Calculate the quantum probability for each row df_quantum_probabilities = numerical_data.apply(simulate_quantum_measurement, axis=1) # Convert quantum probabilities to a data frame df_quantum_probabilities = pd.DataFrame(df_quantum_probabilities.tolist(), index=df2['solution'], columns=df1['solution_class_name'])

[0122] (Explanation of Code Block 6.1) # Define a function to extract the values ​​from each row and simulate a quantum measurement def simulate_quantum_measurement(row): amplitudes = np.array(row) state = amplitudes / np.linalg.norm(amplitudes) quantum_probabilities = np.abs(state)**2 return quantum_probabilities - Define a function to simulate a quantum measurement: - `amplitudes = np.array(row)`: convert a row of a DataFrame into a NumPy array. - `state = amplitudes / np.linalg.norm(amplitudes)`: Normalize (make norm 1) a row vector. This is a standard operation for representing quantum states. - `quantum_probabilities = np.abs(state)**2`: Square the absolute value of each element of the normalized vector. This calculates the probability of the quantum state. - `return quantum_probabilities`: Return the quantum probabilities. # Get numeric columns of a data frame numerical_data = similarity_df - Get numerical data: Get the similarity data frame (`similarity_df`) as numerical data, which will be used to prepare the data for later quantum probability calculations. # Calculate the quantum probability for each row df_quantum_probabilities = numerical_data.apply(simulate_quantum_measurement, axis=1) - Calculate the quantum probability for each row: - `numerical_data.apply(simulate_quantum_measurement, axis=1)`: apply the `simulate_quantum_measurement` function defined above to each row of the data frame. `axis=1` means to apply the function row-wise. - This operation calculates the quantum probability of each line (each target sentence) and stores it in the data frame `df_quantum_probabilities`. # Convert quantum probabilities to a data frame df_quantum_probabilities = pd.DataFrame(df_quantum_probabilities.tolist(), index=df2['solution'], columns=df1['solution_class_name']) - Convert quantum probabilities to a new data frame: - `df_quantum_probabilities.tolist()`: Convert `df_quantum_probabilities` to a list format. - `pd.DataFrame(..., index=df2['solution'], columns=df1['solution_class_name'])`: Convert the quantum probabilities in list format into a new data frame, and set the row index to the `solution` column of `df2` and the column index to the `solution_class_name` column of `df1`. This will create a data frame of quantum probabilities corresponding to each classification target sentence and classification explanation sentence.

[0123] Figure 9 shows the obtained quantum probabilities. As shown in the figure, quantum probabilities of amino acids, esters, aldehydes, acids, and alcohols are assigned to each classification target sentence (solutions 1 to 10). The sum of the quantum probabilities of each line is 1.

[0124] For example, a quantum probability of 0.2 or more, calculated by dividing 1 by the number of categories (5 in this embodiment), may be assigned as a category. By classifying in this way, for example, it is possible to grasp the multiple categories that make up each classification target sentence. The code for assigning a quantum probability of 0.2 or more as a category is shown below. Note that the threshold is not limited to 0.2 and may be set arbitrarily. Based on the quantum probability, a process is executed to classify the classification target sentence into a category of category explanation sentences that exceed a predetermined threshold.

[0125] (Code Block 6.2) ###Quantum probability 0.2 or higher classification # Function to find column names with values ​​>= 0.2 for each row def find_columns_with_high_values(row): return ', '.join(row.index[row >= 0.2].tolist()) # Apply the function to each row to create the new column df_quantum_probabilities['High_Value_Columns'] = df_quantum_probabilities.apply(find_columns_with_high_values, axis=1)

[0126] (Explanation of Code Block 6.2) This code block lists the names of columns with values ​​greater than or equal to 0.2 for each row in the data frame df_quantum_probabilities and stores them in a new column called High_Value_Columns. First, a function find_columns_with_high_values ​​is defined, which takes a row as input, finds the columns in that row with values ​​greater than or equal to 0.2, and converts them into a comma-separated string.

[0127] Next, we apply this function to each row of the dataframe. We use df_quantum_probabilities.apply(find_columns_with_high_values, axis=1) to apply the function row by row and store the results in a new column, High_Value_Columns. This process saves the column names with values ​​greater than or equal to 0.2 in each row of the dataframe as a comma-separated string. This allows us to easily see and analyze the data that meets the specified criteria.

[0128] FIG. 10 shows the classification. As shown in the figure, classification into amino acids, esters, aldehydes, acids, and alcohols is given to each classification target sentence (solution 1 to 10). For example, solution 1 is classified into multiple categories such as amino acids and acids, and solution 2 is classified into multiple categories such as aldehydes and alcohols. In addition, in FIG. 10, classification into acids is performed, and a result different from classification by similar size, such as no acids in FIG. 8, is obtained. In addition, quantum probability makes it easy to compare the classifications between solutions 1 to 10. In addition, quantum probability makes it possible to set a common threshold for each line, making processing easier. The classification processing program and method using quantum probability of the present invention provide the following technical effects.

[0129] Classification from multiple perspectives: By using quantum probability, even if each target sentence spans multiple classifications, it is possible to assign multiple classifications according to its probability. This makes it possible to capture various aspects of the target sentence, which is useful for more detailed analysis and multifaceted data analysis.

[0130] Highly accurate classification: Compared to the conventional single classification based on similarity, the use of quantum probability improves classification accuracy because it can more accurately reflect subtle differences in the text to be classified by considering the probability of each classification.

[0131] Flexible classification settings: By using quantum probability, for example, by setting a certain threshold, it is possible to give classifications only with a certain probability or higher. This flexible setting improves the accuracy and reliability of the classification, and allows customization according to the user's needs.

[0132] Efficient Processing: The process of calculating quantum probability can be parallelized and can be quickly applied to large data sets. This significantly improves the efficiency of data classification and analysis. Due to the above technical effects, the classification program and method using quantum probability of the present invention provide new value in the field of natural language processing and can be widely applied.

[0133] In the above embodiment, the processing is described using Python, but the present invention is not limited to this, and similar processing can be performed by combining a spreadsheet such as Excel with the API.

[0134] In addition, the classification categories are not limited to solutions, and may be classified into categories of issues, needs, quality, effects, uses, and benefits depending on the purpose of the analysis, provided that the classification is explained. Furthermore, the character strings to be classified are not limited to patent data, and may be any character string in natural language, such as a paper.

[0135] Although the embodiment has been described above, this embodiment is presented as an example and is not intended to limit the scope of the invention. This new embodiment can be implemented in various other forms, and various omissions, substitutions, and modifications can be made without departing from the gist of the invention. This embodiment and its modifications are included in the scope and gist of the invention, and are included in the scope of the invention and its equivalents described in the claims. [Explanation of symbols]

[0136] 1 terminal, 2 natural language processing server, 101 CPU, 102 ROM, 103 RAM, 104 control unit, 105 HDD, 106 external I / F, 107 input unit, 108 system bus

Claims

1. On the computer, A process of combining a plurality of classification target sentences, each of which describes the contents of the classification target, into a single input sentence; a process of inputting the input sentence and instruction information for generating a classification explanation sentence including a classification name or a classification name and a classification description from the input sentence into a large-scale language model, and obtaining the classification explanation sentence as an output from the large-scale language model; A classification processing program that executes the above.

2. summarizing the plurality of classification target sentences using the large-scale language model; combining summaries of the plurality of classification target sentences into the single input sentence; The classification processing program according to claim 1 , further comprising:

3. The computer A process of combining a plurality of classification target sentences, each of which describes the contents of the classification target, into a single input sentence; a process of inputting the input sentence and instruction information for generating a classification explanation sentence including a classification name or a classification name and a classification description from the input sentence into a large-scale language model, and obtaining the classification explanation sentence as an output from the large-scale language model; A classification processing method that performs the above.

Citation Information

Patent Citations

  • Information processing system, information processing method, and program

    JP2024001602A

  • Patent map generation program and method

    JP6586614B1

  • JPP7488617B