Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Dec 1, 2025

Summary

This PR adds support for features from other Links Notation library implementations, making link-notation-objects-codec a drop-in replacement for:

Features Added

LinksNotationManager (from lino.lib.mjs):

  • jsonToLino() and linoToJson() for JSON<->Links Notation conversion
  • escapeReference() for proper string escaping (handles spaces, quotes, parentheses, newlines)
  • File operations: saveAsLino, loadFromLino, saveJsonAsLino, loadJsonFromLino
  • Configurable storageDir for file storage location
  • Parsing utilities: parse, parseNumericIds, parseStringValues
  • lino singleton instance for convenience

Q&A Database (from qa-database.mjs):

  • createQADatabase(filePath) factory function
  • File-based Q&A storage with automatic locking for concurrent access
  • Multiline answer support using native Links Notation indentation
  • Special character handling (colons, parentheses, quotes)
  • Methods: addOrUpdateQA, getAnswer, deleteQA, getAllQA
  • Full Unicode/Cyrillic support

Fuzzy Matching Utilities:

  • levenshteinDistance(a, b) - Edit distance between strings
  • stringSimilarity(a, b) - Normalized similarity score (0-1)
  • normalizeQuestion(question) - Text normalization for comparison
  • extractKeywords(question, options) - Keyword extraction with stopwords filtering
  • keywordSimilarity(a, b) - Keyword overlap (Jaccard index)
  • findBestMatch(question, database, options) - Find best matching entry
  • findAllMatches(question, database, options) - Find all matches above threshold
  • Built-in Russian and English stopwords

Test Coverage

Added comprehensive test suite with 182 tests covering:

  • LinksNotationManager (jsonToLino, linoToJson, file operations, escaping)
  • Q&A Database (CRUD operations, concurrent writes, special characters)
  • Fuzzy matching (Levenshtein, similarity, keyword matching)

All tests pass in CI.

Documentation

Updated js/README.md and main README.md with:

  • New feature descriptions
  • API reference for all new functions
  • Usage examples

Test Plan

  • All existing tests pass (47 Python tests, 57 JS tests)
  • New tests pass (125 additional JS tests)
  • Total: 182 JS tests, all passing
  • CI workflow completes successfully

Fixes #7

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #7
@konard konard self-assigned this Dec 1, 2025
This commit adds support for features from other Links Notation
library implementations:

From lino.lib.mjs (follow project):
- LinksNotationManager class with JSON/Lino conversion
- jsonToLino() and linoToJson() for JSON<->Links Notation conversion
- escapeReference() for proper string escaping
- File operations: saveAsLino, loadFromLino, saveJsonAsLino, loadJsonFromLino
- Configurable storage directory

From qa-database.mjs (hh-job-application-automation):
- createQADatabase() factory function for Q&A storage
- File-based Q&A storage with automatic locking
- Multiline answer support with native indentation
- Special character handling (colons, parentheses, quotes)
- addOrUpdateQA, getAnswer, deleteQA, getAllQA methods

Fuzzy matching utilities:
- levenshteinDistance() for edit distance calculation
- stringSimilarity() for normalized similarity score
- extractKeywords() with stopwords filtering
- keywordSimilarity() for keyword overlap
- findBestMatch() and findAllMatches() for database queries
- Configurable Russian and English stopwords

Added comprehensive test suite (182 tests, all passing)
Updated documentation with new API reference

Fixes #7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Make sure we support experience from other implementations of Links Notation libraries Add LinksNotationManager, Q&A database, and fuzzy matching utilities Dec 1, 2025
@konard konard marked this pull request as ready for review December 1, 2025 11:00
@konard
Copy link
Member Author

konard commented Dec 1, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.655387 USD
  • Calculated by Anthropic: $3.787546 USD
  • Difference: $-1.867842 (-33.03%)
    📎 Log file uploaded as GitHub Gist (763KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure we support experience from other implementations of Links Notation libraries

2 participants