# US 2025/0094480 A1 · Document processing and retrieval for knowledge-based question answering

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0094480 A1
- Document ID: US20250094480A1
- Status: Published application
- Kind: A1
- Application number: 18/885,071
- Filed: 2024-09-13
- Published: 2025-03-20
- Earliest claimed: 2023-09-15
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Yingqiong Shi; Charles Woodrow Dickstein; Aashna Devang Kanuga; Xu Zhong; Xin Xu
- Web page: https://patentgrep.com/patent/US20250094480A1

## CPC

- G06F 16/334: Query execution (filtering based on additional data G06F16/335)
- G06F 16/316: {Indexing structures}
- G06F 16/3344: {using natural language analysis}
- G06F 16/383: using metadata automatically derived from the content
- G06F 40/289: Phrasal analysis, e.g. finite state techniques or chunking
- G06F 40/30: Semantic analysis
- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F 40/205: Parsing
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques are disclosed herein for generating and using a knowledge base of information extracted from documents. The techniques include accessing a document comprising text and dividing the document into a plurality of chunks of text. The chunks are indexed by storing each chunk mapped to respective identifying metadata including a chunk index for each chunk. A query is received and a chunk relevant to the query is identified. A prompt is formulated including the query, the identified relevant chunk, and a subsequent chunk. The prompt is provided to a language model and output is received from the language model based on the prompt. An answer to the query is returned based on the received output.

## Claims

### Claim 1

A computer-implemented method comprising:
accessing, by a computing system, a document, the document comprising text;
dividing, by the computing system, the document into a plurality of chunks of text;
indexing, by the computing system, the plurality of chunks, the indexing comprising storing each chunk mapped to respective identifying metadata, the identifying metadata including a chunk index for each chunk;
receiving, by the computing system, a query;
identifying, by the computing system, a chunk relevant to the query;
formulating, by the computing system, a prompt including the query, the identified relevant chunk, and a subsequent chunk with a subsequent chunk index immediately following a chunk index of the identified relevant chunk;
providing, by the computing system, the prompt to a language model;
receiving, by the computing system from the language model, output based on the prompt; and
returning, by the computing system, an answer to the query based on the received output.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein identifying the chunk relevant to the query comprises:
embedding, by the computing system, a plurality of indexed chunks;
embedding, by the computing system, the query;
comparing, by the computing system, each of the plurality of chunk embeddings to the query embedding to generate a similarity score for each chunk embedding; and
selecting the chunk with a highest similarity score.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein:
comparing the plurality of chunk embeddings to the query embedding comprises computing the similarity score for each chunk embedding based on cosine similarity.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, further comprising:
identifying, by the computing system, a file type of the document; and
dividing, by the computing system, the document into the plurality of chunks according to the file type.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, wherein the file type is portable document format (PDF) and the dividing the document into the plurality of chunks comprises parsing the document into multiple sentence objects and storing a chunk for each sentence object.

### Claim 6 (depends on 4)

The computer-implemented method of claim 4, wherein the file type is comma-separated values (CSV) comprising rows, columns, and cells, and the dividing the document into the plurality of chunks comprises appending a column header to each cell and converting each row to a chunk.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, further comprising:
identifying a size limit of a context input section for the language model;
comparing a size of the chunk and the subsequent chunk to the size limit; and
resizing the size of the chunk and the subsequent chunk to be less than or equal to the size limit.

### Claim 8

A system comprising:
one or more processors; and
one or more computer-readable media storing instructions which, when executed by the one or more processors, cause the system to perform the following operations:
accessing a document, the document comprising text;
dividing the document into a plurality of chunks of text;
indexing the plurality of chunks, the indexing comprising storing each chunk mapped to respective identifying metadata, the identifying metadata including a chunk index for each chunk;
receiving a query;
identifying a chunk relevant to the query;
formulating a prompt including the query, the identified relevant chunk, and a subsequent chunk with a subsequent chunk index immediately following a chunk index of the identified relevant chunk;
providing the prompt to a language model;
receiving, from the language model, output based on the prompt; and
returning an answer to the query based on the received output.

### Claim 9 (depends on 8)

The system of claim 8, wherein identifying the chunk relevant to the query comprises:
embedding a plurality of indexed chunks;
embedding the query;
comparing each of the plurality of chunk embeddings to the query embedding to generate a similarity score for each chunk embedding; and
selecting the chunk with a highest similarity score.

### Claim 10 (depends on 9)

The system of claim 9, wherein:
comparing the plurality of chunk embeddings to the query embedding comprises computing the similarity score for each chunk embedding based on cosine similarity.

### Claim 11 (depends on 8)

The system of claim 8, the operations further comprising:
identifying a file type of the document; and
dividing the document into the plurality of chunks according to the file type.

### Claim 12 (depends on 11)

The system of claim 11, wherein the file type is portable document format (PDF) and the dividing the document into the plurality of chunks comprises parsing the document into multiple sentence objects and storing a chunk for each sentence object.

### Claim 13 (depends on 11)

The system of claim 11, wherein the file type is comma-separated values (CSV) comprising rows, columns, and cells, and the dividing the document into the plurality of chunks comprises appending a column header to each cell and converting each row to a chunk.

### Claim 14 (depends on 8)

The system of claim 8, the operations further comprising:
identifying a size limit of a context input section for the language model;
comparing a size of the chunk and the subsequent chunk to the size limit; and
resizing the size of the chunk and the subsequent chunk to be less than or equal to the size limit.

### Claim 15

One or more non-transitory computer-readable media storing instructions which, when executed by one or more processors, cause a system to perform the following operations:
accessing a document, the document comprising text;
dividing the document into a plurality of chunks of text;
indexing the plurality of chunks, the indexing comprising storing each chunk mapped to respective identifying metadata, the identifying metadata including a chunk index for each chunk;
receiving a query;
identifying a chunk relevant to the query;
formulating a prompt including the query, the identified relevant chunk, and a subsequent chunk with a subsequent chunk index immediately following a chunk index of the identified relevant chunk;
providing the prompt to a language model;
receiving, from the language model, output based on the prompt; and
returning an answer to the query based on the received output.

### Claim 16 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, wherein identifying the chunk relevant to the query comprises:
embedding a plurality of indexed chunks;
embedding the query;
comparing each of the plurality of chunk embeddings to the query embedding to generate a similarity score for each chunk embedding; and
selecting the chunk with a highest similarity score.

### Claim 17 (depends on 16)

The one or more non-transitory computer-readable media of claim 16, wherein:
comparing the plurality of chunk embeddings to the query embedding comprises computing the similarity score for each chunk embedding based on cosine similarity.

### Claim 18 (depends on 15)

The one or more non-transitory computer-readable media of claim 15, the operations further comprising:
identifying a file type of the document; and
dividing the document into the plurality of chunks according to the file type.

### Claim 19 (depends on 18)

The one or more non-transitory computer-readable media of claim 18, wherein the file type is portable document format (PDF) and the dividing the document into the plurality of chunks comprises parsing the document into multiple sentence objects and storing a chunk for each sentence object.

### Claim 20 (depends on 18)

The one or more non-transitory computer-readable media of claim 18, wherein the file type is comma-separated values (CSV) comprising rows, columns, and cells, and the dividing the document into the plurality of chunks comprises appending a column header to each cell and converting each row to a chunk.
