<commit_before>'use strict';

angular.module('chatbotApp.AstBuilder', ['ngRoute', 'RecursionHelper'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/ast_builder', {
    templateUrl: 'ast_builder/ast_builder.html',
    controller: 'AstBuilderCtrl'
  });
}])

.controller('AstBuilderCtrl', ['$scope', function($scope) {
  $scope.ast = {};
}])

.directive('expressionMenu', [function() {
  return {
      restrict: 'A',
      link: function(scope, elem, attrs) {
        angular.element('.ui.dropdown').dropdown();
      }
    };
}])

.directive("astIf", [function(){
  function link(scope, element, attrs) {
    angular.element('.ui.dropdown').dropdown();
  }

  return {
    restrict: "E",
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_if.html",
    link: link,
    controller: function($scope){
    }
  }
}])

.directive("astElement", ["RecursionHelper", function(RecursionHelper){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_element.html",
    controller: function($scope){

      $scope.expressions = ["if", "contains", "response"];
      $scope.createBlock = function(type){
        if(type === 'if'){
          $scope.ast = {
            type: "if",
            arguments: [
              {}, {}
            ]
          };
        }
        if(type === 'contains'){
          $scope.ast = {
            type: "contains",
            arguments: [
              {type: "var", arguments: [{type: "atom", arguments: ["input"]}]},
              {type: "string", arguments: ["filthy"]}
            ]
          };
        }
        if(type === 'response'){
          $scope.ast = {
            type: "response",
            arguments: [
              {type: "string", arguments: ["oh so dirty!"]}
            ]
          }
        }
      };
      $scope.astIsEmpty = function(){
        return angular.equals($scope.ast, {});
      };
      $scope.astIsIf = function(){
        console.log($scope.ast);
        return angular.equals($scope.ast.type, "if");
      };
      $scope.astIsResponse = function(){
        return angular.equals($scope.ast.type, "response");
      };
      $scope.astIsContains = function(){
        return angular.equals($scope.ast.type, "contains");
      };
    },
    compile: function(element) {
      return RecursionHelper.compile(element, function(scope, iElement, iAttrs, controller, transcludeFn){
        // normal link function goes here
      });
    }
  }
}])

.directive("astResponse", [function(){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_response.html",
    controller: function($scope){
      console.log($scope.ast);
      $scope.response = $scope.ast.arguments[0];
      $scope.updateResponse = function(){
        $scope.ast.arguments[0] = $scope.response;
      }
    }
  }
}])

.directive("astContains", [function(){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_contains.html",
    controller: function($scope){
      $scope.containedText = $scope.ast.arguments[1].arguments[0];
      $scope.updateContainedText = function(){
        $scope.ast.arguments[1].arguments[0] = $scope.containedText;
      }<commit_msg>Remove console.log statements<commit_after>'use strict';

angular.module('chatbotApp.AstBuilder', ['ngRoute', 'RecursionHelper'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/ast_builder', {
    templateUrl: 'ast_builder/ast_builder.html',
    controller: 'AstBuilderCtrl'
  });
}])

.controller('AstBuilderCtrl', ['$scope', function($scope) {
  $scope.ast = {};
}])

.directive('expressionMenu', [function() {
  return {
      restrict: 'A',
      link: function(scope, elem, attrs) {
        angular.element('.ui.dropdown').dropdown();
      }
    };
}])

.directive("astIf", [function(){
  function link(scope, element, attrs) {
    angular.element('.ui.dropdown').dropdown();
  }

  return {
    restrict: "E",
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_if.html",
    link: link,
    controller: function($scope){
    }
  }
}])

.directive("astElement", ["RecursionHelper", function(RecursionHelper){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_element.html",
    controller: function($scope){
      $scope.expressions = ["if", "contains", "response"];
      $scope.createBlock = function(type){
        if(type === 'if'){
          $scope.ast = {
            type: "if",
            arguments: [
              {}, {}
            ]
          };
        }
        if(type === 'contains'){
          $scope.ast = {
            type: "contains",
            arguments: [
              {type: "var", arguments: [{type: "atom", arguments: ["input"]}]},
              {type: "string", arguments: ["filthy"]}
            ]
          };
        }
        if(type === 'response'){
          $scope.ast = {
            type: "response",
            arguments: [
              {type: "string", arguments: ["oh so dirty!"]}
            ]
          }
        }
      };
      $scope.astIsEmpty = function(){
        return angular.equals($scope.ast, {});
      };
      $scope.astIsIf = function(){
        return angular.equals($scope.ast.type, "if");
      };
      $scope.astIsResponse = function(){
        return angular.equals($scope.ast.type, "response");
      };
      $scope.astIsContains = function(){
        return angular.equals($scope.ast.type, "contains");
      };
    },
    compile: function(element) {
      return RecursionHelper.compile(element, function(scope, iElement, iAttrs, controller, transcludeFn){
      });
    }
  }
}])

.directive("astResponse", [function(){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_response.html",
    controller: function($scope){
      $scope.response = $scope.ast.arguments[0];
      $scope.updateResponse = function(){
        $scope.ast.arguments[0] = $scope.response;
      }
    }
  }
}])

.directive("astContains", [function(){
  return {
    scope: {
      ast: "="
    },
    templateUrl: "./ast_builder/ast_contains.html",
    controller: function($scope){
      $scope.containedText = $scope.ast.arguments[1].arguments[0];
      $scope.updateContainedText = function(){
        $scope.ast.arguments[1].arguments[0] = $scope.containedText;
      }
{'fraction_non_alphanumeric': 0.17835294117647058, 'fraction_numerical': 0.0018823529411764706, 'mean_word_length': 2.3156526261050443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5604331', 'n_tokens_mistral': 1938, 'n_tokens_neox': 1929, 'n_words': 315}