https://github.com/kui-shell/string-similarity-coloring
Color a given set of N strings into a set of M<N color classes
https://github.com/kui-shell/string-similarity-coloring
Last synced: 10 months ago
JSON representation
Color a given set of N strings into a set of M<N color classes
- Host: GitHub
- URL: https://github.com/kui-shell/string-similarity-coloring
- Owner: kui-shell
- Created: 2021-03-11T19:27:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-14T19:16:14.000Z (over 5 years ago)
- Last Synced: 2025-04-07T08:37:10.379Z (about 1 year ago)
- Language: TypeScript
- Size: 187 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# String Similarity Coloring
This package includes a set of heuristics to map a set of N strings to
a set of M
```typescript
import ssc from 'string-similarity-coloring'
// returns an array of color-class assignments,
// parallel to the input array of strings
ssc(['apache-coyote', 'apache', 'nginx 1',
'nginx 2', 'nginx', 'microsoft a'],
{ theme: 'colorbrewer' })
[
{ primary: 0, secondary: 0, color: '#2166AB' },
{ primary: 0, secondary: 2, color: '#91C4DE' },
{ primary: 1, secondary: 0, color: '#B4182B' },
{ primary: 1, secondary: 3, color: '#FDDCC9' },
{ primary: 1, secondary: 3, color: '#FDDCC9' },
{ primary: 2, secondary: 0, color: '#762A83' }
]
```
Where `primary` is the primary classification of the string, and
`secondary` is a secondary classification, based on distance of this
string from the string that defines the primary. If you want to use
your own color assignments, you can use the `primary` and
`secondary`. Otherwise, you can use the color scheme provided in the
response.
---
Magic from [IBM Research](https://www.research.ibm.com/).