TextStyleValidator
chainalign-backend / services/textQualityService / TextStyleValidator
Class: TextStyleValidator
Defined in: services/textQualityService.js:112
TextStyleValidator class to enforce ChainAlign's text quality standards.
Constructors
Constructor
new TextStyleValidator(
styleGuideConfig,tenantId,user):TextStyleValidator
Defined in: services/textQualityService.js:113
Parameters
styleGuideConfig
any
tenantId
any
user
any
Returns
TextStyleValidator
Properties
bannedPhrases
bannedPhrases:
any
Defined in: services/textQualityService.js:115
contentModerator
contentModerator:
GeminiContentModerator
Defined in: services/textQualityService.js:121
contentPolicies
contentPolicies:
any
Defined in: services/textQualityService.js:117
llmIssueThresholds
llmIssueThresholds:
any
Defined in: services/textQualityService.js:116
nuancedGuardrailPolicies
nuancedGuardrailPolicies:
any
Defined in: services/textQualityService.js:118
readabilityAnalyzer
readabilityAnalyzer:
ReadabilityAnalyzer
Defined in: services/textQualityService.js:120
styleGuideConfig
styleGuideConfig:
any
Defined in: services/textQualityService.js:114
toneClassifier
toneClassifier:
ToneClassifier
Defined in: services/textQualityService.js:119
Methods
_analyzeTone()
_analyzeTone(
text):number
Defined in: services/textQualityService.js:191
Parameters
text
any
Returns
number
_calculateReadability()
_calculateReadability(
text):number
Defined in: services/textQualityService.js:195
Parameters
text
any
Returns
number
_checkBannedPhrases()
_checkBannedPhrases(
text):string[]
Defined in: services/textQualityService.js:147
Parameters
text
any
Returns
string[]
_checkForLLMIssues()
_checkForLLMIssues(
text):string[]
Defined in: services/textQualityService.js:174
Parameters
text
any
Returns
string[]
_checkGrammarAndSpelling()
_checkGrammarAndSpelling(
text):Promise<any>
Defined in: services/textQualityService.js:124
Parameters
text
any
Returns
Promise<any>
_enforceContentPolicies()
_enforceContentPolicies(
text):string[]
Defined in: services/textQualityService.js:157
Parameters
text
any
Returns
string[]
validateText()
validateText(
text):ValidationResult
Defined in: services/textQualityService.js:204
Validates the given text against the defined style guide.
Parameters
text
string
The text to validate.
Returns
ValidationResult
- The result of the validation.