CoreferenceResolver

org.llm4s.knowledgegraph.extraction.CoreferenceResolver
class CoreferenceResolver(llmClient: LLMClient)

Resolves coreferences within a document before knowledge graph extraction.

Uses an LLM to replace pronouns and indirect references (e.g., "he", "the company", "its founder") with explicit entity names. This pre-processing step reduces duplicate nodes that would otherwise be created when the extractor encounters unresolved references.

Value parameters

llmClient

The LLM client to use for coreference resolution

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def resolve(text: String): Result[String]

Resolves coreferences in the given text by replacing pronouns and indirect references with their explicit referents.

Resolves coreferences in the given text by replacing pronouns and indirect references with their explicit referents.

Value parameters

text

The text to resolve coreferences in

Attributes

Returns

The resolved text with pronouns replaced, or the original text if no changes needed