> ## Documentation Index
> Fetch the complete documentation index at: https://developers.remeinium.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Converter (Core)

The core module provides stateless functions for converting Singlish strings to Sinhala.

## Functions

### `convertSinglishToSinhala`

Main conversion function. Converts a given Singlish string into Sinhala Unicode text.

```typescript theme={null}
function convertSinglishToSinhala(
  text: string,
  options?: ConversionOptions
): string
```

#### Parameters

* `text` (`string`): The input Singlish text.
* `options` (`ConversionOptions`, optional): Configuration for conversion.

#### Returns

* `string`: The converted Sinhala text.

***

### `convertLastWord`

Converts only the last word in a string, preserving the prefix. Useful for simple input handling where only the current word should be processed.

```typescript theme={null}
function convertLastWord(
  text: string,
  options?: ConversionOptions
): string
```

#### Parameters

* `text` (`string`): The input text containing multiple words.
* `options` (`ConversionOptions`, optional): Configuration.

#### Returns

* `string`: The text with only the last word converted.

***

### `isSinhalaChar`

Checks if a single character is within the Sinhala Unicode block.

```typescript theme={null}
function isSinhalaChar(char: string): boolean
```

#### Parameters

* `char` (`string`): The character to check.

#### Returns

* `boolean`: `true` if the character is Sinhala.

***

### `containsSinhala`

Checks if a string contains *any* Sinhala characters.

```typescript theme={null}
function containsSinhala(text: string): boolean
```

#### Parameters

* `text` (`string`): The input string.

#### Returns

* `boolean`: `true` if at least one character is Sinhala.

***

### `convertWithMetadata`

Converts text and returns metadata about the conversion.

```typescript theme={null}
function convertWithMetadata(
  text: string,
  options?: ConversionOptions
): ConversionResult
```

***

### `segmentText`

Segments text into conversion-aware token groups.

```typescript theme={null}
function segmentText(
  text: string,
  options?: ConversionOptions
): string[]
```

## Types

### `ConversionOptions`

```typescript theme={null}
interface ConversionOptions {
  /**
   * Whether to preserve non-Sinhala characters (numbers, punctuation, English)
   * @default true
   */
  preserveNonSinhala?: boolean;

  /**
   * Maximum pattern length to attempt matching
   * @default 4
   */
  maxPatternLength?: number;
}
```
