Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sliding_window

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sliding_window

  • 1.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sliding Window Build Status RubyGems Version Of gitignore_rb

Implements the sliding window algorithm. This is useful for traversing phrases during NEL processing.

Usage

The Gem is called sliding_window and you can it is available via RubyGems:

gem install sliding_window

Examples

A simple example is as follows:

require 'sliding_window'

mapping = {
  'The Queen' => 'Queen Elizabeth II',
  'Queen' => 'Queen (band)',
  'Buckingham Palace' => 'Buckingham Palace'
}

sliding_window = SlidingWindow.new(%w{The Queen attended a concert at Buckingham Palace where Queen played some music}) do |window|
  key = window.join(' ')
  mapping[key] if mapping.include?(key)
end

sliding_window.to_a # => ['Queen Elizabeth II', 'Buckingham Palace', 'Queen (band)']

FAQs

Package last updated on 01 Dec 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc