Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
solr-synonyms
Advanced tools
Parse Solr/ElasticSearch synonyms files into JavaScript objects. You can then replace tokens with their synonyms easily.
Info on synonyms file format http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
npm install solr-synonyms
var synonyms = require('solr-synonyms');
Now you have access to the api.
inputString
: The string in solr format (see http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory)ignoreCase
: Ignore the case. Duh.expand
: See http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactoryReturns an object which maps the keys to arrays of strings.
tokens
: An array of strings.synonyms
: An object which maps words to synonyms, e.g. the output of synonyms.parse
.Returns a new array where tokens
have been replaced by their synonyms
.
# blank lines and lines starting with pound are comments.
#Explicit mappings match any token sequence on the LHS of "=>"
#and replace with all alternatives on the RHS. These types of mappings
#ignore the expand parameter in the schema.
#Examples:
i-pod, i pod => ipod,
sea biscuit, sea biscit => seabiscuit
#Equivalent synonyms may be separated with commas and give
#no explicit mapping. In this case the mapping behavior will
#be taken from the expand parameter in the schema. This allows
#the same synonym file to be used in different synonym handling strategies.
#Examples:
ipod, i-pod, i pod
foozball , foosball
universe , cosmos
# If expand==true, "ipod, i-pod, i pod" is equivalent to the explicit mapping:
ipod, i-pod, i pod => ipod, i-pod, i pod
# If expand==false, "ipod, i-pod, i pod" is equivalent to the explicit mapping:
ipod, i-pod, i pod => ipod
#multiple synonym mapping entries are merged.
foo => foo bar
foo => baz
#is equivalent to
foo => foo bar, baz
expand = false
{
'i-pod': ['ipod', 'i-pod', 'i pod'],
'i pod': ['ipod', 'i-pod', 'i pod'],
'ipod': ['ipod', 'i-pod', 'i pod'],
'sea biscuit': ['seabiscuit'],
'sea biscit': ['seabiscuit'],
'foosball': ['foozball'],
'foozball': ['foozball'],
'universe': ['universe'],
'cosmos': ['universe'],
'foo': ['foo bar', 'baz']
}
expand = true
{
'i-pod': ['ipod', 'i-pod', 'i pod'],
'i pod': ['ipod', 'i-pod', 'i pod'],
'ipod': ['ipod', 'i-pod', 'i pod'],
'sea biscuit': ['seabiscuit'],
'sea biscit': ['seabiscuit'],
'foozball': ['foozball', 'foosball'],
'foosball': ['foozball', 'foosball'],
'universe': ['universe', 'cosmos'],
'cosmos': ['universe', 'cosmos'],
'foo': ['foo bar', 'baz']
}
FAQs
Parse Solr/ElasticSearch synonyms files into JavaScript objects.
The npm package solr-synonyms receives a total of 13 weekly downloads. As such, solr-synonyms popularity was classified as not popular.
We found that solr-synonyms demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.