Skip to content

Instantly share code, notes, and snippets.

@robvolk
Last active March 30, 2022 01:18
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save robvolk/fc0508cb1892b0a58c4e to your computer and use it in GitHub Desktop.
Save robvolk/fc0508cb1892b0a58c4e to your computer and use it in GitHub Desktop.
N-Grams Code Challenge

Foxbox Digital 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

  • Program in the language for the position for which you are applying
  • 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
  • Application accepts a parameter to generate n-grams from the parameter

Submission

  1. Create a secret Gist
  2. Email your Gist link to joinus@foxbox.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment