@xapp/stentor-service-generative-ai 1.83.0 → 1.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/lib/AWSBedrockService.d.ts +0 -67
- package/lib/AWSBedrockService.js +0 -133
- package/lib/AWSBedrockService.js.map +0 -1
- package/lib/ClaudeService.d.ts +0 -77
- package/lib/ClaudeService.js +0 -142
- package/lib/ClaudeService.js.map +0 -1
- package/lib/FallbackLLMService.d.ts +0 -46
- package/lib/FallbackLLMService.js +0 -83
- package/lib/FallbackLLMService.js.map +0 -1
- package/lib/GenerativeAIService.d.ts +0 -40
- package/lib/GenerativeAIService.js +0 -108
- package/lib/GenerativeAIService.js.map +0 -1
- package/lib/OpenAIService.d.ts +0 -33
- package/lib/OpenAIService.js +0 -76
- package/lib/OpenAIService.js.map +0 -1
- package/lib/http/HTTPService.d.ts +0 -18
- package/lib/http/HTTPService.js +0 -4
- package/lib/http/HTTPService.js.map +0 -1
- package/lib/http/NodeHTTPService.d.ts +0 -8
- package/lib/http/NodeHTTPService.js +0 -70
- package/lib/http/NodeHTTPService.js.map +0 -1
- package/lib/http/index.d.ts +0 -3
- package/lib/http/index.js +0 -20
- package/lib/http/index.js.map +0 -1
- package/lib/index.d.ts +0 -10
- package/lib/index.js +0 -27
- package/lib/index.js.map +0 -1
- package/lib/models/ChatSummary.d.ts +0 -10
- package/lib/models/ChatSummary.js +0 -4
- package/lib/models/ChatSummary.js.map +0 -1
- package/lib/models/EmailAnalysis.d.ts +0 -73
- package/lib/models/EmailAnalysis.js +0 -4
- package/lib/models/EmailAnalysis.js.map +0 -1
- package/lib/models/GenerativeAIService.d.ts +0 -55
- package/lib/models/GenerativeAIService.js +0 -3
- package/lib/models/GenerativeAIService.js.map +0 -1
- package/lib/models/LLMService.d.ts +0 -24
- package/lib/models/LLMService.js +0 -4
- package/lib/models/LLMService.js.map +0 -1
- package/lib/models/LeadAnalysis.d.ts +0 -105
- package/lib/models/LeadAnalysis.js +0 -4
- package/lib/models/LeadAnalysis.js.map +0 -1
- package/lib/models/Prompt.d.ts +0 -37
- package/lib/models/Prompt.js +0 -8
- package/lib/models/Prompt.js.map +0 -1
- package/lib/models/PromptGenerator.d.ts +0 -6
- package/lib/models/PromptGenerator.js +0 -4
- package/lib/models/PromptGenerator.js.map +0 -1
- package/lib/models/ResponseParser.d.ts +0 -5
- package/lib/models/ResponseParser.js +0 -4
- package/lib/models/ResponseParser.js.map +0 -1
- package/lib/models/WebsiteAnalysis.d.ts +0 -48
- package/lib/models/WebsiteAnalysis.js +0 -4
- package/lib/models/WebsiteAnalysis.js.map +0 -1
- package/lib/models/errors.d.ts +0 -7
- package/lib/models/errors.js +0 -15
- package/lib/models/errors.js.map +0 -1
- package/lib/models/index.d.ts +0 -9
- package/lib/models/index.js +0 -26
- package/lib/models/index.js.map +0 -1
- package/lib/prompts/AnalyzeEmail.d.ts +0 -36
- package/lib/prompts/AnalyzeEmail.js +0 -385
- package/lib/prompts/AnalyzeEmail.js.map +0 -1
- package/lib/prompts/AnalyzeLead.d.ts +0 -59
- package/lib/prompts/AnalyzeLead.js +0 -396
- package/lib/prompts/AnalyzeLead.js.map +0 -1
- package/lib/prompts/AnalyzeWebsite.d.ts +0 -10
- package/lib/prompts/AnalyzeWebsite.js +0 -176
- package/lib/prompts/AnalyzeWebsite.js.map +0 -1
- package/lib/prompts/ChatSummary.d.ts +0 -62
- package/lib/prompts/ChatSummary.js +0 -67
- package/lib/prompts/ChatSummary.js.map +0 -1
- package/lib/prompts/index.d.ts +0 -4
- package/lib/prompts/index.js +0 -21
- package/lib/prompts/index.js.map +0 -1
- package/lib/utils/extractJSON.d.ts +0 -10
- package/lib/utils/extractJSON.js +0 -17
- package/lib/utils/extractJSON.js.map +0 -1
- package/lib/utils/standardizeTerms.d.ts +0 -15
- package/lib/utils/standardizeTerms.js +0 -53
- package/lib/utils/standardizeTerms.js.map +0 -1
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
import type { ExternalLead } from "stentor-models";
|
|
3
|
-
import type { CompletionPrompt, PromptGenerator, ResponseParser } from "../models";
|
|
4
|
-
import type { ChatSummary } from "../models/ChatSummary";
|
|
5
|
-
/**
|
|
6
|
-
* A conversation line that was said by the user or system.
|
|
7
|
-
*/
|
|
8
|
-
export interface SummaryLine {
|
|
9
|
-
/**
|
|
10
|
-
* The user that said the line.
|
|
11
|
-
*/
|
|
12
|
-
user: string;
|
|
13
|
-
/**
|
|
14
|
-
* The content that was said by the user.
|
|
15
|
-
*/
|
|
16
|
-
line: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The properties that are required to generate a chat summary prompt.
|
|
20
|
-
*/
|
|
21
|
-
export interface ChatSummaryPromptProps {
|
|
22
|
-
/**
|
|
23
|
-
* The lines that were said in the conversation.
|
|
24
|
-
*/
|
|
25
|
-
summary: SummaryLine[];
|
|
26
|
-
}
|
|
27
|
-
export interface ChatSummaryFromLeadTranscriptProps {
|
|
28
|
-
/**
|
|
29
|
-
* The transcript of a found lead.
|
|
30
|
-
*/
|
|
31
|
-
transcript: ExternalLead["transcript"];
|
|
32
|
-
}
|
|
33
|
-
export type ChatSummaryLLMOverrides = Partial<Pick<CompletionPrompt, "model" | "max_tokens" | "temperature" | "top_p" | "frequency_penalty" | "presence_penalty">>;
|
|
34
|
-
/**
|
|
35
|
-
* Generate a prompt that can be used in an LLM to return a summary of a chat conversation from a lead transcript.
|
|
36
|
-
*
|
|
37
|
-
* The expected output format from the LLM will be:
|
|
38
|
-
*
|
|
39
|
-
* <Full summary of the text>
|
|
40
|
-
*
|
|
41
|
-
* @param transcript - The summary transcript of the chat.
|
|
42
|
-
* @param overrides
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
export declare const generateChatSummaryPromptFromLeadTranscript: PromptGenerator<ChatSummaryFromLeadTranscriptProps, ChatSummaryLLMOverrides, CompletionPrompt>;
|
|
46
|
-
/**
|
|
47
|
-
* Generates a prompt that can be used in an LLM to return a summary of a chat conversation.
|
|
48
|
-
*
|
|
49
|
-
* The expected output format from the LLM will be:
|
|
50
|
-
*
|
|
51
|
-
* <Full summary of the text>
|
|
52
|
-
*
|
|
53
|
-
* @param summary - The summary transcript of the chat.
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
export declare const generateChatSummaryPrompt: PromptGenerator<ChatSummaryPromptProps, ChatSummaryLLMOverrides, CompletionPrompt>;
|
|
57
|
-
/**
|
|
58
|
-
* Parser for the Chat Summary response.
|
|
59
|
-
* @param response
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
export declare const chatSummaryResponseParse: ResponseParser<ChatSummary>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.chatSummaryResponseParse = exports.generateChatSummaryPrompt = exports.generateChatSummaryPromptFromLeadTranscript = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Generate a prompt that can be used in an LLM to return a summary of a chat conversation from a lead transcript.
|
|
7
|
-
*
|
|
8
|
-
* The expected output format from the LLM will be:
|
|
9
|
-
*
|
|
10
|
-
* <Full summary of the text>
|
|
11
|
-
*
|
|
12
|
-
* @param transcript - The summary transcript of the chat.
|
|
13
|
-
* @param overrides
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
const generateChatSummaryPromptFromLeadTranscript = ({ transcript }, overrides) => {
|
|
17
|
-
const summary = transcript.map(({ from, message }) => ({
|
|
18
|
-
user: (from === null || from === void 0 ? void 0 : from.name) || (from === null || from === void 0 ? void 0 : from.email) || (from === null || from === void 0 ? void 0 : from.phone) || (from === null || from === void 0 ? void 0 : from.id) || "Unknown",
|
|
19
|
-
line: message
|
|
20
|
-
}));
|
|
21
|
-
return (0, exports.generateChatSummaryPrompt)({ summary }, overrides);
|
|
22
|
-
};
|
|
23
|
-
exports.generateChatSummaryPromptFromLeadTranscript = generateChatSummaryPromptFromLeadTranscript;
|
|
24
|
-
/**
|
|
25
|
-
* Generates a prompt that can be used in an LLM to return a summary of a chat conversation.
|
|
26
|
-
*
|
|
27
|
-
* The expected output format from the LLM will be:
|
|
28
|
-
*
|
|
29
|
-
* <Full summary of the text>
|
|
30
|
-
*
|
|
31
|
-
* @param summary - The summary transcript of the chat.
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
const generateChatSummaryPrompt = ({ summary }, overrides) => {
|
|
35
|
-
return Object.assign(Object.assign({ model: "gpt-4o-mini", max_tokens: 256, frequency_penalty: 0, temperature: 1, top_p: 1, presence_penalty: 0 }, overrides), { response_format: {
|
|
36
|
-
type: "text"
|
|
37
|
-
}, type: "completions", messages: [{
|
|
38
|
-
role: "system",
|
|
39
|
-
content: "Summarize the transcript of a chat between a business's bot on a website and a person." +
|
|
40
|
-
"Please summarize as if you are the bot in the transcript and you are taking notes for somebody that will be able to help the person with their query. You may use first person." +
|
|
41
|
-
"Do not call the user, \"user\" but instead use \"Someone\", \"Somebody\" or if they give their name you can use their first name however not last name." +
|
|
42
|
-
"If the transcript contains additional identifying information from the user, such as last name, phone number, email address, or addresses then do not include theses in the summary. If the bot provided contact information for the business, you may include it in your summary." +
|
|
43
|
-
"The summary will be then be provided to the business owner so they are aware somebody will be in touch soon with the request they mentioned in the transcript." +
|
|
44
|
-
"Keep the summary to one sentence around 100 words." +
|
|
45
|
-
"An example of a good summary is:" +
|
|
46
|
-
"\"Somebody reached out looking for a quote and I provided them with your contact information.\"" +
|
|
47
|
-
"or" +
|
|
48
|
-
"\"John reached out looking to schedule an appointment and I provided them with the scheduling link.\""
|
|
49
|
-
}, {
|
|
50
|
-
role: "user",
|
|
51
|
-
content: summary.map((s) => `${s.user}: ${s.line}`).join("\n")
|
|
52
|
-
}] });
|
|
53
|
-
};
|
|
54
|
-
exports.generateChatSummaryPrompt = generateChatSummaryPrompt;
|
|
55
|
-
/**
|
|
56
|
-
* Parser for the Chat Summary response.
|
|
57
|
-
* @param response
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
const chatSummaryResponseParse = (response) => {
|
|
61
|
-
const summary = response.trim();
|
|
62
|
-
return {
|
|
63
|
-
summary
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
exports.chatSummaryResponseParse = chatSummaryResponseParse;
|
|
67
|
-
//# sourceMappingURL=ChatSummary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSummary.js","sourceRoot":"","sources":["../../src/prompts/ChatSummary.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AAwClC;;;;;;;;;;GAUG;AACI,MAAM,2CAA2C,GAAmG,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,EAAoB,EAAE;IACvM,MAAM,OAAO,GAAkB,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAClE,IAAI,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,KAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,IAAI,SAAS;QACvE,IAAI,EAAE,OAAO;KAChB,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAA,iCAAyB,EAAC,EAAE,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC,CAAA;AAPY,QAAA,2CAA2C,+CAOvD;AAED;;;;;;;;;GASG;AACI,MAAM,yBAAyB,GAAuF,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAoB,EAAE;IACtK,qCACI,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,GAAG,EACf,iBAAiB,EAAE,CAAC,EACpB,WAAW,EAAE,CAAC,EACd,KAAK,EAAE,CAAC,EACR,gBAAgB,EAAE,CAAC,IAChB,SAAS,KACZ,eAAe,EAAE;YACb,IAAI,EAAE,MAAM;SACf,EACD,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,CAAC;gBACP,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wFAAwF;oBAC7F,kLAAkL;oBAClL,yJAAyJ;oBACzJ,qRAAqR;oBACrR,gKAAgK;oBAChK,oDAAoD;oBACpD,kCAAkC;oBAClC,iGAAiG;oBACjG,IAAI;oBACJ,uGAAuG;aAC9G,EAAE;gBACC,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aACjE,CAAC,IACL;AACL,CAAC,CAAA;AA9BY,QAAA,yBAAyB,6BA8BrC;AAED;;;;GAIG;AACI,MAAM,wBAAwB,GAAgC,CAAC,QAAQ,EAAE,EAAE;IAC9E,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO;QACH,OAAO;KACV,CAAC;AACN,CAAC,CAAA;AALY,QAAA,wBAAwB,4BAKpC"}
|
package/lib/prompts/index.d.ts
DELETED
package/lib/prompts/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./AnalyzeEmail"), exports);
|
|
19
|
-
__exportStar(require("./AnalyzeLead"), exports);
|
|
20
|
-
__exportStar(require("./ChatSummary"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/lib/prompts/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,iDAA+B;AAC/B,gDAA8B;AAC9B,gDAA8B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
-
/**
|
|
3
|
-
* Extracts a JSON string from an LLM response that may be wrapped in markdown
|
|
4
|
-
* code fences (e.g., ```json ... ```). Falls back to the raw response if no
|
|
5
|
-
* fences are found.
|
|
6
|
-
*
|
|
7
|
-
* This is necessary because Claude (Bedrock/Anthropic API) does not support
|
|
8
|
-
* `response_format: json_schema` and may wrap JSON output in markdown fences.
|
|
9
|
-
*/
|
|
10
|
-
export declare function extractJSON(response: string): string;
|
package/lib/utils/extractJSON.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*! Copyright (c) 2026, XAPP AI */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.extractJSON = extractJSON;
|
|
5
|
-
/**
|
|
6
|
-
* Extracts a JSON string from an LLM response that may be wrapped in markdown
|
|
7
|
-
* code fences (e.g., ```json ... ```). Falls back to the raw response if no
|
|
8
|
-
* fences are found.
|
|
9
|
-
*
|
|
10
|
-
* This is necessary because Claude (Bedrock/Anthropic API) does not support
|
|
11
|
-
* `response_format: json_schema` and may wrap JSON output in markdown fences.
|
|
12
|
-
*/
|
|
13
|
-
function extractJSON(response) {
|
|
14
|
-
const match = response.match(/```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/);
|
|
15
|
-
return match ? match[1].trim() : response;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=extractJSON.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractJSON.js","sourceRoot":"","sources":["../../src/utils/extractJSON.ts"],"names":[],"mappings":";AAAA,kCAAkC;;AAUlC,kCAGC;AAXD;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,QAAgB;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9C,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
/**
|
|
3
|
-
* Standardizes common terms and acronyms in text while preserving the overall phrasing.
|
|
4
|
-
* Automatically converts input to lowercase before processing and returns lowercased standardized terms.
|
|
5
|
-
*
|
|
6
|
-
* @param input - The text or array of texts to standardize (will be converted to lowercase)
|
|
7
|
-
* @returns The lowercased text(s) with standardized terms
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* standardizeTerms("A/C Repair Needed") // "hvac repair needed"
|
|
11
|
-
* standardizeTerms(["HVAC Maintenance", "ELEC Work"]) // ["hvac maintenance", "electrical work"]
|
|
12
|
-
* standardizeTerms("Elec work w/ permits") // "electrical work with permits"
|
|
13
|
-
*/
|
|
14
|
-
export declare function standardizeTerms(input: string): string;
|
|
15
|
-
export declare function standardizeTerms(input: string[]): string[];
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.standardizeTerms = standardizeTerms;
|
|
5
|
-
const TERM_STANDARDIZATIONS = {
|
|
6
|
-
// HVAC/Air Conditioning
|
|
7
|
-
"a/c": "hvac",
|
|
8
|
-
"air conditioning": "hvac",
|
|
9
|
-
"air conditioner": "hvac",
|
|
10
|
-
"hvac": "hvac",
|
|
11
|
-
"heating": "hvac",
|
|
12
|
-
"cooling": "hvac",
|
|
13
|
-
// Plumbing
|
|
14
|
-
"h2o": "water",
|
|
15
|
-
"hot water heater": "water heater",
|
|
16
|
-
"hwh": "water heater",
|
|
17
|
-
// Electrical
|
|
18
|
-
"elec": "electrical",
|
|
19
|
-
"electric": "electrical",
|
|
20
|
-
// General
|
|
21
|
-
"w/": "with",
|
|
22
|
-
"w/o": "without",
|
|
23
|
-
"&": "and"
|
|
24
|
-
};
|
|
25
|
-
function standardizeTerms(input) {
|
|
26
|
-
if (Array.isArray(input)) {
|
|
27
|
-
return input.map(text => standardizeTerms(text));
|
|
28
|
-
}
|
|
29
|
-
if (!input)
|
|
30
|
-
return input;
|
|
31
|
-
// Convert to lowercase first
|
|
32
|
-
let standardized = input.toLowerCase();
|
|
33
|
-
// Apply each standardization using word boundaries to avoid partial matches
|
|
34
|
-
for (const [variant, standard] of Object.entries(TERM_STANDARDIZATIONS)) {
|
|
35
|
-
// Escape special regex characters, including forward slash
|
|
36
|
-
const escapedVariant = variant.replace(/[.*+?^${}()|[\]\\\/]/g, '\\$&');
|
|
37
|
-
// For variants that contain non-word characters (like & or /), we need different boundary matching
|
|
38
|
-
const hasNonWordChars = /[^\w\s]/.test(variant);
|
|
39
|
-
let regex;
|
|
40
|
-
if (hasNonWordChars) {
|
|
41
|
-
// Use space boundaries or start/end of string for non-word character variants
|
|
42
|
-
regex = new RegExp(`(^|\\s)${escapedVariant}(\\s|$)`, 'g');
|
|
43
|
-
standardized = standardized.replace(regex, `$1${standard}$2`);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// Use word boundaries for normal word variants
|
|
47
|
-
regex = new RegExp(`\\b${escapedVariant}\\b`, 'g');
|
|
48
|
-
standardized = standardized.replace(regex, standard);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return standardized;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=standardizeTerms.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standardizeTerms.js","sourceRoot":"","sources":["../../src/utils/standardizeTerms.ts"],"names":[],"mappings":";AAAA,kCAAkC;;AAwClC,4CA+BC;AArED,MAAM,qBAAqB,GAA2B;IAClD,wBAAwB;IACxB,KAAK,EAAE,MAAM;IACb,kBAAkB,EAAE,MAAM;IAC1B,iBAAiB,EAAE,MAAM;IACzB,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IAEjB,WAAW;IACX,KAAK,EAAE,OAAO;IACd,kBAAkB,EAAE,cAAc;IAClC,KAAK,EAAE,cAAc;IAErB,aAAa;IACb,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,YAAY;IAExB,UAAU;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,KAAK;CACb,CAAC;AAgBF,SAAgB,gBAAgB,CAAC,KAAwB;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEzB,6BAA6B;IAC7B,IAAI,YAAY,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAEvC,4EAA4E;IAC5E,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACtE,2DAA2D;QAC3D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;QAExE,mGAAmG;QACnG,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhD,IAAI,KAAa,CAAC;QAClB,IAAI,eAAe,EAAE,CAAC;YAClB,8EAA8E;YAC9E,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,cAAc,SAAS,EAAE,GAAG,CAAC,CAAC;YAC3D,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACJ,+CAA+C;YAC/C,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,cAAc,KAAK,EAAE,GAAG,CAAC,CAAC;YACnD,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC"}
|