FOSSredder 0.5.0
Loading...
Searching...
No Matches
core::domain::policies::matching Namespace Reference

Functions

std::string trim (std::string value)
 Trims whitespace from raw text.
bool matchesDraftText (const std::string &left, const std::string &right)
 Compares two pieces of draft text after normalization.
std::vector< std::string > splitLines (const std::string &text)
 Splits text into non-empty normalized lines.
std::string joinNonEmptyLines (const std::vector< std::string > &values, const std::string &separator)
 Joins non-empty lines with a separator.
bool lineLooksMetadataBoundary (const std::string &line)
 Checks whether a line looks like a metadata boundary.
bool lineLooksActorStopSignal (const std::string &line)
 Checks whether a line should stop actor extraction.
bool lineLooksActorContinuation (const std::string &line)
 Checks whether a line can continue actor extraction.
std::string firstMeaningfulLine (const std::string &text)
 Returns the first meaningful line of text.
std::string leadingPhrase (const std::string &text, std::size_t maxTokens)
 Extracts a leading phrase from text.
std::string normalizeText (std::string text)
 Normalizes draft text for matching.
std::vector< std::string > tokens (const std::string &text)
 Splits normalized text into tokens.
std::string leadingText (const std::string &text, std::size_t maxTokens)
 Returns a leading slice of the normalized text.
bool tokenIsMatchable (const std::string &token)
 Checks whether a token is useful for matching.
int tokenOverlapScore (const std::vector< std::string > &sourceTokens, const std::vector< std::string > &targetTokens)
 Scores token overlap between two token lists.
double aliasHitWeight (int hitCount)
 Computes a score weight from alias hit count.
double aliasRecencyWeight (const std::string &lastUsedAt)
 Computes a score weight from alias recency.
std::string metadataSignalText (const std::string &metadata)
 Normalizes metadata into signal text.
std::vector< std::string > referenceAliasesFromMetadata (const std::string &metadata)
 Extracts reference-like aliases from metadata.
std::vector< std::string > knownContractTypes (const core::domain::catalog::WorkspaceCatalog &state)
 Collects known contract types from the workspace state.
std::string extractTypeText (const core::domain::catalog::WorkspaceCatalog &state, const std::string &signalText, const std::vector< std::string > &lines)
 Extracts a contract type hint from draft text.
std::string extractActorText (const std::vector< std::string > &lines, const std::string &typeText)
 Extracts an actor hint from draft text.

Function Documentation

◆ aliasHitWeight()

double core::domain::policies::matching::aliasHitWeight ( int hitCount)

Computes a score weight from alias hit count.

Parameters
hitCountAlias hit count.
Returns
Weight factor.

Definition at line 217 of file DraftMatchingPolicy.cpp.

◆ aliasRecencyWeight()

double core::domain::policies::matching::aliasRecencyWeight ( const std::string & lastUsedAt)

Computes a score weight from alias recency.

Parameters
lastUsedAtLast-used timestamp.
Returns
Weight factor.

Definition at line 222 of file DraftMatchingPolicy.cpp.

◆ extractActorText()

std::string core::domain::policies::matching::extractActorText ( const std::vector< std::string > & lines,
const std::string & typeText )

Extracts an actor hint from draft text.

Parameters
linesDraft lines.
typeTextAlready resolved type text.
Returns
Best matching actor text or an empty string.

Definition at line 354 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ extractTypeText()

std::string core::domain::policies::matching::extractTypeText ( const core::domain::catalog::WorkspaceCatalog & state,
const std::string & signalText,
const std::vector< std::string > & lines )

Extracts a contract type hint from draft text.

Parameters
stateWorkspace snapshot.
signalTextCombined signal text.
linesDraft lines.
Returns
Best matching contract type or an empty string.

Definition at line 300 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ firstMeaningfulLine()

std::string core::domain::policies::matching::firstMeaningfulLine ( const std::string & text)

Returns the first meaningful line of text.

Parameters
textRaw multiline text.
Returns
The first non-empty normalized line.

Definition at line 144 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ joinNonEmptyLines()

std::string core::domain::policies::matching::joinNonEmptyLines ( const std::vector< std::string > & values,
const std::string & separator )

Joins non-empty lines with a separator.

Parameters
valuesInput lines.
separatorSeparator string.
Returns
Joined text.

Definition at line 83 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knownContractTypes()

std::vector< std::string > core::domain::policies::matching::knownContractTypes ( const core::domain::catalog::WorkspaceCatalog & state)

Collects known contract types from the workspace state.

Parameters
stateWorkspace snapshot.
Returns
Known contract type labels.

Definition at line 282 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leadingPhrase()

std::string core::domain::policies::matching::leadingPhrase ( const std::string & text,
std::size_t maxTokens )

Extracts a leading phrase from text.

Parameters
textRaw text.
maxTokensMaximum number of tokens to keep.
Returns
Leading phrase text.

Definition at line 152 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ leadingText()

std::string core::domain::policies::matching::leadingText ( const std::string & text,
std::size_t maxTokens )

Returns a leading slice of the normalized text.

Parameters
textRaw text.
maxTokensMaximum number of tokens to keep.
Returns
Leading normalized text.

Definition at line 189 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ lineLooksActorContinuation()

bool core::domain::policies::matching::lineLooksActorContinuation ( const std::string & line)

Checks whether a line can continue actor extraction.

Parameters
lineRaw line text.
Returns
true when the line looks like actor continuation text.

Definition at line 123 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lineLooksActorStopSignal()

bool core::domain::policies::matching::lineLooksActorStopSignal ( const std::string & line)

Checks whether a line should stop actor extraction.

Parameters
lineRaw line text.
Returns
true when the line indicates that actor text ended.

Definition at line 107 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lineLooksMetadataBoundary()

bool core::domain::policies::matching::lineLooksMetadataBoundary ( const std::string & line)

Checks whether a line looks like a metadata boundary.

Parameters
lineRaw line text.
Returns
true when the line resembles metadata.

Definition at line 97 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ matchesDraftText()

bool core::domain::policies::matching::matchesDraftText ( const std::string & left,
const std::string & right )

Compares two pieces of draft text after normalization.

Parameters
leftLeft text.
rightRight text.
Returns
true when the normalized texts are equal.

Definition at line 59 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ metadataSignalText()

std::string core::domain::policies::matching::metadataSignalText ( const std::string & metadata)

Normalizes metadata into signal text.

Parameters
metadataRaw metadata text.
Returns
Signal text derived from metadata.

Definition at line 228 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ normalizeText()

std::string core::domain::policies::matching::normalizeText ( std::string text)

Normalizes draft text for matching.

Parameters
textRaw text.
Returns
Normalized comparison text.

Definition at line 166 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ referenceAliasesFromMetadata()

std::vector< std::string > core::domain::policies::matching::referenceAliasesFromMetadata ( const std::string & metadata)

Extracts reference-like aliases from metadata.

Parameters
metadataRaw metadata text.
Returns
Candidate reference aliases.

Definition at line 264 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ splitLines()

std::vector< std::string > core::domain::policies::matching::splitLines ( const std::string & text)

Splits text into non-empty normalized lines.

Parameters
textRaw multiline text.
Returns
Normalized lines.

Definition at line 64 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tokenIsMatchable()

bool core::domain::policies::matching::tokenIsMatchable ( const std::string & token)

Checks whether a token is useful for matching.

Parameters
tokenRaw token.
Returns
true when the token can contribute to matching.

Definition at line 200 of file DraftMatchingPolicy.cpp.

Here is the caller graph for this function:

◆ tokenOverlapScore()

int core::domain::policies::matching::tokenOverlapScore ( const std::vector< std::string > & sourceTokens,
const std::vector< std::string > & targetTokens )

Scores token overlap between two token lists.

Parameters
sourceTokensCandidate tokens.
targetTokensQuery tokens.
Returns
Overlap score.

Definition at line 206 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:

◆ tokens()

std::vector< std::string > core::domain::policies::matching::tokens ( const std::string & text)

Splits normalized text into tokens.

Parameters
textRaw text.
Returns
Tokens extracted from the text.

Definition at line 181 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim()

std::string core::domain::policies::matching::trim ( std::string value)

Trims whitespace from raw text.

Parameters
valueRaw text.
Returns
Trimmed text or an empty string.

Definition at line 54 of file DraftMatchingPolicy.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: