uttrflow / uttrflow/uttrflow-swift

A Devanagari sentence that already ends in "।" gets a second full stop: "है।."

Open Beginner friendly
#701 1 comment 0 reactions 0 assignees View on GitHub
area:dictation bug good first issue P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

`WordShape.finished` adds a full stop unless the word already ends in one of its `finishers`. The Devanagari danda "।" (U+0964) isn't one of them (`Sources/UttrflowCore/Cleaning/WordShape.swift:54`):

```swift
static let finishers: Set = [",", ".", ";", ":", "!", "?", "\u{2026}", ")", "]", "}"]
```

The same three-mark set is used elsewhere: `endsSentence` (`WordShape.swift:28`) and `SentenceCount.ends` (`Sources/UttrflowCore/Models/DestinationFormatter.swift:51`). `TerminalStopPass` calls `finished` at `Sources/UttrflowAI/Passes/TerminalStopPass.swift:40` and `:63`.

```
$ uttrflow-dev clean -e rules "मेरी फ्लाइट 15 अगस्त को सुबह 9 बजे है।"
clean मेरी फ्लाइट 15 अगस्त को सुबह 9 बजे है।.
```

The same thing happened in a real pipeline run. The recogniser wrote "…9 बजे है।" for a `say -v Lekha` clip, and the rules cleaner inserted "…9 बजे है।.".

The double-danda "॥" (U+0965) is missing too.

## Why it matters

Hindi dictation is tidied by the rules most of the time (#445), and the rules keep Devanagari. So every Hindi sentence the recogniser ends with "।" arrives with a stray Latin full stop after it, which the user has to delete by hand.

## Acceptance criteria

- "।" and "॥" count as sentence-ending marks in `WordShape.finishers`, `WordShape.endsSentence` and `SentenceCount.ends`.
- `uttrflow-dev clean -e rules "…बजे है।"` leaves the text unchanged.
- Tests cover a sentence ending in "।", a sentence ending in "॥", and a Devanagari sentence with no mark (still ends in "." today; this issue doesn't change that).

## Where to start

- `Sources/UttrflowCore/Cleaning/WordShape.swift:28` and `:54`
- `Sources/UttrflowCore/Models/DestinationFormatter.swift:51`
- Tests to extend: `Tests/UttrflowCoreTests/WordShapeTests.swift` and `Tests/UttrflowAITests/Passes/TerminalStopPassTests.swift`.
- Before pushing, run `make verify` (export `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer` first). It is the same command CI runs, and it enforces the 95% coverage floor per module.
- Read [CONTRIBUTING.md](https://github.com/uttrflow/uttrflow-swift/blob/main/CONTRIBUTING.md) first, and say on this issue that you are taking it.

**Size:** XS, about 1–2 hours.

Contributor guide

Open the contributing guide

Research direction

Read CONTRIBUTING.md, then inspect WordShape.swift at lines 28 and 54 and DestinationFormatter.swift at line 51. Extend WordShapeTests.swift and TerminalStopPassTests.swift for sentences ending in "।", "॥", and no mark, then run make verify with the specified DEVELOPER_DIR; done means existing Devanagari terminal marks are preserved without an added period.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
internationalization, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.