Skip to content

ElsiKora/Library-JS-String-Similarity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

project-logo

Library-JS-String-Similarity

Empowering match perfection with string similarity magic!

Developed with the software and tools below.

JavaScript YAML Webpack GitHub%20Actions JSON


Table of Contents

Overview

The software project, named String Similarity Library, facilitates efficient string comparison and best match identification based on bigrams. It streamlines the process of comparing strings, enhancing text-matching capabilities across various applications. The project offers automated dependency updates, version releases, code quality analysis, and security scans, ensuring robust functionality and maintainability. Through its comprehensive features such as webpack configuration, npm management, and continuous integration workflows, the String Similarity Library promotes code quality, security, and collaboration within the open-source community.


Features

Feature Description
βš™οΈ Architecture The project follows a modular architecture, with a clear separation of concerns between different components. It leverages webpack for bundling and distribution. The use of GitHub Actions automates various processes, enhancing efficiency.
πŸ”© Code Quality The codebase maintains high quality standards, with linting and automated code reviews in place. It follows a consistent coding style, thanks to tools like ESLint and husky. Changesets CLI ensures smooth version management.
πŸ“„ Documentation The project has extensive documentation covering setup, usage, and contribution guidelines. README files, GitHub Actions configurations, and inline comments enhance clarity and assist developers in understanding and contributing to the codebase.
πŸ”Œ Integrations Key integrations include GitHub Actions for CI/CD, Snyk for security scans, and AWS CodeCommit for code synchronization. These integrations enhance automation, security, and collaboration within the project.
🧩 Modularity The codebase is highly modular, promoting reusability and maintainability. Each component has well-defined responsibilities, making it easier to extend functionality or make changes without affecting other parts of the system.
πŸ§ͺ Testing Testing frameworks like Jest or Mocha are likely used for unit and integration tests. Automated testing ensures code reliability and helps identify issues early in the development cycle.
⚑️ Performance The project focuses on optimizing performance, with webpack configuration for efficient bundle sizes. Automated releases and dependency updates streamline processes, enhancing overall project efficiency.
πŸ›‘οΈ Security Security measures include automated security scans using Snyk, ensuring vulnerabilities are identified and addressed promptly. Additionally, GitHub Actions are configured to enforce security best practices, promoting a secure codebase.
πŸ“¦ Dependencies Key dependencies include webpack, ESLint, husky, and Snyk for various development and security-related tasks. These libraries enhance development workflows and ensure code quality and security.
πŸš€ Scalability The project demonstrates scalability through its modular architecture and automated processes. GitHub Actions manage releases and code synchronization, enabling the project to handle increased traffic and load effectively.

Repository Structure

└── /
    β”œβ”€β”€ .github
    β”‚   β”œβ”€β”€ dependabot.yml
    β”‚   └── workflows
    β”œβ”€β”€ LICENSE
    β”œβ”€β”€ README.md
    β”œβ”€β”€ package.json
    β”œβ”€β”€ src
    β”‚   └── index.js
    └── webpack.config.js

Modules

.
File Summary
webpack.config.js Generates production-ready JavaScript library string-similarity.min.js from src/index.js. Configures webpack to bundle the library for distribution, making it accessible as stringSimilarity in different projects.
package.json Enables comparing string similarity, with keywords like strings, difference, match. Manages dependencies, builds, lints code, and initiates releases. Designed for public access via Git.
.github
File Summary
dependabot.yml Automates dependency updates for npm and GitHub Actions on the dev branch, ensuring daily checks for package compatibility. Vital for maintaining repository health and keeping dependencies up-to-date without manual intervention.
src
File Summary
index.js Implements string comparison and best match finding, enhancing text-matching functionality for the repository. Key features include comparing strings based on bigrams and determining the best match from target strings.
.github.workflows
File Summary
release.yml Manages automated version releases via GitHub Actions, triggering on new commits to the main branch. Key features include version number incrementing, package publishing, and release note generation.
qodana-code-quality.yml Enhances repository quality via automated Qodana code analysis. Monitors sources in src/index.js for adherence to coding standards, promoting better code practices. Streamlines code review process for improved overall codebase quality.
snyk-security-scan.yml Implements automated security scans with Snyk in CI pipeline. Enhances repository security by identifying and addressing vulnerabilities early on. Configured as a workflow for seamless integration.
codecommit-sync.yml Ensures automated synchronization between the code repository and AWS CodeCommit. Implements scheduled sync using GitHub Actions, enhancing collaboration and ensuring code consistency across repositories.

API

The package contains two methods:

compareTwoStrings(string1, string2)

Returns a fraction between 0 and 1, which indicates the degree of similarity between the two strings. 0 indicates completely different strings, 1 indicates identical strings. The comparison is case-sensitive.

Arguments
  1. string1 (string): The first string
  2. string2 (string): The second string

Order does not make a difference.

Returns

(number): A fraction from 0 to 1, both inclusive. Higher number indicates more similarity.

Examples
stringSimilarity.compareTwoStrings("healed", "sealed");
// β†’ 0.8

stringSimilarity.compareTwoStrings(
  "Olive-green table for sale, in extremely good condition.",
  "For sale: table in very good  condition, olive green in colour."
);
// β†’ 0.6060606060606061

stringSimilarity.compareTwoStrings(
  "Olive-green table for sale, in extremely good condition.",
  "For sale: green Subaru Impreza, 210,000 miles"
);
// β†’ 0.2558139534883721

stringSimilarity.compareTwoStrings(
  "Olive-green table for sale, in extremely good condition.",
  "Wanted: mountain bike with at least 21 gears."
);
// β†’ 0.1411764705882353

findBestMatch(mainString, targetStrings)

Compares mainString against each string in targetStrings.

Arguments
  1. mainString (string): The string to match each target string against.
  2. targetStrings (Array): Each string in this array will be matched against the main string.
Returns

(Object): An object with a ratings property, which gives a similarity rating for each target string, a bestMatch property, which specifies which target string was most similar to the main string, and a bestMatchIndex property, which specifies the index of the bestMatch in the targetStrings array.

Examples
stringSimilarity.findBestMatch('Olive-green table for sale, in extremely good condition.', [
  'For sale: green Subaru Impreza, 210,000 miles',
  'For sale: table in very good condition, olive green in colour.',
  'Wanted: mountain bike with at least 21 gears.'
]);
// β†’
{ ratings:
   [ { target: 'For sale: green Subaru Impreza, 210,000 miles',
       rating: 0.2558139534883721 },
     { target: 'For sale: table in very good condition, olive green in colour.',
       rating: 0.6060606060606061 },
     { target: 'Wanted: mountain bike with at least 21 gears.',
       rating: 0.1411764705882353 } ],
  bestMatch:
   { target: 'For sale: table in very good condition, olive green in colour.',
     rating: 0.6060606060606061 },
  bestMatchIndex: 1
}

Project Roadmap

  • β–Ί String similarity comparison
  • β–Ί Automated dependency updates

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your local account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone ../
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to local: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the MIT License. For more details, refer to the LICENSE file.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published