mssoftjp_obsidian-voice-input/docs/implementation-roadmap.md

6 KiB

Implementation Roadmap: Language-Specific Dictionaries

Next Implementation Issues

Based on the design document, the following GitHub issues should be created to implement the language-specific dictionary feature:

Issue 1: Core Type Definitions and Infrastructure

Title: feat: Add MultiLanguageDictionary type definitions and core infrastructure

Description: Implement the foundational type definitions and helper functions for language-specific dictionaries.

Tasks:

  • Add MultiLanguageDictionary interface to interfaces/transcription.ts
  • Add migration helper migrateLegacyDictionary() function
  • Add validation functions for dictionary limits
  • Update VoiceInputSettings to support new dictionary format
  • Add backward compatibility detection logic
  • Write unit tests for type definitions and helpers

Files to modify:

  • src/interfaces/transcription.ts
  • src/interfaces/settings.ts
  • src/utils/dictionary-migration.ts (new)
  • tests/unit/utils/dictionary-migration.test.ts (new)

Acceptance Criteria:

  • New type definitions compile without errors
  • Legacy dictionary migration works correctly
  • All validation functions have comprehensive tests
  • Backward compatibility is maintained

Issue 2: Dictionary Corrector Multi-Language Support

Title: feat: Implement multi-language support in DictionaryCorrector

Description: Extend the DictionaryCorrector class to support language-specific dictionaries with fallback logic.

Tasks:

  • Modify DictionaryCorrector to handle MultiLanguageDictionary
  • Implement getApplicableCorrections() with fallback logic
  • Add language detection parameter to correct() method
  • Update constructor to accept new dictionary format
  • Maintain backward compatibility with existing API
  • Add comprehensive unit tests for multi-language correction

Files to modify:

  • src/core/transcription/DictionaryCorrector.ts
  • tests/unit/core/transcription/multilingual-dictionary-correction.test.ts

Acceptance Criteria:

  • Fallback order works: currentLang → global (optional 'en' fallback only when a setting is enabled)
  • Legacy dictionaries continue to work
  • Performance does not degrade significantly
  • All edge cases are covered with tests

Issue 3: Settings UI Enhancement for Language Tabs

Title: feat: Add language-specific dictionary editing in settings UI

Description: Enhance the settings UI to support editing language-specific dictionary entries with tab-based navigation.

Tasks:

  • Add language tab navigation to dictionary settings
  • Implement language-specific entry display and editing
  • Add language filter/selector for dictionary entries
  • Update import/export functionality for new format
  • Add entry count display per language
  • Implement dictionary size warnings
  • Add migration notification for existing users

Files to modify:

  • src/views/VoiceInputViewUI.ts
  • src/views/VoiceInputViewActions.ts
  • Update corresponding CSS styles

Acceptance Criteria:

  • Users can switch between language tabs
  • Dictionary entries can be added/edited/deleted per language
  • Import/export works with both old and new formats
  • UI provides clear feedback on dictionary size limits
  • Existing users see migration guidance

Issue 4: Performance Optimization and Security

Title: feat: Add dictionary performance optimization and security measures

Description: Implement performance optimizations and security measures for the dictionary system.

Tasks:

  • Add entry count limits per language and globally
  • Implement dictionary size monitoring and warnings
  • Add input validation and sanitization
  • Implement dictionary caching for performance
  • Add processing time limits for correction operations
  • Create performance benchmarks and tests
  • Add memory usage monitoring

Files to modify:

  • src/core/transcription/DictionaryCorrector.ts
  • src/config/constants.ts (add limits)
  • src/utils/dictionary-validation.ts (new)
  • tests/performance/dictionary-performance.test.ts (new)

Acceptance Criteria:

  • Dictionary size limits are enforced
  • Input validation prevents security issues
  • Performance is maintained even with large dictionaries
  • Memory usage stays within reasonable limits
  • All security measures have corresponding tests

Issue 5: Integration and E2E Testing

Title: test: Add comprehensive integration tests for language-specific dictionaries

Description: Create comprehensive integration tests and update documentation for the new feature.

Tasks:

  • Add E2E tests for multi-language dictionary functionality
  • Test dictionary migration scenarios
  • Add performance regression tests
  • Update user documentation and README
  • Create migration guide for existing users
  • Add API reference documentation
  • Test with real-world dictionary data

Files to modify:

  • tests/integration/dictionary-multilingual.test.ts (new)
  • docs/user-guide.md (update)
  • docs/migration-guide.md (new)
  • README.md (update)

Acceptance Criteria:

  • All integration scenarios pass
  • Documentation is clear and comprehensive
  • Migration guide helps users transition smoothly
  • Performance benchmarks meet requirements

Implementation Order and Dependencies

  1. Issue 1 (Core Types) - No dependencies, implement first
  2. Issue 2 (DictionaryCorrector) - Depends on Issue 1
  3. Issue 4 (Performance/Security) - Can be done in parallel with Issue 2
  4. Issue 3 (UI Enhancement) - Depends on Issues 1 and 2
  5. Issue 5 (Testing/Docs) - Depends on all previous issues

Estimated Timeline

  • Week 1: Issues 1 and 2 (Core functionality)
  • Week 2: Issues 3 and 4 (UI and optimization)
  • Week 3: Issue 5 (Testing and documentation)

Risk Mitigation

  • Implement feature flags to enable/disable new functionality
  • Maintain backward compatibility throughout all phases
  • Add comprehensive logging for debugging migration issues
  • Create rollback procedures in case of critical issues