<commit_before>module ngApp.components.ui.string {

  class Ellipsicate {
    constructor() {
      return function (fullstring: string, length: number = 50) {
        if (fullstring) {
          return (fullstring.length <= length) ? fullstring : fullstring.substring(0, length) + "…";
        } else {
          return '';
        }
      };
    }
  }

  class Humanify {
    constructor() {
      return function (original: string, capitalize: boolean = true, facetTerm: boolean = false) {
        if (!angular.isDefined(original) || (angular.isString(original) && !original.length)) {
          return '--';
        }
        if (!angular.isString(original) || original.length <= 1) {
          return original;
        }

        var split;
        var humanified;

        if (facetTerm) {
          original = original.split(/(?=[A-Z])/).join(" ");
          humanified = original.replace(/\./g, " ").trim();
        } else {
          split = original.split(".");
          humanified = split[split.length - 1].replace(/_/g, " ").trim();

          // Special case 'name' to include any parent nested for sake of
          // specificity in the UI
          if (humanified === "name" && split.length > 1) {
            humanified = split[split.length - 2] + " " + humanified;
          }
        }

        var words = humanified.split(' '),
            cWords = [];

        if (capitalize) {
          words.forEach(function (word) {
            // Specialcase miRNA instances
            if (word.indexOf("miRNA") === -1) {
              cWords.push(word.charAt(0).toUpperCase() + word.slice(1));
            } else {
              cWords.push(word);
            }<commit_msg>chore(facet): Split on upper followed by lower.<commit_after>module ngApp.components.ui.string {

  class Ellipsicate {
    constructor() {
      return function (fullstring: string, length: number = 50) {
        if (fullstring) {
          return (fullstring.length <= length) ? fullstring : fullstring.substring(0, length) + "…";
        } else {
          return '';
        }
      };
    }
  }

  class Humanify {
    constructor() {
      return function (original: string, capitalize: boolean = true, facetTerm: boolean = false) {
        if (!angular.isDefined(original) || (angular.isString(original) && !original.length)) {
          return '--';
        }
        if (!angular.isString(original) || original.length <= 1) {
          return original;
        }

        var split;
        var humanified;

        if (facetTerm) {
          // Splits on capital letters followed by lowercase letters to find
          // words squished together in a string.
          original = original.split(/(?=[A-Z][a-z])/).join(" ");

          humanified = original.replace(/\./g, " ").trim();
        } else {
          split = original.split(".");
          humanified = split[split.length - 1].replace(/_/g, " ").trim();

          // Special case 'name' to include any parent nested for sake of
          // specificity in the UI
          if (humanified === "name" && split.length > 1) {
            humanified = split[split.length - 2] + " " + humanified;
          }
        }

        var words = humanified.split(' '),
            cWords = [];

        if (capitalize) {
          words.forEach(function (word) {
            // Specialcase miRNA instances
            if (word.indexOf("miRNA") === -1) {
              cWords.push(word.charAt(0).toUpperCase() + word.slice(1));
            } else {
              cWords.push(word);
            }
{'fraction_non_alphanumeric': 0.14402711098559728, 'fraction_numerical': 0.005648121999435188, 'mean_word_length': 1.7867820613690009, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5319163', 'n_tokens_mistral': 1025, 'n_tokens_neox': 976, 'n_words': 236}