@aituber-onair/core 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # AITuber OnAir Core
2
2
 
3
- ![AITuber OnAir Core - logo](./images/aituber-onair-core.png)
3
+ ![AITuber OnAir Core - logo](https://raw.githubusercontent.com/shinshin86/aituber-onair/refs/heads/main/packages/core/images/aituber-onair-core.png)
4
4
 
5
5
  **AITuber OnAir Core** is a TypeScript library developed to provide functionality for the [AITuber OnAir](https://aituberonair.com) web service, designed for AI-based virtual streaming (AITuber).
6
6
 
7
- [日本語版はこちら](./README_ja.md)
7
+ [日本語版はこちら](https://github.com/shinshin86/aituber-onair/blob/main/packages/core/README_ja.md)
8
8
 
9
9
  While it is primarily intended for use within [AITuber OnAir](https://aituberonair.com), this project is available as open-source software under the MIT License and can be used freely.
10
10
 
@@ -2,7 +2,8 @@
2
2
  * Extract emotion from text using regex
3
3
  * Extract emotion from text written in the format [happy], [sad], etc.
4
4
  */
5
- const EMOTION_REGEX = /^\s*\[([a-z]+)\]\s*/i;
5
+ const EMOTION_REGEX = /\[([a-z]+)\]/i;
6
+ const EMOTION_CLEANUP_REGEX = /\[[a-z]+\]\s*/gi;
6
7
  /**
7
8
  * Convert text to screenplay (text with emotion)
8
9
  * @param text Original text (may contain emotion expressions like [happy])
@@ -12,7 +13,8 @@ export function textToScreenplay(text) {
12
13
  const match = text.match(EMOTION_REGEX);
13
14
  if (match) {
14
15
  const emotion = match[1].toLowerCase();
15
- const cleanText = text.replace(EMOTION_REGEX, '');
16
+ // Remove all emotion tags from the text and trim whitespace
17
+ const cleanText = text.replace(EMOTION_CLEANUP_REGEX, '').trim();
16
18
  return {
17
19
  emotion,
18
20
  text: cleanText,
@@ -1 +1 @@
1
- {"version":3,"file":"screenplay.js","sourceRoot":"","sources":["../../src/utils/screenplay.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH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AC;QACvC,4DAA4D;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACjE,OAAO;YACL,OAAO;YACP,IAAI,EAAE,SAAS;SAChB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAe;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAsB;IACrD,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO,IAAI,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aituber-onair/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Core library for AITuber OnAir providing voice synthesis and chat processing",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",