(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports", "lodash/takeRight", "rxjs/operators"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports, require("lodash/takeRight"), require("rxjs/operators"));
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports, global.takeRight, global.operators);
    global.ngram = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _takeRight, _operators) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;
  _takeRight = _interopRequireDefault(_takeRight);

  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

  const ngram = function ngram(options = {
    n: 2
  }) {
    return source$ => source$.pipe((0, _operators.scan)((memo, word) => (0, _takeRight.default)([...memo, word], options.n), []), (0, _operators.filter)(words => words.length >= options.n));
  };

  var _default = ngram;
  _exports.default = _default;
});
//# sourceMappingURL=ngram.js.map