Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KamilLelonek/df41934a664d57725c7deb58bb59b73f to your computer and use it in GitHub Desktop.
Save KamilLelonek/df41934a664d57725c7deb58bb59b73f to your computer and use it in GitHub Desktop.
N-Grams Code Challenge

Foxbox N-Grams Code Challenge

This is a small programming problem to test your technical ability and coding style.

Instructions

Write a simple script to generate a set of n-grams from a string of text. N-grams are a contiguous sequence of n words from a string of text, and have many applications from full-text search indexes to machine learning.

You'll generate a set of every permutation of contiguous n-grams from a string of text, from 1-gram to n-grams where n is the number of words in the string

Example

"Show me the code."

Returns

[
  "Show",
  "Show me",
  "Show me the",
  "Show me the code",
  "me",
  "me the",
  "me the code",
  "the",
  "the code",
  "code"
]

Requirements

  • Code in JS, Ruby, or Elixir
  • Strip punctuation
  • Include tests
  • Write a single code file that includes both the application and tests
  • As comments in the code file, include installation instructions & instructions for how to run your test and run your code
  • Applicaiton accepts a parameter to generate n-grams from the parameter

Submission

  1. Create a secret Gist
  2. Email your Gist link to [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment