FOSSredder 0.5.0
Loading...
Searching...
No Matches
DraftMatchingPolicy.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <cstddef>
9#include <string>
10#include <vector>
11
13
15
21std::string trim(std::string value);
28bool matchesDraftText(const std::string& left, const std::string& right);
34std::vector<std::string> splitLines(const std::string& text);
41std::string joinNonEmptyLines(const std::vector<std::string>& values, const std::string& separator);
47bool lineLooksMetadataBoundary(const std::string& line);
53bool lineLooksActorStopSignal(const std::string& line);
59bool lineLooksActorContinuation(const std::string& line);
65std::string firstMeaningfulLine(const std::string& text);
72std::string leadingPhrase(const std::string& text, std::size_t maxTokens);
78std::string normalizeText(std::string text);
84std::vector<std::string> tokens(const std::string& text);
91std::string leadingText(const std::string& text, std::size_t maxTokens);
97bool tokenIsMatchable(const std::string& token);
104int tokenOverlapScore(const std::vector<std::string>& sourceTokens,
105 const std::vector<std::string>& targetTokens);
111double aliasHitWeight(int hitCount);
117double aliasRecencyWeight(const std::string& lastUsedAt);
123std::string metadataSignalText(const std::string& metadata);
129std::vector<std::string> referenceAliasesFromMetadata(const std::string& metadata);
135std::vector<std::string> knownContractTypes(const core::domain::catalog::WorkspaceCatalog& state);
144 const std::string& signalText,
145 const std::vector<std::string>& lines);
152std::string extractActorText(const std::vector<std::string>& lines, const std::string& typeText);
153
154} // namespace core::domain::policies::matching
Domain aggregate that stores catalog entities for one workspace.
bool lineLooksActorStopSignal(const std::string &line)
Checks whether a line should stop actor extraction.
std::vector< std::string > splitLines(const std::string &text)
Splits text into non-empty normalized lines.
std::vector< std::string > referenceAliasesFromMetadata(const std::string &metadata)
Extracts reference-like aliases from metadata.
bool matchesDraftText(const std::string &left, const std::string &right)
Compares two pieces of draft text after normalization.
bool lineLooksMetadataBoundary(const std::string &line)
Checks whether a line looks like a metadata boundary.
bool tokenIsMatchable(const std::string &token)
Checks whether a token is useful for matching.
std::string extractActorText(const std::vector< std::string > &lines, const std::string &typeText)
Extracts an actor hint from draft text.
std::string trim(std::string value)
Trims whitespace from raw text.
bool lineLooksActorContinuation(const std::string &line)
Checks whether a line can continue actor extraction.
std::string metadataSignalText(const std::string &metadata)
Normalizes metadata into signal text.
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 leadingPhrase(const std::string &text, std::size_t maxTokens)
Extracts a leading phrase from text.
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 joinNonEmptyLines(const std::vector< std::string > &values, const std::string &separator)
Joins non-empty lines with a separator.
std::string leadingText(const std::string &text, std::size_t maxTokens)
Returns a leading slice of the normalized text.
std::string firstMeaningfulLine(const std::string &text)
Returns the first meaningful line of text.
std::vector< std::string > knownContractTypes(const core::domain::catalog::WorkspaceCatalog &state)
Collects known contract types from the workspace state.
std::vector< std::string > tokens(const std::string &text)
Splits normalized text into tokens.
std::string normalizeText(std::string text)
Normalizes draft text for matching.