<commit_before>import * as alexa from "alexa-sdk";
import { IntentRequest, SlotValue } from "alexa-sdk";
import { i18n, TranslationFunction } from "i18next";
import * as _ from "lodash";
import { Model } from "../../Model";
import { IVoxaEvent, IVoxaIntent } from "../../VoxaEvent";
import { AlexaIntent } from "./AlexaIntent";

export interface IAlexaRequest extends alexa.RequestBody<alexa.Request> {
  context: any;
}

export interface ILaunchRequest extends alexa.RequestBody<alexa.LaunchRequest> {
  context: any;
}

export interface ISessionEndedRequest extends alexa.RequestBody<alexa.SessionEndedRequest> {
  context: any;
}

export class AlexaEvent extends IVoxaEvent {
  public intent!: IVoxaIntent;

  public requestToIntent: any = {
    "AudioPlayer.PlaybackNearlyFinished": "AudioPlayer.PlaybackNearlyFinished",
    "Display.ElementSelected": "Display.ElementSelected",
    "LaunchRequest": "LaunchIntent",
    "PlaybackController.NextCommandIssued": "PlaybackController.NextCommandIssued",
    "PlaybackController.PauseCommandIssued": "PlaybackController.PauseCommandIssued",
    "PlaybackController.PlayCommandIssued": "PlaybackController.PlayCommandIssued",
    "PlaybackController.PreviousCommandIssued": "PlaybackController.PreviousCommandIssued",
  };

  constructor(event: IAlexaRequest , context?: any) {
    super(event, context);
    this.session = _.cloneDeep(event.session);
    this.request = _.cloneDeep(event.request);
    this.context = _.cloneDeep(event.context);
    this.executionContext = context;

    if (_.isEmpty(_.get(this, "session.attributes"))) {
      _.set(this, "session.attributes", {});
    }

    this.mapRequestToIntent();

    if (!this.intent) {
      this.intent = new AlexaIntent(this.request.intent);
    }<commit_msg>include audioPlayer request (#102)<commit_after>import * as alexa from "alexa-sdk";
import { IntentRequest, SlotValue } from "alexa-sdk";
import { i18n, TranslationFunction } from "i18next";
import * as _ from "lodash";
import { Model } from "../../Model";
import { IVoxaEvent, IVoxaIntent } from "../../VoxaEvent";
import { AlexaIntent } from "./AlexaIntent";

export interface IAlexaRequest extends alexa.RequestBody<alexa.Request> {
  context: any;
}

export interface ILaunchRequest extends alexa.RequestBody<alexa.LaunchRequest> {
  context: any;
}

export interface ISessionEndedRequest extends alexa.RequestBody<alexa.SessionEndedRequest> {
  context: any;
}

export class AlexaEvent extends IVoxaEvent {
  public intent!: IVoxaIntent;

  public requestToIntent: any = {
    "AudioPlayer.PlaybackStarted": "AudioPlayer.PlaybackStarted",
    "AudioPlayer.PlaybackFinished": "AudioPlayer.PlaybackFinished",
    "AudioPlayer.PlaybackStopped": "AudioPlayer.PlaybackStopped",
    "AudioPlayer.PlaybackFailed": "AudioPlayer.PlaybackFailed",
    "AudioPlayer.PlaybackNearlyFinished": "AudioPlayer.PlaybackNearlyFinished",
    "Display.ElementSelected": "Display.ElementSelected",
    "LaunchRequest": "LaunchIntent",
    "PlaybackController.NextCommandIssued": "PlaybackController.NextCommandIssued",
    "PlaybackController.PauseCommandIssued": "PlaybackController.PauseCommandIssued",
    "PlaybackController.PlayCommandIssued": "PlaybackController.PlayCommandIssued",
    "PlaybackController.PreviousCommandIssued": "PlaybackController.PreviousCommandIssued",
  };

  constructor(event: IAlexaRequest , context?: any) {
    super(event, context);
    this.session = _.cloneDeep(event.session);
    this.request = _.cloneDeep(event.request);
    this.context = _.cloneDeep(event.context);
    this.executionContext = context;

    if (_.isEmpty(_.get(this, "session.attributes"))) {
      _.set(this, "session.attributes", {});
    }

    this.mapRequestToIntent();

    if (!this.intent) {
      this.intent = new AlexaIntent(this.request.intent);
    }
{'fraction_non_alphanumeric': 0.12359550561797752, 'fraction_numerical': 0.0028743140841390124, 'mean_word_length': 5.134615384615385, 'pattern_counts': {'":': 18, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1344856', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1130, 'n_words': 217}